[SOLVED] No module named yum

General support questions including new installations
zainuddin
Posts: 2
Joined: 2012/10/04 03:57:57

[SOLVED] No module named yum

Post by zainuddin » 2012/10/04 04:58:16

[root@localhost ~]# yum 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.7 (r27:82500, Aug 24 2012, 08:08:08)
[GCC 4.1.2 20080704 (Red Hat 4.1.2-52)]

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

[root@localhost ~]# python -V
Python 2.7
[root@localhost ~]# uname -na
Linux localhost.localdomain 2.6.18-194.32.1.el5 #1 SMP Wed Jan 5 17:53:09 EST 2011 i686 i686 i386 GNU/Linux

zainuddin
Posts: 2
Joined: 2012/10/04 03:57:57

Re: No module named yum

Post by zainuddin » 2012/10/04 05:32:40

Already solved...

download this rpm

python-2.4.3-46.el5_8.2.i386.rpm
python-devel-2.4.3-46.el5_8.2.i386.rpm
python-libs-2.4.3-46.el5_8.2.i386.rpm
python-tools-2.4.3-46.el5_8.2.i386.rpm
tix-8.4.0-11.fc6.i386.rpm
tix-devel-8.4.0-11.fc6.i386.rpm
tkinter-2.4.3-46.el5_8.2.i386.rpm
yum-3.2.22-39.el5.centos.noarch.rpm

http://mirror.centos.org/centos/5/os/i386/CentOS/

[root@localhost x]# ls
python-2.4.3-46.el5_8.2.i386.rpm tix-8.4.0-11.fc6.i386.rpm
python-devel-2.4.3-46.el5_8.2.i386.rpm tix-devel-8.4.0-11.fc6.i386.rpm
python-libs-2.4.3-46.el5_8.2.i386.rpm tkinter-2.4.3-46.el5_8.2.i386.rpm
python-tools-2.4.3-46.el5_8.2.i386.rpm yum-3.2.22-39.el5.centos.noarch.rpm

[root@localhost x]# rpm -Uvh --replacepkgs *.rpm
Preparing... ########################################### [100%]
1:tix ########################################### [ 13%]
2:tix-devel ########################################### [ 25%]
3:python ########################################### [ 38%]
4:tkinter ########################################### [ 50%]
5:python-devel ########################################### [ 63%]
6:python-libs ########################################### [ 75%]
7:python-tools ########################################### [ 88%]
8:yum ########################################### [100%]
[root@localhost x]# yum update

done...
:lol:

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

Re: [SOLVED] No module named yum

Post by TrevorH » 2012/10/04 08:17:51

Thanks for letting us know the solution.

You cannot upgrade python on a CentOS system without breaking lots of system tools. If you need a newer python then you either need to update to a newer CentOS version (i.e. 6 in this case) or you need to find an RPM that does a parallel install and leaves the system python alone - for example, EPEL has a python26 set of packages for CentOS 5 that install under /usr/lib/python2.6 and leave the system python 2.4 intact under /usr/lib/python.

asip
Posts: 2
Joined: 2012/11/02 10:48:39

Re: [SOLVED] No module named yum

Post by asip » 2012/11/02 11:41:52

hello sir trevor

How can i download and install all rpm package for python 2.6 on EPEL as you stated that

"EPEL has a python26 set of packages for CentOS 5 that install under /usr/lib/python2.6 and leave the system python 2.4 intact under /usr/lib/python"

because in my problem, when i change the link of the active python version from 2.4 to 2.6,which the command that i've executed as below:

rm /usr/lib/python
ln -s /usr/bin/python2.6 /usr/bin/python

