Home > database >  No module named urdf2webots - pip installed package outside of sys.path
No module named urdf2webots - pip installed package outside of sys.path

Time:02-23

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 python returns /bin/python
  • pip show urdf2webots returns
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 python to 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.proto yields /usr/bin/python: No module named urdf2webots
  • sudo which python yields /usr/bin/python
  • sudo pip show urdf2webots gives
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?

CodePudding user response:

You could try:

python -m pip install urdf2webots

This will install the library for the default python that you want to use.

  • Related