ROS Resources: Documentation | Support | Discussion Forum | Index | Service Status | ros @ Robotics Stack Exchange
Ask Your Question

rosdep cannot initialise

asked 2022-02-15 21:15:48 -0600

dual-swordsman gravatar image

System spec:

Ubuntu 18.04 ROS Melodic

Python 3.10.2 (when i run python --version)

Jetson Xavier

Description: I was following the official tutorial from ROS wiki on installing ROS Melodic but I having a problem when i tried to init rosdep.

Installation of rosdep was not a problem. the result is as follows:

sudo apt install python-rosdep
Reading package lists... Done
Building dependency tree       
Reading state information... Done
python-rosdep is already the newest version (0.21.0-1).
0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.

However, the initialisation of rosdep return this:

sudo rosdep init
 Traceback (most recent call last):
  File "/usr/bin/rosdep", line 6, in <module>
    from pkg_resources import load_entry_point
  File "/usr/lib/python3/dist-packages/pkg_resources/", line 77, in <module>
  File "/usr/lib/python3/dist-packages/pkg_resources/_vendor/packaging/", line 9, in <module>
    from pkg_resources.extern.pyparsing import stringStart, stringEnd, originalTextFor, ParseException
  File "<frozen importlib._bootstrap>", line 1027, in _find_and_load
  File "<frozen importlib._bootstrap>", line 1006, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 672, in _load_unlocked
  File "<frozen importlib._bootstrap>", line 632, in _load_backward_compatible
  File "/usr/lib/python3/dist-packages/pkg_resources/extern/", line 43, in load_module
  File "/usr/lib/python3/dist-packages/pkg_resources/_vendor/", line 943, in <module>
AttributeError: module 'collections' has no attribute 'MutableMapping'

Hence, I suspect it is due to python version. I hope I could get a second opinion on this.

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted

answered 2022-02-15 21:28:33 -0600

tfoote gravatar image

This does look like a problem with your python versions and mismatched libraries.

If you're using python3 you should use the python3-rosdep tool. If you have installed the python2 version and it's using the python3 libraries (potentially by using pythonispython3 or something like that it could potentially cause trouble.

Looking a little deeper I also note that if you're using python 3.10 it's definitely not the version packaged as a debian package on Bionic 18.04 which means that your python version is custom. So you probably should be installing rosdep via the same mechanism as the python version. Possibly via pip instead of via the debian package. Once you're not using the system version of python, binary packages like python-rosdep are not expected to work either.

edit flag offensive delete link more


Hi tfoote, thank you so much for pointing out the python version. I forgot that I changed the python default which is different from the original python. I solved this problem by change the pyhton default back to python 2, uninstall everything and then reinstall. Now it work perfectly. What a good feeling it was hahah. Now i can focus on my project. Again, thank you for your fast reply.

dual-swordsman gravatar image dual-swordsman  ( 2022-02-15 22:31:29 -0600 )edit

You're welcome. Thanks for the well asked question with enough information to debug the problem.

tfoote gravatar image tfoote  ( 2022-02-16 03:35:51 -0600 )edit

Question Tools

1 follower


Asked: 2022-02-15 21:15:48 -0600

Seen: 262 times

Last updated: Feb 15 '22