roscore fails to run
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
Asked by lewinste on 2019-10-08 17:21:54 UTC
Answers
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/271620/importerror-no-module-named-xxxxmsg/
3rd thought: reinstall the module: sudo apt-get install --reinstall ros-melodic-std-msgs
<-- or something like that
Asked by billy on 2019-10-08 18:51:38 UTC
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.
Asked by lewinste on 2019-10-09 13:01:28 UTC
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
?
Asked by billy on 2019-10-10 00:52:49 UTC
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?
Asked by lewinste on 2019-10-10 12:28:39 UTC
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.
Asked by gvdhoorn on 2019-10-10 12:31:16 UTC
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!
Asked by lewinste on 2019-10-10 12:44:13 UTC
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.
Asked by gvdhoorn on 2019-10-10 12:49:34 UTC
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?
Asked by lewinste on 2019-10-10 12:50:03 UTC
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.
Asked by gvdhoorn on 2019-10-10 12:50:43 UTC
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.
Asked by lewinste on 2019-10-10 17:15:19 UTC
Comments