Ask Your Question
0

roscore fails to run

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

lewinste gravatar image

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

Hello.

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/_Log.py", line 8, in <module>
    import std_msgs.msg
ImportError: No module named msg

How can I fix this error?

Thanks,

Arnon

edit retag flag offensive close merge delete

2 Answers

Sort by ยป oldest newest most voted
0

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

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.

Thanks.

edit flag offensive delete link more
0

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

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: https://answers.ros.org/question/2716...

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

edit flag offensive delete link more

Comments

Thanks Billy, but unfortunately none of the above worked.

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

lewinste gravatar imagelewinste ( 2019-10-09 13:01:28 -0600 )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 imagebilly ( 2019-10-10 00:52:49 -0600 )edit

Hi Billy.

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

If I understand correctly, the file _Log.py 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 imagelewinste ( 2019-10-10 12:28:39 -0600 )edit
1

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 imagegvdhoorn ( 2019-10-10 12:31:16 -0600 )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
print(sys.path)

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/python37.zip', '/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 imagelewinste ( 2019-10-10 12:44:13 -0600 )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 imagegvdhoorn ( 2019-10-10 12:49:34 -0600 )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 imagelewinste ( 2019-10-10 12:50:03 -0600 )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 imagegvdhoorn ( 2019-10-10 12:50:43 -0600 )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

Stats

Asked: 2019-10-08 17:21:54 -0600

Seen: 36 times

Last updated: Oct 10