YUM CentOS-7 error "pycurl.so: undefined symbol: CRYPTO_num_locks"

After the installation of Sophos Antivirus, yum stopped working, with this error

[root@box ~]# yum update
There was a problem importing one of the Python modules
required to run yum. The error leading to this problem was:

   /usr/lib64/python2.7/site-packages/pycurl.so: undefined symbol: CRYPTO_num_locks

Please install a package which provides this module, or
verify that the module is installed correctly.

It's possible that the above module doesn't match the
current version of Python, which is:
2.7.5 (default, Aug  7 2019, 00:51:29) 
[GCC 4.8.5 20150623 (Red Hat 4.8.5-39)]

If you cannot solve this problem yourself, please go to 
the yum faq at:

I Googled the problem and found this page in redhat with a similar issue. The problem is well documented and they explain that some third party software has installed some newer libraries that are not compatible with yum, their fix is to uninstall the software...

In fact, Sophos added this file to the path of shared libraries: /etc/ld.so.conf.d/sophos-libsavi.conf, and these libraries that interfere with yum: libcurl.so.4, libssl.so.1.1, libcrypto.so.1.1... See below

The Fix:

There is an easy fix for this problem, create this alias

alias yum='LD_LIBRARY_PATH="/usr/lib64" yum '

A good way to do it permanently, is to put it in /etc/profile.d/, for example:

echo "alias yum='LD_LIBRARY_PATH=\"/usr/lib64\" yum '" > /etc/profile.d/my_yum.sh

Warning: you need to be root to use this alias... You could use sudo -s, and then the alias will work.

At least now yum works again, maybe there are other problems with those libraries from Sophos, but we will see.

pycurl.so with the wrong shared libraries

[root@box ~]$ ldd /usr/lib64/python2.7/site-packages/pycurl.so
	linux-vdso.so.1 =>  (0x00007ffea0d66000)
	libcurl.so.4 => /opt/sophos-av/lib64/libcurl.so.4 (0x00007f12c2de2000)
	libpython2.7.so.1.0 => /lib64/libpython2.7.so.1.0 (0x00007f12c2a16000)
	libpthread.so.0 => /lib64/libpthread.so.0 (0x00007f12c27fa000)
	libc.so.6 => /lib64/libc.so.6 (0x00007f12c242c000)
	libssl.so.1.1 => /opt/sophos-av/lib64/libssl.so.1.1 (0x00007f12c2192000)
	libcrypto.so.1.1 => /opt/sophos-av/lib64/libcrypto.so.1.1 (0x00007f12c1ca2000)
	libz.so.1 => /opt/sophos-av/lib64/libz.so.1 (0x00007f12c1a89000)
	librt.so.1 => /lib64/librt.so.1 (0x00007f12c1881000)
	libssp.so.0 => /opt/sophos-av/lib64/libssp.so.0 (0x00007f12c167f000)
	libdl.so.2 => /lib64/libdl.so.2 (0x00007f12c147b000)
	libutil.so.1 => /lib64/libutil.so.1 (0x00007f12c1278000)
	libm.so.6 => /lib64/libm.so.6 (0x00007f12c0f76000)
	/lib64/ld-linux-x86-64.so.2 (0x00007f12c3269000)

pycurl.so with the right shared libraries

[root@box ~]$ LD_LIBRARY_PATH="/usr/lib64" ldd /usr/lib64/python2.7/site-packages/pycurl.so
	linux-vdso.so.1 =>  (0x00007fff721c3000)
	libcurl.so.4 => /usr/lib64/libcurl.so.4 (0x00007fc4df9b2000)
	libpython2.7.so.1.0 => /usr/lib64/libpython2.7.so.1.0 (0x00007fc4df5e6000)
	libpthread.so.0 => /usr/lib64/libpthread.so.0 (0x00007fc4df3ca000)
	libc.so.6 => /usr/lib64/libc.so.6 (0x00007fc4deffc000)
	libidn.so.11 => /usr/lib64/libidn.so.11 (0x00007fc4dedc9000)
	libssh2.so.1 => /usr/lib64/libssh2.so.1 (0x00007fc4deb9c000)
	libssl3.so => /usr/lib64/libssl3.so (0x00007fc4de943000)
	libsmime3.so => /usr/lib64/libsmime3.so (0x00007fc4de71b000)
	libnss3.so => /usr/lib64/libnss3.so (0x00007fc4de3ec000)
	libnssutil3.so => /usr/lib64/libnssutil3.so (0x00007fc4de1bc000)
	libplds4.so => /usr/lib64/libplds4.so (0x00007fc4ddfb8000)
	libplc4.so => /usr/lib64/libplc4.so (0x00007fc4dddb3000)
	libnspr4.so => /usr/lib64/libnspr4.so (0x00007fc4ddb75000)
	libdl.so.2 => /usr/lib64/libdl.so.2 (0x00007fc4dd971000)
	libgssapi_krb5.so.2 => /usr/lib64/libgssapi_krb5.so.2 (0x00007fc4dd724000)
	libkrb5.so.3 => /usr/lib64/libkrb5.so.3 (0x00007fc4dd43b000)
	libk5crypto.so.3 => /usr/lib64/libk5crypto.so.3 (0x00007fc4dd208000)
	libcom_err.so.2 => /usr/lib64/libcom_err.so.2 (0x00007fc4dd004000)
	liblber-2.4.so.2 => /usr/lib64/liblber-2.4.so.2 (0x00007fc4dcdf5000)
	libldap-2.4.so.2 => /usr/lib64/libldap-2.4.so.2 (0x00007fc4dcba0000)
	libz.so.1 => /usr/lib64/libz.so.1 (0x00007fc4dc98a000)
	libutil.so.1 => /usr/lib64/libutil.so.1 (0x00007fc4dc787000)
	libm.so.6 => /usr/lib64/libm.so.6 (0x00007fc4dc485000)
	/lib64/ld-linux-x86-64.so.2 (0x00007fc4dfe2d000)
	libssl.so.10 => /usr/lib64/libssl.so.10 (0x00007fc4dc213000)
	libcrypto.so.10 => /usr/lib64/libcrypto.so.10 (0x00007fc4dbdb0000)
	librt.so.1 => /usr/lib64/librt.so.1 (0x00007fc4dbba8000)
	libkrb5support.so.0 => /usr/lib64/libkrb5support.so.0 (0x00007fc4db998000)
	libkeyutils.so.1 => /usr/lib64/libkeyutils.so.1 (0x00007fc4db794000)
	libresolv.so.2 => /usr/lib64/libresolv.so.2 (0x00007fc4db57b000)
	libsasl2.so.3 => /usr/lib64/libsasl2.so.3 (0x00007fc4db35e000)
	libselinux.so.1 => /usr/lib64/libselinux.so.1 (0x00007fc4db137000)
	libcrypt.so.1 => /usr/lib64/libcrypt.so.1 (0x00007fc4daf00000)
	libpcre.so.1 => /usr/lib64/libpcre.so.1 (0x00007fc4dac9e000)
	libfreebl3.so => /usr/lib64/libfreebl3.so (0x00007fc4daa9b000)

Salvatore Toribio