ROS Resources: Documentation | Support | Discussion Forum | Index | Service Status | ros @ Robotics Stack Exchange
Ask Your Question
2

ModuleNotFoundError: No module named 're'

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

mallikarjun.talagade gravatar image

updated 2021-10-26 09:28:35 -0500

lucasw gravatar image

I was following this ROS tutorial https://www.youtube.com/watch?v=8ckSl... 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/xacro.py", line 55, in <module> import xacro File "/opt/ros/lunar/lib/python2.7/dist-packages/xacro/__init__.py", line 35, in <module> import glob File "/home/mallikarjun/anaconda3/lib/python3.6/glob.py", 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/xacro.py '/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

Comments

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

heyong gravatar image heyong  ( 2018-08-03 04:21:02 -0500 )edit

1 Answer

Sort by » oldest newest most voted
10

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

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/glob.py getting used instead of /home/mallikarjun/anaconda3/lib/python3.6/glob.py

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

Comments

1

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

mallikarjun.talagade gravatar image mallikarjun.talagade  ( 2017-07-05 07:52:42 -0500 )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 image cydonia  ( 2017-07-05 13:25:18 -0500 )edit
1

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 image cydonia  ( 2017-07-05 13:48:10 -0500 )edit

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

lucasw gravatar image lucasw  ( 2017-07-05 13:56:40 -0500 )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 image cydonia  ( 2017-07-05 14:48:12 -0500 )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 image Sparkle Eyes  ( 2019-05-27 16:43:59 -0500 )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 image sujideevi  ( 2020-01-30 22:01:38 -0500 )edit

Dangit - I have the same problem, and I need python3.6 to use openai gym with ...so simply not using python3 is not an option

pring gravatar image pring  ( 2020-06-16 10:33:40 -0500 )edit

Question Tools

1 follower

Stats

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

Seen: 9,658 times

Last updated: Jul 05 '17