LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - General (https://www.linuxquestions.org/questions/linux-general-1/)
-   -   Python YUM Module not found (https://www.linuxquestions.org/questions/linux-general-1/python-yum-module-not-found-742809/)

von_vea 07-25-2009 08:35 PM

Python YUM Module not found
 
Good day to all!

I have CentOS 5.3 with python 2.4.3 installed by default.
Yum is working properly.

I want to use python 2.5.4. I downloaded the package
http://www.python.org/ftp/python/2.5...-2.5.4.tar.bz2

and extract it to /opt and install it using the following commands:

# ./configure && make && make install

After installing python, i type # python -V to show the version

# python -V
Python 2.4.3

What I did is move the current python in /usr/bin/

# mv -v /usr/bin/python /usr/bin/pyton243

And link it to the new one

# ln -s /usr/local/bin/python /usr/bin/python

And check the version again.

# python -V
Python 2.5.4

However, this is my problem. The YUM is no longer working.

# yum list
====
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.5.4 (r254:67916, Jul 16 2009, 03:14:54)
[GCC 4.1.2 20080704 (Red Hat 4.1.2-44)]

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

=====

I even tried to change the path located in line 1 of a yum file to the new python path. But no luck still. Any advise how do I install yum module in python or any work around for this one? Many thanks in advance.

# vi /usr/bin/yum
=====
#!/usr/local/bin/python
import sys
try:
import yum
except ImportError:
print >> sys.stderr, """\
There was a problem importing one of the Python modules
required to run yum. The error leading to this problem was:

%s

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:
%s

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

""" % (sys.exc_value, sys.version)
sys.exit(1)

sys.path.insert(0, '/usr/share/yum-cli')
try:
import yummain
yummain.user_main(sys.argv[1:], exit_code=True)
except KeyboardInterrupt, e:
print >> sys.stderr, "\n\nExiting on user cancel."
sys.exit(1)
=====

Von Vea
webmaster at vonericapparel dot com
Von Eric Apparel

colucix 07-26-2009 06:18 AM

Hi and welcome to LQ! :)

As stated in the yum FAQ, maybe you have to rebuild the yum package to make it aware of the changes in python, then force a re-install. Take a look at this thread with some other useful hints about this topic.

von_vea 07-28-2009 08:42 PM

Quote:

Originally Posted by colucix (Post 3620630)
Hi and welcome to LQ! :)

As stated in the yum FAQ, maybe you have to rebuild the yum package to make it aware of the changes in python, then force a re-install. Take a look at this thread with some other useful hints about this topic.

Thanks for your reply. However, I am using CentOS 5.3 and tried rebuilding YUM package but it doesn't help.

Any Idea ? or do i need to let my older python 2.4.3 take care for my yum. and use the new python 2.5.4 for building applications.

I believe python 2.4.3 has been installed automatically together with YUM module even no packages was selected prior to CentOS installation.

I can't figure out how the YUM has been installed as one of the python module.

Thanks again.
- Von VEA


All times are GMT -5. The time now is 02:51 PM.