pythonpiporaclelinux

pip3 throws undefined symbol: XML_SetHashSalt


I am having python 3.6.8 on oracle Linux EL7 I installed pip3 using

yum install python36-pip

however, when ever I invoke pip3 it is having library error

pip3

Traceback (most recent call last):
  File "/bin/pip3", line 8, in <module>
    from pip import main
  File "/usr/lib/python3.6/site-packages/pip/__init__.py", line 42, in <module>
    from pip.utils import get_installed_distributions, get_prog
  File "/usr/lib/python3.6/site-packages/pip/utils/__init__.py", line 27, in <module>
    from pip._vendor import pkg_resources
  File "/usr/lib/python3.6/site-packages/pip/_vendor/pkg_resources/__init__.py", line 35, in <module>
    import plistlib
  File "/usr/lib64/python3.6/plistlib.py", line 65, in <module>
    from xml.parsers.expat import ParserCreate
  File "/usr/lib64/python3.6/xml/parsers/expat.py", line 4, in <module>
    from pyexpat import *
ImportError: /usr/lib64/python3.6/lib-dynload/pyexpat.cpython-36m-x86_64-linux-gnu.so: undefined symbol: XML_SetHashSalt

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/bin/pip3", line 12, in <module>
    from pip._internal import main
  File "/usr/lib/python3.6/site-packages/pip/__init__.py", line 42, in <module>
    from pip.utils import get_installed_distributions, get_prog
  File "/usr/lib/python3.6/site-packages/pip/utils/__init__.py", line 27, in <module>
    from pip._vendor import pkg_resources
  File "/usr/lib/python3.6/site-packages/pip/_vendor/pkg_resources/__init__.py", line 35, in <module>
    import plistlib
  File "/usr/lib64/python3.6/plistlib.py", line 65, in <module>
    from xml.parsers.expat import ParserCreate
  File "/usr/lib64/python3.6/xml/parsers/expat.py", line 4, in <module>
    from pyexpat import *
ImportError: /usr/lib64/python3.6/lib-dynload/pyexpat.cpython-36m-x86_64-linux-gnu.so: undefined 
symbol: XML_SetHashSalt

I tried to see if there is any alternative to pyexpat.*.so but it seems there is none did ldd on the last line below is the out put

[root@whf00jkd python3.6]# ldd  /usr/lib64/python3.6/lib-dynload/pyexpat.cpython-36m-x86_64-linux-gnu.so
        linux-vdso.so.1 =>  (0x00007ffd76bf9000)
        libexpat.so.1 => /scratch/oraofss/app/oraofss/product/18.0.0/client_1/lib/libexpat.so.1 (0x00007fec3a94a000)
        libpython3.6m.so.1.0 => /lib64/libpython3.6m.so.1.0 (0x00007fec3a422000)
        libpthread.so.0 => /lib64/libpthread.so.0 (0x00007fec3a206000)
        libc.so.6 => /lib64/libc.so.6 (0x00007fec39e38000)
        libdl.so.2 => /lib64/libdl.so.2 (0x00007fec39c34000)
        libutil.so.1 => /lib64/libutil.so.1 (0x00007fec39a31000)
        libm.so.6 => /lib64/libm.so.6 (0x00007fec3972f000)
        /lib64/ld-linux-x86-64.so.2 (0x00007fec3ad81000)

I did a search for libexpat.so.1

[root@whf00jkd python3.6]# whereis libexpat.so.1
libexpat.so: /usr/lib/libexpat.so.1 /usr/lib/libexpat.so /usr/lib64/libexpat.so.1 /usr/lib64/libexpat.so
[root@whf00jkd python3.6]# ls -ltr /usr/lib/libexpat.so.1
lrwxrwxrwx. 1 root root 17 Apr  1  2019 /usr/lib/libexpat.so.1 -> libexpat.so.1.6.0
[root@whf00jkd python3.6]# ls -ltr /usr/lib64/libexpat.so.1
lrwxrwxrwx. 1 root root 17 Apr  1  2019 /usr/lib64/libexpat.so.1 -> libexpat.so.1.6.0

and added a link libexpat.so.1 -> /usr/lib/libexpat.so.1 in /usr/lib64/python3.6/lib-dynload/ but that is not removing the error

Please help


Solution

  • libexpat.so.1 pointing to wrong location. Fixed it with

    export LD_LIBRARY_PATH=/lib64/:${LD_LIBRARY_PATH}
    
    ldd /usr/lib64/python3.6/lib-dynload/pyexpat.cpython-36m-x86_64-linux-gnu.so
            linux-vdso.so.1 =>  (0x00007fff073f1000)
            libexpat.so.1 => /lib64/libexpat.so.1 (0x00007f9ba53ce000)
            libpython3.6m.so.1.0 => /lib64/libpython3.6m.so.1.0 (0x00007f9ba4ea9000)
            libpthread.so.0 => /lib64/libpthread.so.0 (0x00007f9ba4c8d000)
            libc.so.6 => /lib64/libc.so.6 (0x00007f9ba48bf000)
            libdl.so.2 => /lib64/libdl.so.2 (0x00007f9ba46bb000)
            libutil.so.1 => /lib64/libutil.so.1 (0x00007f9ba44b8000)
            libm.so.6 => /lib64/libm.so.6 (0x00007f9ba41b6000)
            /lib64/ld-linux-x86-64.so.2 (0x00007f9ba5807000)