1

I'm attempting to install ROS on Debian Jessie and I'm running into an error when I run sudo rosdep init. The instructions I'm following are at this URL (http://wiki.ros.org/kinetic/Installation/Source). I'm installing from source and not though their repos because of some library conflicts.

Running sudo rosdep init results in the following output.

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 42, in <module>
    from .rospack import expand_to_packages, get_package_name, \
  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 figured that this was python simply not finding the module, so I took a look at where it was located and at python's path, to no avail.

[jwerner5@rockhopper:~ ] $$ find / -name pyexpat*
/usr/include/python2.7/pyexpat.h
/usr/include/python3.4m/pyexpat.h
/usr/share/jython/Lib/pyexpat.py
/usr/share/jython/Lib/pyexpat$py.class
/usr/lib/python2.7/lib-dynload/pyexpat.x86_64-linux-gnu.so

>>> import sys
>>> print sys.path
['', '/usr/lib/python2.7', '/usr/lib/python2.7/plat-x86_64-linux-gnu',
 '/usr/lib/python2.7/lib-tk', '/usr/lib/python2.7/lib-old', 
 '/usr/lib/python2.7/lib-dynload', '/usr/local/lib/python2.7/dist-packages', 
 '/usr/lib/python2.7/dist-packages', '/usr/lib/python2.7/dist-packages/PILcompat',
 '/usr/lib/python2.7/dist-packages/gtk-2.0', '/usr/lib/pymodules/python2.7',
 '/usr/lib/python2.7/dist-packages/wx-3.0-gtk2']

So it's in the path. I next ran an strace -e open rosdep just make sure it was finding the file. Here's the output of that. It looks like it finds the file and then closes it immediately. Here's the relevant bit.

open("/usr/lib/python2.7/lib-tk/pyexpat.py", O_RDONLY) = -1 ENOENT (No such file or directory)
open("/usr/lib/python2.7/lib-tk/pyexpat.pyc", O_RDONLY) = -1 ENOENT (No such file or directory)
open("/usr/lib/python2.7/lib-dynload/pyexpat.x86_64-linux-gnu.so", O_RDONLY) = 9
open("/usr/lib/python2.7/lib-dynload/pyexpat.x86_64-linux-gnu.so", O_RDONLY|O_CLOEXEC) = 10
Traceback (most recent call last):

This question (ImportError: PyCapsule_Import could not import module "pyexpat") suggested that one try renaming the library, or reinstalling it. I have tried both of these things and neither has worked. Does anyone have any ideas?

EDIT: Since posting, as per forax's intructions, I have tried setting LD_LIBRARY_PATH, done a manual import of pyexpat in a python shell, and taken a look at the output of ldd for pyexpat.

Manual import of pyexpat

    Python 2.7.9 (default, Jun 29 2016, 13:08:31) 
    [GCC 4.9.2] on linux2
    Type "help", "copyright", "credits" or "license" for more information.
    >>> import pyexpat
.

Running ldd on the pyexpat library

[jwerner5@rockhopper:~ ] $$ ldd /usr/lib/python2.7/lib-dynload/pyexpat.x86_64-linux-gnu.so
    linux-vdso.so.1 (0x00007ffc069da000)
    libexpat.so.1 => /lib/x86_64-linux-gnu/libexpat.so.1 (0x00007f7214382000)
    libpthread.so.0 => /lib/x86_64-linux-gnu/libpthread.so.0 (0x00007f7214165000)
    libc.so.6 => /lib/x86_64-linux-gnu/libc.so.6 (0x00007f7213db9000)
    /lib64/ld-linux-x86-64.so.2 (0x000055fe01ce4000)

1 Answers1

0

Please try manual import in python shell and post the result.

$ python
Python 2.7.9 (default, Jun 29 2016, 13:08:31) 
[GCC 4.9.2] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import pyexpat
>>> 

And check lib load, should look like this:

$ ldd /usr/lib/python2.7/lib-dynload/pyexpat.x86_64-linux-gnu.so
    linux-vdso.so.1 (0x00007ffe82d10000)
    libexpat.so.1 => /lib/x86_64-linux-gnu/libexpat.so.1 (0x00007f6387386000)
    libpthread.so.0 => /lib/x86_64-linux-gnu/libpthread.so.0 (0x00007f6387169000)
    libc.so.6 => /lib/x86_64-linux-gnu/libc.so.6 (0x00007f6386dbd000)
    /lib64/ld-linux-x86-64.so.2 (0x00005628bbd68000)
farax
  • 131
  • 7
  • Manual import in a python shell returns no output; I assume that means that it is successful. Running `ldd /usr/lib/python2.7/lib-dynload/pyexpat.x86_64-linux-gnu.so` returns the exact same as what you have posted. Only the hex at the end of each line differs. – Jacob Werner Jun 15 '17 at 19:53
  • The standard python environment is fine and the libexpat lib is in place. I can't imagine that the set up change the libpath - have no idea. – farax Jun 15 '17 at 20:22