How to use a PyPI dependency?
I really need help connecting a few dots on this. I’ve only been working with Python for a few years, and I’m totally new to ROS2. I’ve been googling for hours and can’t find a thorough explanation anywhere.
I want to install and use a python package from PyPI, say some_special_package
. I found that I can submit a PR to add the package to some kind of rosdep global registry, at which point I would expect rosdep resolve python-some_special_package
to resolve it so that I can add an <exec_depend>python-some_special_package</exec_depend>
to my project.xml
file.
What if I just want to get something working right now on my own system? Let’s say that I followed this tutorial: https://index.ros.org/doc/ros2/Tutori... to create a couple simple nodes. Then I typed import some_special_package
at the top of one of the python files. Now when I rosdep install ...
, colcon build
, source install/setup.bash
, and finally ros2 run ...
, I get a ModuleNotFoundError
originating from the new line in my python file. What’s next? I must be missing something super simple. I tried creating a venv and installing the package myself. That doesn’t seem to be recognized.
I think the piece of information I’m missing is: where do my ROS nodes get their site packages from / where is the ros python path pointing to? (And how do I get custom packages there?)