'No module named urdf2webots - pip installed package outside of sys.path
I installed a package via pip install urdf2webots. Upon using the command python -m urdf2webots.importer --input=Rover_2022.urdf --output=Rover_2022.proto, I get /bin/python: No module named urdf2webots. How do I fix this?
Without sudo
which pythonreturns/bin/pythonpip show urdf2webotsreturns
Name: urdf2webots
Version: 1.0.16
Summary: A converter between URDF and PROTO files.
Home-page: https://github.com/cyberbotics/urdf2webots
Author: Cyberbotics
Author-email: [email protected]
License: Apache License, Version 2.0
Location: /home/drakeprovost/.local/lib/python3.8/site-packages
Requires: rospkg, pycollada, numpy, Pillow
Required-by:
- If I get
pythonto print the sys.path, I get:
$ python
Python 2.7.18 (default, Mar 8 2021, 13:02:45)
[GCC 9.3.0] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import sys
>>> sys.path
['', '/opt/ros/foxy/lib/python3.8/site-packages', '/usr/lib/python2.7', '/usr/lib/python2.7/plat-x86_64-linux-gnu', '/usr/lib/python2.7/lib-tk', '/usr/lib/python2.7/lib-old', '/usr/lib/python2.7/lib-dynload', '/usr/local/lib/python2.7/dist-packages', '/usr/lib/python2.7/dist-packages']
>>>
With sudo
It's worth noting that I tried all these commands with sudo as well to see if it changed where the packages were installed. It did, but the problem persisted:
$ sudo python -m urdf2webots.importer --input=Rover_2022.urdf --output=Rover_2022.protoyields/usr/bin/python: No module named urdf2webotssudo which pythonyields/usr/bin/pythonsudo pip show urdf2webotsgives
Name: urdf2webots
Version: 1.0.16
Summary: A converter between URDF and PROTO files.
Home-page: https://github.com/cyberbotics/urdf2webots
Author: Cyberbotics
Author-email: [email protected]
License: Apache License, Version 2.0
Location: /usr/local/lib/python3.8/dist-packages
Requires: rospkg, Pillow, pycollada, numpy
Required-by:
- sys.path returns
$ sudo python
Python 2.7.18 (default, Mar 8 2021, 13:02:45)
[GCC 9.3.0] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import sys
>>> sys.path
['', '/usr/lib/python2.7', '/usr/lib/python2.7/plat-x86_64-linux-gnu', '/usr/lib/python2.7/lib-tk', '/usr/lib/python2.7/lib-old', '/usr/lib/python2.7/lib-dynload', '/usr/local/lib/python2.7/dist-packages', '/usr/lib/python2.7/dist-packages']
>>>
I recognize that in both cases the location of urdf2webots does not match any of the paths from sys.path, but I don't know how to fix this. Any tips?
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
