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

No module named defusedxml.xmlrpc

asked 2017-04-26 21:30:14 -0500

DaDaLee gravatar image

I'm using robot_localization offered by ROS downloaded from gihub .It can be compiled and I haven't changed anything of it. When I executed the command: 'roslaunch ekf_template.launch' in a terminal,I got several warnings as follows:

Traceback (most recent call last): File "/home/pantiq/robot/devel/bin/roslaunch", line 6, in exec( File "", line 34, in File "/home/pantiq/robot/devel/lib/python2.7/dist-packages/roslaunch/", line 35, in exec( File "", line 56, in File "/home/pantiq/robot/src/ros_comm/tools/roslaunch/src/roslaunch/", line 55, in from roslaunch.nodeprocess import create_master_process, create_node_process File "/home/pantiq/robot/src/ros_comm/tools/roslaunch/src/roslaunch/", line 52, in from rosmaster.master_api import NUM_WORKERS File "/home/pantiq/robot/src/ros_comm/tools/rosmaster/src/rosmaster/", line 35, in from .main import rosmaster_main File "/home/pantiq/robot/src/ros_comm/tools/rosmaster/src/rosmaster/", line 43, in import rosmaster.master File "/home/pantiq/robot/src/ros_comm/tools/rosmaster/src/rosmaster/", line 47, in import rosmaster.master_api File "/home/pantiq/robot/src/ros_comm/tools/rosmaster/src/rosmaster/", line 72, in from rosmaster.util import xmlrpcapi File "/home/pantiq/robot/src/ros_comm/tools/rosmaster/src/rosmaster/", line 48, in from defusedxml.xmlrpc import monkey_patch ImportError: No module named defusedxml.xmlrpc Then I downloaded a folder named defusedxml from a website,and put it in the robot_localization/src path,still it doesn't work.

What should I do with it?Shall I custimaze it or do something else? I do appreciate it if anyone can help me out.

edit retag flag offensive close merge delete

2 Answers

Sort by ยป oldest newest most voted

answered 2017-04-27 01:27:21 -0500

ahendrix gravatar image

It seems like you're missing the defulsedxml python package; and it looks like your probably can't run any roslaunch or roscore commands as a result.

defulsedxml should have been installed when you installed ROS. If you're running Ubuntu, you can reinstall it by running sudo apt-get install python-defusedxml

edit flag offensive delete link more


Thank you so much that your proposal really works.But here pops up another problem: After running the command: roslaunch ekf_template.launch , I run rostopic echo /odometry/filtered in another terminal.Then I got nothing.Does it mean that the node isn't operating at all or something else goes wrong?

DaDaLee gravatar image DaDaLee  ( 2017-04-27 01:57:07 -0500 )edit

I'm not very familiar with robot_localization, so I'm not sure what's wrong. That sounds like a topic for a new question.

ahendrix gravatar image ahendrix  ( 2017-04-27 02:04:47 -0500 )edit

Thank you Ahendrix.Maybe I should raise a new question about it.

DaDaLee gravatar image DaDaLee  ( 2017-04-27 02:08:57 -0500 )edit

answered 2019-01-26 08:02:40 -0500

Preeti Mukherjee gravatar image

Even I was facing a similar error. Running pip install defusedxml helped me!

edit flag offensive delete link more


Please be aware of the downsides to using pip to install Python packages on a platform which normally uses apt (ie: no automatic upgrades, no visibility to the package manager, etc).

In general, use of pip for managing Python dependencies of (core) ROS packages is discouraged on Debian based platforms.

There are certainly legitimate use-cases for it, but it should not be regarded an appropriate solution to the problem reported by the OP.

gvdhoorn gravatar image gvdhoorn  ( 2019-10-08 03:45:04 -0500 )edit

"under the hood" your python interpreter isn't able to find the defusedxml module on the PYTHONPATH. Since your version of ROS uses python 3, you probably need the defusedxml apt package for python3: python3-defusedxml

ahendrix gravatar image ahendrix  ( 2021-12-02 20:24:34 -0500 )edit

Question Tools

1 follower


Asked: 2017-04-26 21:30:14 -0500

Seen: 19,093 times

Last updated: Apr 27 '17