ModuleNotFoundError: No module named rospkg

asked 2020-03-02 00:34:25 -0500

jackkj gravatar image

updated 2020-03-02 01:55:31 -0500

gvdhoorn gravatar image

Hi all,

I know this questions has been asked many times but when go to the catkin workspace and compile astra_camera this error appeared:

   from roslib.launcher import load_manifest
  File "/opt/ros/melodic/lib/python2.7/dist-packages/roslib/", line 42, in <module>
    import rospkg
ModuleNotFoundError: No module named 'rospkg'
make[2]: *** [ros_astra_camera/CMakeFiles/astra_camera_gencfg.dir/build.make:66: /home/pi/catkin_ws/devel/include/astra_camera/AstraConfig.h] Error 1
make[1]: *** [CMakeFiles/Makefile2:3453: ros_astra_camera/CMakeFiles/astra_camera_gencfg.dir/all] Error 2
make[1]: *** Waiting for unfinished jobs....
[  0%] Built target sensor_msgs_generate_messages_cpp
[  0%] Built target rosgraph_msgs_generate_messages_nodejs
[  0%] Built target std_msgs_generate_messages_eus
make: *** [Makefile:141: all] Error 2
Invoking "make -j4 -l4" failed

I'm currently using ros melodic with raspbian buster on a Pi4 4gb i have tried to change the python path and reinstall the rospkg but still this error.

Please help me :(

edit retag flag offensive close merge delete


I know this questions has been asked many times

I agree. Did you check the respective answers and try the suggested solutions? Please link to the ones you found, and describe why the respective solutions did not work for you...

mgruhler gravatar image mgruhler  ( 2020-03-02 01:03:09 -0500 )edit

i had tried this solution but it still gave back me the same error reinstall

i have also tried (export PYTHONPATH=$PYTHONPATH:/usr/lib/python2.7/dist-packages) but this gave me error of python not working

i have also tried this method

sudo update-alternatives --install /usr/bin/python python /usr/bin/python3 100 
sudo update-alternatives --install /usr/bin/python python /usr/bin/python2 150

but still the same error

majority that faced this issue has anaconda installed that caused the pythonpath to change.

these are my pythonpaths,

jackkj gravatar image jackkj  ( 2020-03-02 01:42:36 -0500 )edit