I am trying to install a ROS driver for a radar sensor.
The ROS publisher node is written in Python 3. It uses rosy to create messages and services.
When I call the script using $ python3 filename.py
I see the following output:
File "umrr_can_publisher.py", line 3, in <module>
import rospy
File "/opt/ros/melodic/lib/python2.7/dist-packages/rospy/__init__.py", line 49, in <module>
from .client import spin, myargv, init_node, \
File "/opt/ros/melodic/lib/python2.7/dist-packages/rospy/client.py", line 52, in <module>
import roslib
File "/opt/ros/melodic/lib/python2.7/dist-packages/roslib/__init__.py", line 50, in <module>
from roslib.launcher import load_manifest
File "/opt/ros/melodic/lib/python2.7/dist-packages/roslib/launcher.py", line 42, in <module>
import rospkg
ModuleNotFoundError: No module named 'rospkg'
I also tried to run my script in a virtual environment but with the same result.
Thanks for helping.
rospkg
is a Python package that is usually provided by your ROS installation. If you are using a different interpreter than that used by the ROS installation, you will need to install this package manually, for example via pip3 install rospkg
.
Alternatively, if your virtual environment's interpreter is compatible with the interpreter used by your ROS installation, you may also add the path to ROS' python packages to your Python path.