Ask Your Question

ModuleNotFoundError: No module named 're'

asked 2017-07-05 02:41:07 -0600

mallikarjun.talagade gravatar image

I was following this ROS tutorial and got the following error:

roslaunch mybot_gazebo mybot_world.launch

... logging to /home/mallikarjun/.ros/log/47f3e6c2-6153-11e7-9730-9439e5050f5a/roslaunch-mallikarjun-Ideapad-Z570-21214.log Checking log directory for disk usage. This may take awhile. Press Ctrl-C to interrupt Done checking log file disk usage. Usage is <1GB.

Traceback (most recent call last): File "/opt/ros/lunar/share/xacro/", line 55, in <module> import xacro File "/opt/ros/lunar/lib/python2.7/dist-packages/xacro/", line 35, in <module> import glob File "/home/mallikarjun/anaconda3/lib/python3.6/", line 4, in <module> import re

ModuleNotFoundError: No module named 're'

Invalid tag: Cannot load command parameter [robot_description]: command [/opt/ros/lunar/share/xacro/ '/home/mallikarjun/mybot_ws/src/mybot_description/urdf/mybot.xacro'] returned with code [1].

Param xml is The traceback for the exception was written to the log file

edit retag flag offensive close merge delete


hi,i have the same problem as it,How to solve this problem?thank you very much!

heyong gravatar imageheyong ( 2018-08-03 04:21:02 -0600 )edit

1 Answer

Sort by » oldest newest most voted

answered 2017-07-05 07:14:59 -0600

lucasw gravatar image

The mixing of python 2.7 and 3.6 python files isn't good- you should have something like /usr/lib/python2.7/ getting used instead of /home/mallikarjun/anaconda3/lib/python3.6/

It looks this isn't ROS related at all and you have installed anaconda3 into your home directory and need to keep it from being used. If there are lines in your .bashrc putting anaconda3 on your PATH or PYTHONPATH or any other references to anaconda3 try disabling those and start a new terminal

A quick test is running python from the command line and typing import re in:

>>> import re

and see if that produces the same error.

edit flag offensive delete link more



Thank you very much. Problem solved. There were lines in .bashrc.

mallikarjun.talagade gravatar imagemallikarjun.talagade ( 2017-07-05 07:52:42 -0600 )edit

I have a very similar problem here. Do you think uninstalling Anaconda and reinstalling to another directory could be a solution as well?

cydonia gravatar imagecydonia ( 2017-07-05 13:25:18 -0600 )edit

And may I ask how exactly did you edit the .bashrc? the second line from the bottom looked like this at me: export PATH="/home/cydonia/anaconda3/bin:$PATH" and I made it export PATH="/home/cydonia:$PATH", but nothing changed.

cydonia gravatar imagecydonia ( 2017-07-05 13:48:10 -0600 )edit

Did you start a new terminal and launch the ros software in that one?

lucasw gravatar imagelucasw ( 2017-07-05 13:56:40 -0600 )edit

Just tried it and got another error, but then I run source /home/cydonia/turtlebot3_ws/devel/setup.bash and now the simulator is running! Thank you very much!

cydonia gravatar imagecydonia ( 2017-07-05 14:48:12 -0600 )edit

Thanks, this solves the problem. I had to comment out everything that included conda in my ~/.bashrc. Also, source ~/.bashrc does not work, and I have to restart the terminal!

Sparkle Eyes gravatar imageSparkle Eyes ( 2019-05-27 16:43:59 -0600 )edit

I was breaking my head for the last 2 days. Finally, I landed on this page. Excluding 'anaconda3/bin' from $PATH resolved the issue. Thank you very much, guys!!!

sujideevi gravatar imagesujideevi ( 2020-01-30 22:01:38 -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


Asked: 2017-07-05 02:41:07 -0600

Seen: 5,062 times

Last updated: Jul 05 '17