[ROS2 Eloquent] Build from source rosdep error
Hello,
I am atempting to build ROS2 from source to include messages from vision_msgs package in ros bridge. I am following the instructions here. Everything goes well up until the section where I am supposed to use rosdep. I get an error:
user@comp:~/Workspace/ros2_eloquent$ sudo rosdep init
Traceback (most recent call last):
File "/usr/bin/rosdep", line 6, in <module>
from pkg_resources import load_entry_point
File "/home/hrrnxt/.local/lib/python2.7/site-packages/pkg_resources/__init__.py", line 3112, in <module>
@_call_aside
File "/home/hrrnxt/.local/lib/python2.7/site-packages/pkg_resources/__init__.py", line 3096, in _call_aside
f(*args, **kwargs)
File "/home/hrrnxt/.local/lib/python2.7/site-packages/pkg_resources/__init__.py", line 3125, in _initialize_master_working_set
working_set = WorkingSet._build_master()
File "/home/hrrnxt/.local/lib/python2.7/site-packages/pkg_resources/__init__.py", line 580, in _build_master
return cls._build_from_requirements(__requires__)
File "/home/hrrnxt/.local/lib/python2.7/site-packages/pkg_resources/__init__.py", line 593, in _build_from_requirements
dists = ws.resolve(reqs, Environment())
File "/home/hrrnxt/.local/lib/python2.7/site-packages/pkg_resources/__init__.py", line 781, in resolve
raise DistributionNotFound(req, requirers)
pkg_resources.DistributionNotFound: The 'rosdistro>=0.7.5' distribution was not found and is required by rosdep
Am I supposed to source a ROS workspace to be able to build from source? My output from "env | grep ROS" is empty.
Running on Ubuntu 18.04.4 LTS, x64
One thing I notice is that ROS 2 is exclusively Python 3. The traceback you show includes a lot of
python2.7
paths. That may be what is going wrong here.Have you at any point installed any ROS Python packages using
pip
? That's typically how they end up in your$HOME
directory.You'll want to try removing those and then see whether things work.
No, but your Python interpreter must have access to the required (versions of) the necessary packages. It looks like your current setup is making that impossible.
Good point. I uninstalled a lot of ros stuff from both python2 and python3 using pip, then apt removed ros-*. Reinstalled ros-melodic, and then had to 'pip2 install catkin_pkg' before rosdep would work with the melodic install... so I have gotten past the error. I think it is possible the confusion came from me thinking pip pointed to python2 while it points to python3.