Error running yum There was a problem importing one of the Python modules required to run yum

Issues related to applications and software problems
Post Reply
riham5011
Posts: 1
Joined: 2024/02/28 12:27:39

Error running yum There was a problem importing one of the Python modules required to run yum

Post by riham5011 » 2024/02/28 12:31:35

I use CentOS 7 with the default 2.7 python. I got this error while running

Code: Select all

yum install

Code: Select all

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, Nov 16 2020, 22:23:17)
    [GCC 4.8.5 20150623 (Red Hat 4.8.5-44)]
    
    If you cannot solve this problem yourself, please go to
    the yum faq at:
      http://yum.baseurl.org/wiki/Faq
When i ran `ldconfig -v | grep libcurl`

Code: Select all

    libcurl.so.4 -> libcurl.so.4.4.0
    libcurl.so.4 -> libcurl.so.4.3.0

I figured that i have two symlinks to two different versions of libcurl.so

I removed the link from `/usr/lib64` and `/lib64/`

and then i update the cache of ldconfig by running `sudo ldconfig`

but when i check the folder again `/lib64/` the symlink gets back again, and `ldconfig -p` outputs the same results above.

User avatar
TrevorH
Site Admin
Posts: 33224
Joined: 2009/09/24 10:40:56
Location: Brighton, UK

Re: Error running yum There was a problem importing one of the Python modules required to run yum

Post by TrevorH » 2024/02/28 12:50:07

Someone has tried to bodge a newer version of curl into your system and it causes the problems. What you should have looks like this:

Code: Select all

[root@centos7 ~]# ll /usr/lib64/libcurl.so*
lrwxrwxrwx. 1 root root     16 Dec 22 23:03 /usr/lib64/libcurl.so -> libcurl.so.4.3.0
lrwxrwxrwx. 1 root root     16 Dec 22 23:03 /usr/lib64/libcurl.so.4 -> libcurl.so.4.3.0
-rwxr-xr-x. 1 root root 439304 Dec 13 16:08 /usr/lib64/libcurl.so.4.3.0
Note there is no libcurl.so.4.4.0 and should not be.

I'd suggest running `rpm -qf /usr/lib64/libcurl.so.4.4.0` and see if it belongs to any installed package (I bet it does not) and if so then yum remove that package and then read the things it intends to remove carefully before replying Y to say "do it". If it intends to remove anything important looking then do not do it.

Also run `rpm -V python-pycurl` and see if that is broken (any output means it has been "fiddled with").

Edit: also run `rpm -V curl libcurl` to see if those have been tampered with too. If so then a `yum reinstall curl libcurl` will probably fix that too.
The future appears to be RHEL or Debian. I think I'm going Debian.
Info for USB installs on http://wiki.centos.org/HowTos/InstallFromUSBkey
CentOS 5 and 6 are deadest, do not use them.
Use the FAQ Luke

tunk
Posts: 1206
Joined: 2017/02/22 15:08:17

Re: Error running yum There was a problem importing one of the Python modules required to run yum

Post by tunk » 2024/02/28 12:57:37

Deleted - didn't see Trevor's answer.

Post Reply