Ask Your Question
0

PyCapsule_Import could not import module "pyexpat" When running rosdep update

asked 2016-02-29 05:57:16 -0500

dgyx gravatar image

updated 2016-02-29 07:14:55 -0500

ros version:indigo system version:Ubuntu 14.04.4 LTS

I have some problems when running

rosdep update

the error msg as follow

 dgyx@dgyx-pc:~$ rosdep update
Traceback (most recent call last):
  File "/usr/bin/rosdep", line 3, in <module>
    from rosdep2.main import rosdep_main
  File "/usr/lib/python2.7/dist-packages/rosdep2/__init__.py", line 40, in <module>
    from .installers import InstallerContext, Installer, \
  File "/usr/lib/python2.7/dist-packages/rosdep2/installers.py", line 35, in <module>
    from rospkg.os_detect import OsDetect
  File "/usr/lib/python2.7/dist-packages/rospkg/__init__.py", line 43, in <module>
    from .rospack import RosPack, RosStack, \
  File "/usr/lib/python2.7/dist-packages/rospkg/rospack.py", line 35, in <module>
    from xml.etree.cElementTree import ElementTree
  File "/usr/lib/python2.7/xml/etree/cElementTree.py", line 3, in <module>
    from _elementtree import *
ImportError: PyCapsule_Import could not import module "pyexpat"

then i do

dgyx@dgyx-pc:/$ sudo find . -name pyexpat*
[sudo] password for dgyx: 
./usr/lib/python2.7/lib-dynload/pyexpat.x86_64-linux-gnu.so
./usr/include/python2.7/pyexpat.h

Any help is much appreciated.

edit retag flag offensive close merge delete

2 Answers

Sort by ยป oldest newest most voted
0

answered 2016-03-21 21:51:57 -0500

updated 2016-03-22 04:11:21 -0500

gvdhoorn gravatar image

Thank for @dgyx's solution. I also have this problem when I run the roscore command after I have installed Matlab MCR on my Ubuntu 1404 32bit system.

Traceback (most recent call last):
  File "/opt/ros/indigo/bin/roscore", line 69, in <module>
    import roslaunch
  File "/opt/ros/indigo/lib/python2.7/dist-packages/roslaunch/__init__.py", line 48, in <module>
    import rospkg
  File "/usr/lib/python2.7/dist-packages/rospkg/__init__.py", line 43, in <module>
    from .rospack import RosPack, RosStack, \
  File "/usr/lib/python2.7/dist-packages/rospkg/rospack.py", line 35, in <module>
    from xml.etree.cElementTree import ElementTree
  File "/usr/lib/python2.7/xml/etree/cElementTree.py", line 3, in <module>
    from _elementtree import *
ImportError: PyCapsule_Import could not import module "pyexpat"

I add the library path of my system - /lib/i386-linux-gnu - in $LD_LIBRARY_PATH in front of Matlab's lib paths. Then the problem is solved. By the way, only adding system library path in front of Matlab's paths works.

edit flag offensive delete link more
0

answered 2016-02-29 07:14:06 -0500

dgyx gravatar image

I had solved this problem by

dgyx@dgyx-pc:~/catkin_ws$ ldd /usr/lib/python2.7/lib-dynload/pyexpat.x86_64-linux-gnu.so 
    linux-vdso.so.1 =>  (0x00007fffa4570000)
    libpthread.so.0 => /lib/x86_64-linux-gnu/libpthread.so.0 (0x00007f3ff57dc000)
    libc.so.6 => /lib/x86_64-linux-gnu/libc.so.6 (0x00007f3ff5416000)
    libexpat.so.1 => /opt/oracle/product/11.2.0/dbhome_1/lib/libexpat.so.1 (0x00007f3ff52e5000)
    /lib64/ld-linux-x86-64.so.2 (0x00005645018a1000)

cd /opt/oracle/product/11.2.0/dbhome_1/lib
sudo mv libexpat.so.1 libexpat.so.1.bak

I think I should edit the LD_LIBRARY_PATH environment.

edit flag offensive delete link more

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools

Stats

Asked: 2016-02-29 05:57:16 -0500

Seen: 2,327 times

Last updated: Mar 22 '16