Ask Your Question

ERROR: The core ROS message libraries (std_msgs and rosgraph_msgs) have not been built.

asked 2021-01-28 15:34:22 -0500

nautilus gravatar image

I am trying to run roscore, but get an import error saying: ImportError: No module named msg

When I run roswtf I get the message: ERROR: The core ROS message libraries (std_msgs and rosgraph_msgs) have not been built.

However, both are in my catkin library. I have run roscore many times before with no problem. Today I went to run it and got that error. I have not changed anything since the last time I used it and can't figure it out.

edit retag flag offensive close merge delete

2 Answers

Sort by ยป oldest newest most voted

answered 2021-01-28 21:40:41 -0500

makr gravatar image

updated 2021-05-16 11:09:14 -0500

2 ideas that might help:

First off, make sure ROS and your ROS workspace are sourced in this terminal. You can check by entering the following in a terminal:


It should show /opt/ros/[version]/share as well as files related to your workspace. If not, enter the following (and consider appending them to your ~/.bashrc):

source /opt/ros/melodic/setup.bash
source ~/[workspace]/devel/setup.bash

Second, I believe std_msgs and rosgraph_msgs are core ROS packages (at least in Melodic) and should probably not be located in your catkin library. I recommend removing them and cleaning then building your workspace.

If these suggestions don't help, here are some similar questions to look at: 1, 2, 3

edit flag offensive delete link more


I appreciate the help. Everything looked fine for suggestion 1. I tried suggestion 2. That didn't work and I've already looked at the similar questions and they didn't help. I ended up just uninstalling ros and reinstalling it. No sure what happened.

nautilus gravatar image nautilus  ( 2021-01-29 14:47:30 -0500 )edit

answered 2021-01-29 14:50:43 -0500

nautilus gravatar image

I ended up uninstalling ros with

sudo apt-get remove ros-melodic*

and then reinstalling using instructions here

edit flag offensive delete link more

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-01-28 15:34:22 -0500

Seen: 72 times

Last updated: May 16