ROS Resources: Documentation | Support | Discussion Forum | Index | Service Status | Q&A
Ask Your Question

rosmsg not found

asked 2021-05-13 12:15:54 -0500

Hubert gravatar image

updated 2021-05-13 18:33:11 -0500

jayess gravatar image

Hi! I am new to ROS. I was wondering why I get the following message after writing $ rosmsg show sensor_msgs/ :

Command 'rosmsg' not found, but can be installed with:

sudo apt install python-rosmsg

When I tried $ sudo apt install python-rosmsg, it said:

The following packages have unmet dependencies:
 python-rosmsg : Depends: python-roslib but it is not going to be installed
                 Depends: python-rosbag but it is not going to be installed
E: Unable to correct problems, you have held broken packages.

I am using ubuntu 18.04 on a windows machine and the Melodic version of ROS. Thank you for the clarification!

edit retag flag offensive close merge delete


When I tried $ sudo apt install python-rosmsg, it said:

Try this command.

sudo apt-get install ros-<ros_version>-ros-comm
Ranjit Kathiriya gravatar image Ranjit Kathiriya  ( 2021-05-14 03:52:17 -0500 )edit

Thanks! I am not getting some errors that I was getting before.

Hubert gravatar image Hubert  ( 2021-05-14 14:34:26 -0500 )edit

1 Answer

Sort by ยป oldest newest most voted

answered 2021-05-14 12:22:30 -0500

makr gravatar image

updated 2021-05-14 14:38:55 -0500

You probably don't have ROS sourced in this terminal, try:

source /opt/ros/melodic/setup.bash

If that's the issue, it would be a good idea to add that line to the bottom of your .bashrc file which runs a script every time you open a terminal. You can also source catkin workspaces (catkin_ws or any other name) here, just add this line after the previous:

source ~/catkin_ws/devel/setup.bash
edit flag offensive delete link more


When I write source opt/ros/melodic/setup.bash I get : -bash: opt/ros/melodic/setup.bash: No such file or directory

However when I source catkin workspaces by writing: source ~/catkin_ws/devel/setup.bash

the program compiles then when I try to use rosmsg as before I get the old error messages. Also, I I could not find any .bashrc file in my folders to add that line. Would it be better to use a virtualBox with ubuntu or reinstall ros on my laptop?

Hubert gravatar image Hubert  ( 2021-05-14 14:19:46 -0500 )edit

Apologies, I didn't see that you are working in Windows. Also, I missed the slash (/) before opt but have edited my previous answer, so maybe give that a shot. Beyond that I don't know enough about the Windows OS to help much, but it looks like Ranjit may have answered your question.

makr gravatar image makr  ( 2021-05-14 14:42:21 -0500 )edit

@Hubert there's a significant difference between

opt/ros/melodic/setup.bash # what you wrote


/opt/ros/melodic/setup.bash # what @MAKR wrote

Notice the leading forward slash (/) in what @MAKR wrote

jayess gravatar image jayess  ( 2021-05-14 15:29:47 -0500 )edit

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools

1 follower


Asked: 2021-05-13 12:15:54 -0500

Seen: 534 times

Last updated: May 14 '21