Should every package have a setup.bash? I am trying to run the basic talker.py and listener.py nodes however I am getting these errors. I took every step mentioned in the tutorial however still seem to be getting an error.

asked 2021-12-14 19:06:59 -0500

commando2239 gravatar image

updated 2022-01-31 09:00:09 -0500

lucasw gravatar image

The reason I am asking about the setup.bash file is because I am not sure if I need to source every package to the bashrc file just like I did for my workspace.

Please let me know what I can do to get rid of the errors. I am on my other computer right now therefore I cannot copy and paste the errors, however I will edit the post soon with the errors.

NOTE: While running all these rosrun commands, Roscore was running.

After I ran rosrun <.....> <.....>, I got this error:

    Traceback (most recent call last):
  File "/home/sharyat/catkin_ws/src/data_extract/scripts/listener.py", line 3, 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

My bashrc file only has the source to my locatiion on ROS however I have sourced the devel folder in my catkin ws.

this is my only soruce code in my bashrc

source /opt/ros/noetic/setup.bash
edit retag flag offensive close merge delete

Comments

Try to install the following:

sudo apt-get install python3-catkin-pkg-modules
sudo apt-get install python3-rospkg-modules
osilva gravatar image osilva  ( 2021-12-15 15:47:31 -0500 )edit