i got the YUM error says

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.5 (r265:79063, Jul 8 2010, 13:18:38)
[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

i am about to download and install the python rpm package from http://mirrors.tummy.com/mirrors/CentOS/5/updates/x86_64/RPMS/ but i stop when i read your comment that python26 set for Centos 5 in EPEL. FYI, when i was installing the python2.6, after the YUM have downloaded all 41 package/dependencies/libraries and want to zip it, it cause error that say that ERROR WHILE UNZIPPING...NO KEY HS231J .. The errors were for all 41 packages that yum have downloaded..I suspected that this may be the reason why my yum module cannot be found..hope you can help


-asip-

gerald_clark
Posts: 10642
Joined: 2005/08/05 15:19:54
Location: Northern Illinois, USA

[SOLVED] No module named yum

Post by gerald_clark » 2012/11/02 13:17:32

Now you broke it again!

You need to change the scripts that need python 2.6 to use /usr/bin/python2.6 instead.

Re-install your python.

asip
Posts: 2
Joined: 2012/11/02 10:48:39

Re: [SOLVED] No module named yum

Post by asip » 2012/11/02 15:59:49

[quote]
gerald_clark wrote:
Now you broke it again!

You need to change the scripts that need python 2.6 to use /usr/bin/python2.6 instead.

Re-install your python.[/quote]

can you explain to me why i broke it? i thought that i've successfully install both 2.4 and 2.6 python without broken using EPEL repo --> am i doing the wrong step?
http://www.question-defense.com/2009/12/25/how-to-install-python-2-6-on-centos-5-without-breaking-yum

. I also check both version by typing "PYTHON" in terminal when i switched the symbolic link of the python and it works. I've installed and used EPEL repo to install python 2.6 in my CentOS 5.7 64bit. The reason why i installed 2 version of python is because i want to install openerp 6.1 in my system that require python 2.6. And now the situation got even worse.. I tried to switch back to python 2.4 using the symbolic link but it said i already have too many levels of symbolic links. Help me out here because i am new to this stuff. Installing openerp on centos is quiet challenging..

dilersingh
Posts: 11
Joined: 2013/12/07 21:38:19

Re: [SOLVED] No module named yum

Post by dilersingh » 2013/12/07 21:42:21

99% cases rpm is also broken due error as libpopt.so.0 missing, So to fix popt first use this:

Download Source from any URL as you link eg:

Code: Select all

cd /tmp
wget http://rpm5.org/files/popt/popt-1.10.4.tar.gz
tar -xvzf popt-1.10.4.tar.gz
cd popt-1.10.4
Install popt by running the following commands:

Code: Select all

sed -i -e "/*origOptString ==/c 0)" popt.c &&
./configure --prefix=/usr &&
make
To test the results, issue:

Code: Select all

make check
Now, as the root user:

Code: Select all

make install
Phew!

Now Download all packages from:
http://mirror.centos.org/centos/5/os/x86_64/CentOS/

Code: Select all

wget http://mirror.centos.org/centos/5/os/x86_64/CentOS/python-2.4.3-56.el5.x86_64.rpm
wget http://mirror.centos.org/centos/5/os/x86_64/CentOS/python-devel-2.4.3-56.el5.x86_64.rpm
wget http://mirror.centos.org/centos/5/os/x86_64/CentOS/python-libs-2.4.3-56.el5.x86_64.rpm
wget http://mirror.centos.org/centos/5/os/x86_64/CentOS/python-tools-2.4.3-56.el5.x86_64.rpm
wget http://mirror.centos.org/centos/5/os/x86_64/CentOS/tix-8.4.0-11.fc6.x86_64.rpm
wget http://mirror.centos.org/centos/5/os/x86_64/CentOS/tix-devel-8.4.0-11.fc6.x86_64.rpm
wget http://mirror.centos.org/centos/5/os/x86_64/CentOS/tkinter-2.4.3-56.el5.x86_64.rpm
wget http://mirror.centos.org/centos/5/os/x86_64/CentOS/yum-3.2.22-40.el5.centos.noarch.rpm
wget http://mirror.centos.org/centos/5/os/x86_64/CentOS/tcl-8.4.13-6.el5.x86_64.rpm
wget http://mirror.centos.org/centos/5/os/x86_64/CentOS/tcl-devel-8.4.13-6.el5.x86_64.rpm
wget http://mirror.centos.org/centos/5/os/x86_64/CentOS/tk-8.4.13-5.el5_1.1.x86_64.rpm
wget http://mirror.centos.org/centos/5/os/x86_64/CentOS/tk-devel-8.4.13-5.el5_1.1.x86_64.rpm
wget http://mirror.centos.org/centos/5/os/x86_64/CentOS/rpm-python-4.4.2.3-34.el5.x86_64.rpm
wget http://mirror.centos.org/centos/5/os/x86_64/CentOS/yum-fastestmirror-1.1.16-21.el5.centos.noarch.rpm
wget http://mirror.centos.org/centos/5/os/x86_64/CentOS/rpm-4.4.2.3-34.el5.x86_64.rpm
wget http://mirror.centos.org/centos/5/os/x86_64/CentOS/rpm-libs-4.4.2.3-34.el5.x86_64.rpm
wget http://mirror.centos.org/centos/5/os/x86_64/CentOS/libX11-1.0.3-11.el5_7.1.x86_64.rpm
wget http://mirror.centos.org/centos/5/os/x86_64/CentOS/libX11-devel-1.0.3-11.el5_7.1.x86_64.rpm
wget http://mirror.centos.org/centos/5/os/x86_64/CentOS/popt-1.10.2.3-34.el5.x86_64.rpm
wget http://mirror.centos.org/centos/5/os/x86_64/CentOS/libXau-1.0.1-3.1.x86_64.rpm
wget http://mirror.centos.org/centos/5/os/x86_64/CentOS/libXau-devel-1.0.1-3.1.x86_64.rpm
wget http://mirror.centos.org/centos/5/os/x86_64/CentOS/libXdmcp-1.0.1-2.1.x86_64.rpm
wget http://mirror.centos.org/centos/5/os/x86_64/CentOS/libXdmcp-devel-1.0.1-2.1.x86_64.rpm
wget http://mirror.centos.org/centos/5/os/x86_64/CentOS/xorg-x11-proto-devel-7.1-13.el5.x86_64.rpm
wget http://mirror.centos.org/centos/5/os/x86_64/CentOS/mesa-libGL-devel-6.5.1-7.11.el5_9.x86_64.rpm
wget http://mirror.centos.org/centos/5/os/x86_64/CentOS/mesa-libGL-6.5.1-7.11.el5_9.x86_64.rpm
wget http://mirror.centos.org/centos/5/os/x86_64/CentOS/libXxf86vm-1.0.1-3.1.x86_64.rpm
wget http://mirror.centos.org/centos/5/os/x86_64/CentOS/libXxf86vm-devel-1.0.1-3.1.x86_64.rpm
wget http://mirror.centos.org/centos/5/os/x86_64/CentOS/libXext-1.0.1-2.1.x86_64.rpm
wget http://mirror.centos.org/centos/5/os/x86_64/CentOS/libXext-devel-1.0.1-2.1.x86_64.rpm
wget http://mirror.centos.org/centos/5/os/x86_64/CentOS/libdrm-2.0.2-1.1.x86_64.rpm
wget http://mirror.centos.org/centos/5/os/x86_64/CentOS/libdrm-devel-2.0.2-1.1.x86_64.rpm


rpm -Uvh --replacepkgs python-2.4.3-56.el5.x86_64.rpm python-devel-2.4.3-56.el5.x86_64.rpm python-libs-2.4.3-56.el5.x86_64.rpm python-tools-2.4.3-56.el5.x86_64.rpm tix-8.4.0-11.fc6.x86_64.rpm tix-devel-8.4.0-11.fc6.x86_64.rpm tkinter-2.4.3-56.el5.x86_64.rpm yum-3.2.22-40.el5.centos.noarch.rpm tcl-8.4.13-6.el5.x86_64.rpm tcl-devel-8.4.13-6.el5.x86_64.rpm tk-8.4.13-5.el5_1.1.x86_64.rpm tk-devel-8.4.13-5.el5_1.1.x86_64.rpm rpm-python-4.4.2.3-34.el5.x86_64.rpm yum-fastestmirror-1.1.16-21.el5.centos.noarch.rpm rpm-4.4.2.3-34.el5.x86_64.rpm rpm-libs-4.4.2.3-34.el5.x86_64.rpm libX11-1.0.3-11.el5_7.1.x86_64.rpm libX11-devel-1.0.3-11.el5_7.1.x86_64.rpm popt-1.10.2.3-34.el5.x86_64.rpm libXau-1.0.1-3.1.x86_64.rpm libXau-devel-1.0.1-3.1.x86_64.rpm libXdmcp-1.0.1-2.1.x86_64.rpm libXdmcp-devel-1.0.1-2.1.x86_64.rpm xorg-x11-proto-devel-7.1-13.el5.x86_64.rpm mesa-libGL-devel-6.5.1-7.11.el5_9.x86_64.rpm mesa-libGL-6.5.1-7.11.el5_9.x86_64.rpm libXxf86vm-1.0.1-3.1.x86_64.rpm libXxf86vm-devel-1.0.1-3.1.x86_64.rpm libXext-1.0.1-2.1.x86_64.rpm libXext-devel-1.0.1-2.1.x86_64.rpm libdrm-2.0.2-1.1.x86_64.rpm libdrm-devel-2.0.2-1.1.x86_64.rpm --nosignature

All Done!!

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

Re: [SOLVED] No module named yum

Post by TrevorH » 2013/12/07 22:09:23

You forgot to reinstall popt after you broke it by doing a source install!

My guess is that you'd be much better off using rpm2cpio and cpio to unpack the popt rpm if it is indeed broken and then install the parts that are exploded by that. And don't forget to reinstall the popt rpm afterwards 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

dilersingh
Posts: 11
Joined: 2013/12/07 21:38:19

Re: [SOLVED] No module named yum

Post by dilersingh » 2013/12/07 22:27:55

Thanks for the suggestion, but I was unable to use rpm2cpio as rpm was broken. So I did a source popt and fixed my rpm first. But yes it does make sense if rpm still works that would have been a lot less tedious.

Thanks

cdaringe
Posts: 8
Joined: 2014/03/11 08:18:02

Re: [SOLVED] No module named yum

Post by cdaringe » 2014/03/23 23:42:15

I had foolishly received this error when goofing around/doing-evil-things in my user/bin/py** space. I have moved a 3.x executable to be on /usr/bin/python. I had intentionally moved my original /usr/bin/python to /usr/bin/python_bu, thus restored it, and wha-la, error removed!

Post Reply