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

roscore fails to run

asked 2019-10-08 17:21:54 -0500

lewinste gravatar image

updated 2019-10-10 17:16:34 -0500


After installing turtlebot3 packages (Ubuntu 18.04, ROS melodic, following the instruction from here), roscore fails to run.

Following the traceback, I get the following error message:

File "/opt/ros/melodic/lib/python2.7/dist-packages/rosgraph_msgs/msg/", line 8, in <module>
    import std_msgs.msg
ImportError: No module named msg

How can I fix this error?



edit retag flag offensive close merge delete

2 Answers

Sort by ยป oldest newest most voted

answered 2019-10-10 17:15:19 -0500

lewinste gravatar image

It seems that the problem was with the Dropbox folder I used to store my catkin workspace.

After uninstalling ROS and Anaconda and staying with my previous workspace (in Dropbox), the problem still remained.

Only after deleting the workspace in Dropbox and building a new one outside, the problem was solved.

It seems that I will have to sync my work between home and office computers using other options, such as Git.


edit flag offensive delete link more

answered 2019-10-08 18:51:38 -0500

billy gravatar image

1st thought: did you source the setup.bash file after building? I'll assume yes, but do it if you didn't.

2nd thought: check this out:

3rd thought: reinstall the module: sudo apt-get install --reinstall ros-melodic-std-msgs <-- or something like that

edit flag offensive delete link more


Thanks Billy, but unfortunately none of the above worked.

The problem is with the file, which belongs to the ROS library. The import std_msgs.msg command in this file fails to find msg.

lewinste gravatar image lewinste  ( 2019-10-09 13:01:28 -0500 )edit

Sorry those ideas didn't help. But the issue is much more likely to do with your installation or environment, than to be the file.

What is response to rospack find std_msgs ?

billy gravatar image billy  ( 2019-10-10 00:52:49 -0500 )edit

Hi Billy.

This is the response to the command: /home/lewinste/Dropbox/catkin_ws/src/std_msgs

If I understand correctly, the file that raised the error can't find the module std_msg that contains the class msg. How can I make it search std_msgs that exists in catkin_ws/src?

lewinste gravatar image lewinste  ( 2019-10-10 12:28:39 -0500 )edit

Just an observation: storing Catkin workspaces in Dropbox synced directories is not really recommended. Especially not with Git repositories in the mix.

It can work, but be prepared for some weirdness with file permissions and sync problems.

gvdhoorn gravatar image gvdhoorn  ( 2019-10-10 12:31:16 -0500 )edit

I think that the path to std_msgs (that is /home/lewinste/Dropbox/catkin_ws/src) should be in the file sys.path (which I cannot find in my system).

When launching the Python command line and typing:

import sys

I get the following result:

['', '/home/lewinste/Dropbox/catkin_ws/devel/lib/python2.7/dist-packages', '/opt/ros/melodic/lib/python2.7/dist-packages', '/home/lewinste/anaconda3/lib/', '/home/lewinste/anaconda3/lib/python3.7', '/home/lewinste/anaconda3/lib/python3.7/lib-dynload', '/home/lewinste/anaconda3/lib/python3.7/site-packages']

Again, no indication of the actual path where std_msgs can be found.

Any ideas? Thanks!

lewinste gravatar image lewinste  ( 2019-10-10 12:44:13 -0500 )edit

You appear to be using Anaconda. Please read this: Should we warn (new) users about difficulties with Python 3 and alternative Python interpreters? and the many Q&As about this here on ROS Answers.

gvdhoorn gravatar image gvdhoorn  ( 2019-10-10 12:49:34 -0500 )edit

Regarding the Dropbox folder, I found it very convenient since I work from the office and from home on the same project.

Do you think this could be the cause of this problem?

lewinste gravatar image lewinste  ( 2019-10-10 12:50:03 -0500 )edit

No, but I wanted to make you aware of it.

Proper software development practices would be to use a version control system such as Git.

gvdhoorn gravatar image gvdhoorn  ( 2019-10-10 12:50:43 -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: 2019-10-08 17:21:54 -0500

Seen: 456 times

Last updated: Oct 10 '19