Update System Software Error - No module named yum

zontrakulla

Active Member
Jan 16, 2008
39
0
56
Hello, when i try to run this on WHM, I'm getting this error

Code:
There was a problem importing one of the Python modules
required to run yum. The error leading to this problem was:

   No module named yum

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.6.1 (r261:67515, Jan 21 2010, 03:51:40) 
[GCC 4.1.2 20071124 (Red Hat 4.1.2-42)]

If you cannot solve this problem yourself, please go to 
the yum faq at:
  [url=http://wiki.linux.duke.edu/YumFaq]Faq - yum - Trac[/url]
 
Last edited by a moderator:

cPanelDon

cPanel Quality Assurance Analyst
Staff member
Nov 5, 2008
2,544
11
268
Houston, Texas, U.S.A.
cPanel Access Level
DataCenter Provider
Twitter
Hello, when i try to run this on WHM, I'm getting this error
Code:
There was a problem importing one of the Python modules
required to run yum. The error leading to this problem was:

   No module named yum

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.6.1 (r261:67515, Jan 21 2010, 03:51:40) 
[GCC 4.1.2 20071124 (Red Hat 4.1.2-42)]

If you cannot solve this problem yourself, please go to 
the yum faq at:
  [url=http://wiki.linux.duke.edu/YumFaq]Faq - yum - Trac[/url]
YUM is the OS software package manager for an RPM-based OS like CentOS or RHEL; this tool is included with the Operating System installation and required to install and maintain updates to OS-provided components.

What is the OS version and environment type as seen by the following command?
Code:
# grep -H '' /etc/*release /var/cpanel/envtype
Was Python manually compiled from source?

What is the output of the following commands?
Code:
# /usr/bin/python -V
# rpm -qf /usr/bin/python
# /usr/local/bin/python -V
# rpm -qf /usr/local/bin/python
# rpm -qa --qf "%{name}-%{version}-%{release}.%{arch}.rpm\n" | grep -i "^python\|yum" | sort
# yum check-update
 

zontrakulla

Active Member
Jan 16, 2008
39
0
56
Code:
grep -H '' /etc/*release /var/cpanel/envtype

/etc/redhat-release:CentOS release 5.2 (Final)
/var/cpanel/envtype:standard
Was Python manually compiled from source?
Yes

Code:
/usr/bin/python -V

Python 2.6.4
Code:
rpm -qf /usr/bin/python

python-2.4.3-21.el5

Code:
/usr/local/bin/python -V

Python 2.6.4
Code:
rpm -qf /usr/local/bin/python

file /usr/local/bin/python is not owned by any package
Code:
rpm -qa --qf "%{name}-%{version}-%{release}.%{arch}.rpm\n" | grep -i "^python\|yum" | sort

python-2.4.3-21.el5.i386.rpm
python-devel-2.4.3-21.el5.i386.rpm
python-docs-2.4.3-1.1.noarch.rpm
python-elementtree-1.2.6-5.i386.rpm
python-iniparse-0.2.3-4.el5.noarch.rpm
python-optik-1.4-2.noarch.rpm
python-sqlite-1.1.7-1.2.1.i386.rpm
python-tools-2.4.3-21.el5.i386.rpm
python-urlgrabber-3.1.0-2.noarch.rpm
python-urlgrabber-3.1.0-5.el5.noarch.rpm
yum-3.2.22-20.el5.centos.noarch.rpm
yum-arch-2.2.2-2.el5.kb.noarch.rpm
yum-fastestmirror-1.1.10-9.el5.centos.noarch.rpm
yum-fastestmirror-1.1.16-13.el5.centos.noarch.rpm
yum-metadata-parser-1.1.2-2.el5.i386.rpm
yum-updatesd-0.9-2.el5.noarch.rpm
Code:
yum check-update

There was a problem importing one of the Python modules
required to run yum. The error leading to this problem was:

   No module named yum

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.6.4 (r264:75706, Jan 26 2010, 04:26:58)
[GCC 4.1.2 20071124 (Red Hat 4.1.2-42)]

If you cannot solve this problem yourself, please go to
the yum faq at:
  http://wiki.linux.duke.edu/YumFaq
 

cPanelDon

cPanel Quality Assurance Analyst
Staff member
Nov 5, 2008
2,544
11
268
Houston, Texas, U.S.A.
cPanel Access Level
DataCenter Provider
Twitter
Yes

Code:
/usr/bin/python -V
Python 2.6.4
Code:
rpm -qf /usr/bin/python
python-2.4.3-21.el5
At minimum I would consider re-installing the python RPM.

What is the system hardware architecture? From the provided output it looks like it is i386, but for the sake of being cautious it should be double-checked; this must be determined in order to obtain the correct package for re-installation. The following command will help to verify the architecture:
Code:
# uname -a
Packages may be manually downloaded from a CentOS mirror (using "wget") and then installed using the CLI utility "rpm" via root SSH access:
Index of /centos/5/os
Index of /centos/5/updates

Example:
Code:
# wget -N http://server/path/to/software.rpm
# rpm --force -hUv software.rpm
When locating a package on the mirror, first check the "updates" directory to see if there is a more recent version; if there is not one, then check the "os" directory.

After YUM is repaired and correctly working I would run the following commands:
Code:
# yum clean all
# yum makecache
# yum upgrade
 
Last edited:

zontrakulla

Active Member
Jan 16, 2008
39
0
56
Code:
Linux host.******* 2.6.18-92.1.13.el5 #1 SMP Wed Sep 24 19:33:52 EDT 2008 i686 i686 i386 GNU/Linux
I'll try to reinstall the RPM and will let you know after that.
 

zontrakulla

Active Member
Jan 16, 2008
39
0
56
It seems yum is back, however there're other errors

Code:
Repository base is listed more than once in the configuration
Repository updates is listed more than once in the configuration
Traceback (most recent call last):
  File "/usr/bin/yum", line 29, in ?
    yummain.user_main(sys.argv[1:], exit_code=True)
  File "/usr/share/yum-cli/yummain.py", line 315, in user_main
    errcode = main(args)
  File "/usr/share/yum-cli/yummain.py", line 159, in main
    base.getOptionsConfig(args)
  File "/usr/share/yum-cli/cli.py", line 204, in getOptionsConfig
    (opts, self.cmds) = self.optparser.setupYumConfig(args=args)
  File "/usr/share/yum-cli/cli.py", line 1174, in setupYumConfig
    elif not self.base.setCacheDir():
AttributeError: 'YumBaseCli' object has no attribute 'setCacheDir'

This is the conf file
Code:
[main]
exclude=apache* bind-chroot courier* dovecot* exim* httpd* mod_ssl* mysql* nsd* perl* php* proftpd* pure-ftpd* ruby* spamass$
cachedir=/var/cache/yum
debuglevel=2
logfile=/var/log/yum.log
pkgpolicy=newest
distroverpkg=redhat-release
tolerant=1
exactarch=1

[base]
name=Red Hat Linux $releasever - $basearch - Base
baseurl=http://mirror.dulug.duke.edu/pub/yum-repository/redhat/$releasever/$basearch/


[updates]
name=Red Hat Linux $releasever - Updates
baseurl=http://mirror.dulug.duke.edu/pub/yum-repository/redhat/updates/$releasever/
 

cPanelDon

cPanel Quality Assurance Analyst
Staff member
Nov 5, 2008
2,544
11
268
Houston, Texas, U.S.A.
cPanel Access Level
DataCenter Provider
Twitter
This is the conf file
Code:
[main]
exclude=apache* bind-chroot courier* dovecot* exim* httpd* mod_ssl* mysql* nsd* perl* php* proftpd* pure-ftpd* ruby* spamass$
cachedir=/var/cache/yum
debuglevel=2
logfile=/var/log/yum.log
pkgpolicy=newest
distroverpkg=redhat-release
tolerant=1
exactarch=1

[base]
name=Red Hat Linux $releasever - $basearch - Base
baseurl=http://mirror.dulug.duke.edu/pub/yum-repository/redhat/$releasever/$basearch/

[updates]
name=Red Hat Linux $releasever - Updates
baseurl=http://mirror.dulug.duke.edu/pub/yum-repository/redhat/updates/$releasever/
Was this system upgraded from a legacy Red Hat installation (e.g., Red Hat 9)?

I would try commenting the two repositories that are defined in the main YUM configuration file (yum.conf) as there should be repositories already setup in ".repo" files within the following directory:
Code:
/etc/yum.repos.d/
For reference, the CentOS YUM repository files are included in the RPM named "centos-release" available from the OS mirror. As an example, on a test system with CentOS 5.4 there is the following file that defines the repositories (followed by a command showing which RPM it's from):
Code:
/etc/yum.repos.d/CentOS-Base.repo

# rpm -qf /etc/yum.repos.d/CentOS-Base.repo
centos-release-5-4.el5.centos.1
 

zontrakulla

Active Member
Jan 16, 2008
39
0
56
Thanks for your fast replies, however i'm still getting the same error.
Code:
AttributeError: 'YumBaseCli' object has no attribute 'setCacheDir'
I don't know if it's upgraded from redhat

edit: I checked repos configs, this time i'm getting this:

Code:
Traceback (most recent call last):
  File "/usr/bin/yum", line 29, in ?
    yummain.user_main(sys.argv[1:], exit_code=True)
  File "/usr/share/yum-cli/yummain.py", line 315, in user_main
    errcode = main(args)
  File "/usr/share/yum-cli/yummain.py", line 159, in main
    base.getOptionsConfig(args)
  File "/usr/share/yum-cli/cli.py", line 201, in getOptionsConfig
    self.plugins.run('args', args=args)
  File "/usr/lib/python2.4/site-packages/yum/plugins.py", line 170, in run
    raise ValueError('unknown slot name "%s"' % slotname)
ValueError: unknown slot name "args"
 
Last edited:

cPanelDon

cPanel Quality Assurance Analyst
Staff member
Nov 5, 2008
2,544
11
268
Houston, Texas, U.S.A.
cPanel Access Level
DataCenter Provider
Twitter
I would consider escalating the issue to the on-site data center staff for assistance in correcting the OS installation of yum and its dependencies (including python). In an earlier post I saw there was a duplicate RPM installed for a few packages; I would check to ensure that only one version is installed of each (yum and python) software package.

To help cross-reference information I believe the following thread is related as seen on the CentOS forums:
www.centos.org - Forums - CentOS 5 - General Support - Yum Error