pyexpat.cpython-35m-x86_64-linux-gnu.so: undefined symbol: XML_SetHashSalt

2.2k views Asked by At

I am seeing same following error when I try to run the following: pip virtualenv

Looks like Python3.5 is installed using softwarecollections. I dont have root access and using service account.

bash-4.2$ scl --list 
rh-python35

bash-4.2$ scl --list rh-python35
rh-python35-python-setuptools-18.0.1-2.el7.noarch
rh-python35-runtime-2.0-2.el7.x86_64
rh-python35-python-libs-3.5.1-11.el7.x86_64
rh-python35-python-devel-3.5.1-11.el7.x86_64
rh-python35-python-pip-7.1.0-2.el7.noarch
rh-python35-python-virtualenv-13.1.2-2.el7.noarch
rh-python35-2.0-2.el7.x86_64
rh-python35-python-3.5.1-11.el7.x86_64
rh-python35-python-sqlalchemy-1.0.11-1.el7.x86_64
bash-4.2$ ls
easy_install      pip3    pydoc3    python3           python3.5m                python3-config  pyvenv-3.5
easy_install-3.5  pip3.5  pydoc3.5  python3.5         python3.5m-config         python-config   virtualenv
pip               pydoc   python    python3.5-config  python3.5m-x86_64-config  pyvenv          virtualenv-3.5
bash-4.2$ which python
/opt/rh/rh-python35/root/usr/bin/python
bash-4.2$ source scl_source enable rh-python35  --> runs fine
**bash-4.2$ pip install --user pipenv**
Traceback (most recent call last):
  File "/opt/rh/rh-python35/root/usr/bin/pip", line 7, in <module>
    from pip import main
  File "/opt/rh/rh-python35/root/usr/lib/python3.5/site-packages/pip/__init__.py", line 12, in <module>
    from pip.utils import get_installed_distributions, get_prog
  File "/opt/rh/rh-python35/root/usr/lib/python3.5/site-packages/pip/utils/__init__.py", line 23, in <module>
    from pip._vendor import pkg_resources
  File "/opt/rh/rh-python35/root/usr/lib/python3.5/site-packages/pip/_vendor/pkg_resources/__init__.py", line 36, in <module>
    import plistlib
  File "/opt/rh/rh-python35/root/usr/lib64/python3.5/plistlib.py", line 65, in <module>
    from xml.parsers.expat import ParserCreate
  File "/opt/rh/rh-python35/root/usr/lib64/python3.5/xml/parsers/expat.py", line 4, in <module>
    from pyexpat import *
ImportError: /opt/rh/rh-python35/root/usr/lib64/python3.5/lib-dynload/pyexpat.cpython-35m-x86_64-linux-gnu.so: undefined symbol: XML_SetHashSalt
bash-4.2$ virtualenv
Traceback (most recent call last):
  File "/opt/rh/rh-python35/root/usr/bin/virtualenv", line 5, in <module>
    from pkg_resources import load_entry_point
  File "/opt/rh/rh-python35/root/usr/lib/python3.5/site-packages/pkg_resources/__init__.py", line 36, in <module>
    import plistlib
  File "/opt/rh/rh-python35/root/usr/lib64/python3.5/plistlib.py", line 65, in <module>
    from xml.parsers.expat import ParserCreate
  File "/opt/rh/rh-python35/root/usr/lib64/python3.5/xml/parsers/expat.py", line 4, in <module>
    from pyexpat import *
ImportError: /opt/rh/rh-python35/root/usr/lib64/python3.5/lib-dynload/pyexpat.cpython-35m-x86_64-linux-gnu.so: undefined symbol: XML_SetHashSalt
bash-4.2$ ldd /opt/rh/rh-python35/root/usr/lib64/python3.5/lib-dynload/pyexpat.cpython-35m-x86_64-linux-gnu.so
        linux-vdso.so.1 =>  (0x00007ffebbd1f000)
        libexpat.so.1 => /opt/ORACLE/product/lib/libexpat.so.1 (0x00007f0b19142000)
        libpython3.5m.so.rh-python35-1.0 => /opt/rh/rh-python35/root/usr/lib64/libpython3.5m.so.rh-python35-1.0 (0x00007f0b18c73000)
        libpthread.so.0 => /lib64/libpthread.so.0 (0x00007f0b18a57000)
        libc.so.6 => /lib64/libc.so.6 (0x00007f0b1868a000)
        libdl.so.2 => /lib64/libdl.so.2 (0x00007f0b18486000)
        libutil.so.1 => /lib64/libutil.so.1 (0x00007f0b18283000)
        libm.so.6 => /lib64/libm.so.6 (0x00007f0b17f81000)
        /lib64/ld-linux-x86-64.so.2 (0x00007f0b19573000)

I appreciate everyone's feedback

Thanks

1

There are 1 answers

0
Florian Weimer On

The problem is here:

        libexpat.so.1 => /opt/ORACLE/product/lib/libexpat.so.1 (0x00007f0b19142000)

Apparently, some software you have installed comes with its own Expat copy, and that copy is older than the system version (it lacks the XML_SetHashSalt symbol).

In cases like this, it's often enough to move the file to a different directory, and both the application and the rest of the system continue working. (Most core libraries offer some form of ABI backwards compatibility.)