ROS Resources: Documentation | Support | Discussion Forum | Index | Service Status | Q&A
Ask Your Question

[ROS2 Eloquent] Build from source rosdep error

asked 2020-04-07 22:25:41 -0500

Narton gravatar image

updated 2020-04-07 22:25:59 -0500


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/", line 3112, in <module>
  File "/home/hrrnxt/.local/lib/python2.7/site-packages/pkg_resources/", line 3096, in _call_aside
    f(*args, **kwargs)
  File "/home/hrrnxt/.local/lib/python2.7/site-packages/pkg_resources/", line 3125, in _initialize_master_working_set
    working_set = WorkingSet._build_master()
  File "/home/hrrnxt/.local/lib/python2.7/site-packages/pkg_resources/", line 580, in _build_master
    return cls._build_from_requirements(__requires__)
  File "/home/hrrnxt/.local/lib/python2.7/site-packages/pkg_resources/", line 593, in _build_from_requirements
    dists = ws.resolve(reqs, Environment())
  File "/home/hrrnxt/.local/lib/python2.7/site-packages/pkg_resources/", 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

edit retag flag offensive close merge delete


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.

Am I supposed to source a ROS workspace to be able to build from source?

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.

gvdhoorn gravatar image gvdhoorn  ( 2020-04-08 03:59:15 -0500 )edit

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.

Narton gravatar image Narton  ( 2020-04-08 18:15:01 -0500 )edit

1 Answer

Sort by ยป oldest newest most voted

answered 2020-04-08 18:18:16 -0500

Narton gravatar image

I ended up cleaning out the python2 and python3 environments of ros stuff, reinstalling ros-melodic, then had to 'pip2 install catkin_pkg' before rosdep worked with melodic. Rosdep then worked for setting up the dependencies for eloquent.

edit flag offensive delete link more


How did you clean out the python2 and python3 environments of ros stuff?

aleena_infinitynbeyond gravatar image aleena_infinitynbeyond  ( 2021-09-22 02:20:48 -0500 )edit

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools

1 follower


Asked: 2020-04-07 22:25:41 -0500

Seen: 3,020 times

Last updated: Apr 08 '20