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

Ubuntu 20.04 and ROS Noetic -> ImportError: No module named rospkg #226

Open
Helge543 opened this issue Aug 13, 2021 · 7 comments
Open

Ubuntu 20.04 and ROS Noetic -> ImportError: No module named rospkg #226

Helge543 opened this issue Aug 13, 2021 · 7 comments

Comments

@Helge543
Copy link

Hi, I'm working on Ubuntu 20.04 and ROS Noetic. I want to install this tello driver but I get the following error message:

SUMMARY
========

PARAMETERS
 * /rosdistro: noetic
 * /rosversion: 1.15.11
 * /tello/tello_driver_node/camera_calibration: /home/user...
 * /tello/tello_driver_node/connect_timeout_sec: 10.0
 * /tello/tello_driver_node/local_cmd_client_port: 8890
 * /tello/tello_driver_node/local_vid_server_port: 6038
 * /tello/tello_driver_node/stream_h264_video: True
 * /tello/tello_driver_node/tello_cmd_server_port: 8889
 * /tello/tello_driver_node/tello_ip: 192.168.10.1

NODES
  /tello/
    image_compressed (image_transport/republish)
    tello_driver_node (tello_driver/tello_driver_node)

auto-starting new master
process[master]: started with pid [35315]
ROS_MASTER_URI=http://localhost:11311

setting /run_id to b96e7966-fc1d-11eb-befe-89052bf0da48
process[rosout-1]: started with pid [35325]
started core service [/rosout]
process[tello/tello_driver_node-2]: started with pid [35332]
process[tello/image_compressed-3]: started with pid [35333]
Traceback (most recent call last):
  File "/home/user/catkin_ws/src/tello_driver/nodes/tello_driver_node", line 2, in <module>
    import rospy
  File "/opt/ros/noetic/lib/python3/dist-packages/rospy/__init__.py", line 49, in <module>
    from .client import spin, myargv, init_node, \
  File "/opt/ros/noetic/lib/python3/dist-packages/rospy/client.py", line 52, in <module>
    import roslib
  File "/opt/ros/noetic/lib/python3/dist-packages/roslib/__init__.py", line 50, in <module>
    from roslib.launcher import load_manifest  # noqa: F401
  File "/opt/ros/noetic/lib/python3/dist-packages/roslib/launcher.py", line 42, in <module>
    import rospkg
ImportError: No module named rospkg
[tello/tello_driver_node-2] process has died [pid 35332, exit code 1, cmd /home/user/catkin_ws/src/tello_driver/nodes/tello_driver_node __name:=tello_driver_node __log:=/home/user/.ros/log/b96e7966-fc1d-11eb-befe-89052bf0da48/tello-tello_driver_node-2.log].
log file: /home/user/.ros/log/b96e7966-fc1d-11eb-befe-89052bf0da48/tello-tello_driver_node-2*.log

I've seen that ImportError: No module named rospkg is pretty well known and I've been reading through a lot of posts but most of the people either have problems with conda (which does not run on my machine) or with the python version (they changed the version from 2. to 3.). My python version is 3.8.10 so I don't think that there is the problem. Does anyone know what the problem could be? Help would be much appreciated.

@cottsay
Copy link
Member

cottsay commented Oct 28, 2021

The most common reason I've seen missing system modules like this results from the use of a non-default Python interpreter. From what I can tell, you installed ros-noetic-roslib (and likely other dependencies of tello) via apt, which would have installed the python3-rospkg-modules deb on your system.

Please run which python3 to determine where your interpreter lives. If it doesn't live at /usr/bin/python3, then you have two choices:

  1. Start using the system default interpreter instead, which should have no problems finding the system-installed Python packages.
  2. Install ALL of the ROS Python dependencies via pip using your non-standard interpreter. This will likely be an uphill battle.

If my hunch is incorrect and you are indeed using the system interpreter, then we'll need to dig deeper. Please run the following and let me know what you find:
python3 -c "from distutils.sysconfig import get_python_lib; print(get_python_lib())"

@VincentDuf
Copy link

Hi !
I'm facing the same issue with a ROS/Gazebo simulator.
I have a colleague trying to put the simulator on his Ubuntu20.04 machine but impossible to find python-rospkg and python-rospy packages, is it normal ?

FIY we spent a lot of time checking the repo sources, environment setup etc.. Couldn't find anything different from Ubuntu18.04 on which the simulator runs well.

It seems that this issue is related to Ubuntu 20.04 depreciating python2, is that correct ? is there a way around this ?

Thanks !

@O2KAN
Copy link

O2KAN commented Feb 8, 2022

Hey, if you are using anaconda, try the same launch file after deactivating anaconda using: conda deactivate

@nuclearsandwich
Copy link
Contributor

nuclearsandwich commented Feb 24, 2022

I have a colleague trying to put the simulator on his Ubuntu20.04 machine but impossible to find python-rospkg and python-rospy packages, is it normal ?

Ubuntu 20.04 has dropped support for many python2 packages in favor of their python3 counterparts. Please do not use old issues to ask new questions. You can ask questions on https://answers.ros.org or if you believe that you've found a bug in rospkg you can report it with a new issue.

@Miha22
Copy link

Miha22 commented Mar 22, 2022

This is an issue because Ubuntu 20.04 has dropped python and python2, and now using python 3. Install the following lib to run ROS on Ubuntu 20.04: sudo apt install python-is-python3

@Miha22
Copy link

Miha22 commented Mar 22, 2022

I have a colleague trying to put the simulator on his Ubuntu20.04 machine but impossible to find python-rospkg and python-rospy packages, is it normal ?

Ubuntu 20.04 has dropped support for many python2 packages in favor of their python3 counterparts. Please do not use old issues to ask new questions. You can ask questions on https://answers.ros.org or if you believe that you've found a bug in rospkg you can report it with a new issue.

Yes, you are correct.

@nuclearsandwich
Copy link
Contributor

This is an issue because Ubuntu 20.04 has dropped python and python2, and now using python 3. Install the following lib to run ROS on Ubuntu 20.04: sudo apt install python-is-python3

I don't recommend installing this when running ROS as it could interfere with scripts that expect /usr/bin/python to be python 2 and will not run correctly.

If you encounter difficulties setting up ROS please ask for help on https://answers.ros.org

To avoid this issue becoming a honeypot for future questions I am going to close it (the original author never followed up) and lock it.

@ros-infrastructure ros-infrastructure locked as off-topic and limited conversation to collaborators May 23, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

6 participants