Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

🐞 Calling rosdep init fails #154

Closed
petrlmat opened this issue Jan 24, 2023 · 1 comment
Closed

🐞 Calling rosdep init fails #154

petrlmat opened this issue Jan 24, 2023 · 1 comment
Labels
bug Something isn't working

Comments

@petrlmat
Copy link
Member

petrlmat commented Jan 24, 2023

Issue
Calling rosdep init fails when multiple versions of rospkg and/or rosdep packages are installed.
The error output message:

Traceback (most recent call last):
  File "/usr/bin/rosdep", line 11, in <module>
    load_entry_point('rosdep==0.22.1', 'console_scripts', 'rosdep')()
  File "/usr/lib/python3/dist-packages/pkg_resources/__init__.py", line 490, in load_entry_point
    return get_distribution(dist).load_entry_point(group, name)
  File "/usr/lib/python3/dist-packages/pkg_resources/__init__.py", line 2854, in load_entry_point
    return ep.load()
  File "/usr/lib/python3/dist-packages/pkg_resources/__init__.py", line 2445, in load
    return self.resolve()
  File "/usr/lib/python3/dist-packages/pkg_resources/__init__.py", line 2451, in resolve
    module = __import__(self.module_name, fromlist=['__name__'], level=0)
  File "/usr/lib/python3/dist-packages/rosdep2/__init__.py", line 45, in <module>
    from .lookup import RosdepDefinition, RosdepView, RosdepLookup, \
  File "/usr/lib/python3/dist-packages/rosdep2/lookup.py", line 44, in <module>
    from .sources_list import SourcesListLoader
  File "/usr/lib/python3/dist-packages/rosdep2/sources_list.py", line 42, in <module>
    from .gbpdistro_support import get_gbprepo_as_rosdep_data, download_gbpdistro_as_rosdep_data
  File "/usr/lib/python3/dist-packages/rosdep2/gbpdistro_support.py", line 14, in <module>
    from .platforms.debian import APT_INSTALLER
  File "/usr/lib/python3/dist-packages/rosdep2/platforms/debian.py", line 34, in <module>
    from rospkg.os_detect import (
ImportError: cannot import name 'OS_RASPBIAN' from 'rospkg.os_detect' (/usr/local/lib/python3.8/dist-packages/rospkg/os_detect.py)

Solution
Uninstall all versions of rosdep and rospkg and install them only through apt, which is the official way:

sudo pip3 uninstall rospkg rosdep
sudo pip uninstall rospkg rosdep
sudo apt install python3-rospkg python3-rosdep

Initialize rosdep:

sudo -E rosdep init

The -E flag preserves the user environment variables even when running the command with sudo.

@petrlmat petrlmat added the bug Something isn't working label Jan 24, 2023
@petrlmat petrlmat changed the title Calling rosdep init fails🐞 🐞 Calling rosdep init fails Jan 24, 2023
@matemat13
Copy link
Member

If you're getting a rosdep: command not found error, try running sudo apt install --reinstall python3-rospkg python3-rosdep.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants