LinuxQuestions.org
Visit Jeremy's Blog.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Software
User Name
Password
Linux - Software This forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.

Notices


Reply
  Search this Thread
Old 03-22-2013, 05:39 AM   #1
scratchyrat
LQ Newbie
 
Registered: May 2010
Location: United Kingdom
Distribution: Debian, Red Hat, AIX, Ubuntu, Fedora
Posts: 27

Rep: Reputation: 3
Broken Yum - No module named yum


Due to a dodgy script, I suspect some of the python modules/python related stuff on this server was removed (I didn't do it, just trying to fix it).

When I run yum, I get 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.4.3 (#1, Mar 12 2013, 12:41:23) 
[GCC 4.4.5 20110214 (Red Hat 4.4.5-6)]

If you cannot solve this problem yourself, please go to 
the yum faq at:
  http://yum.baseurl.org/wiki/Faq
If I run python and try and import the module, it fails

Code:
Python 2.4.3 (#1, Mar 12 2013, 12:41:23) 
[GCC 4.4.5 20110214 (Red Hat 4.4.5-6)] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import yum
Traceback (most recent call last):
  File "<stdin>", line 1, in ?
ImportError: No module named yum
Alternative versions of python are installed, 2.6 and 2.7 but this was working fine alongside the system version of python before stuff got eaten by the dodgy script.

This server is Amazon Linux release 2011.09 so as far as I know, there's no public repo for me to get files from.

My versions are:

Code:
yum-3.2
Code:
python -V
Python 2.4.3
Code:
which python
/usr/bin/python
Python and python2.7 are both on my PATH.

I've been going round in circles a bit, does anyone have any idea's or suggestions I can try. I'm fully prepared to go back to square one and try anything.

Thanks

Edit:

I just found this, this isn't what I would expect as its all 2.6

Code:
rpm -ql yum
/etc/bash_completion.d
/etc/bash_completion.d/yum.bash
/etc/logrotate.d/yum
/etc/yum
/etc/yum.conf
/etc/yum.repos.d
/etc/yum/pluginconf.d
/etc/yum/protected.d
/etc/yum/vars
/etc/yum/version-groups.conf
/usr/bin/yum
/usr/lib/python2.6/site-packages/rpmUtils
/usr/lib/python2.6/site-packages/rpmUtils/__init__.py
/usr/lib/python2.6/site-packages/rpmUtils/__init__.pyc
/usr/lib/python2.6/site-packages/rpmUtils/__init__.pyo
/usr/lib/python2.6/site-packages/rpmUtils/arch.py
/usr/lib/python2.6/site-packages/rpmUtils/arch.pyc
/usr/lib/python2.6/site-packages/rpmUtils/arch.pyo
/usr/lib/python2.6/site-packages/rpmUtils/miscutils.py
/usr/lib/python2.6/site-packages/rpmUtils/miscutils.pyc
/usr/lib/python2.6/site-packages/rpmUtils/miscutils.pyo
/usr/lib/python2.6/site-packages/rpmUtils/oldUtils.py
/usr/lib/python2.6/site-packages/rpmUtils/oldUtils.pyc
/usr/lib/python2.6/site-packages/rpmUtils/oldUtils.pyo
/usr/lib/python2.6/site-packages/rpmUtils/transaction.py
/usr/lib/python2.6/site-packages/rpmUtils/transaction.pyc
/usr/lib/python2.6/site-packages/rpmUtils/transaction.pyo
/usr/lib/python2.6/site-packages/rpmUtils/updates.py
/usr/lib/python2.6/site-packages/rpmUtils/updates.pyc
/usr/lib/python2.6/site-packages/rpmUtils/updates.pyo
/usr/lib/python2.6/site-packages/yum
/usr/lib/python2.6/site-packages/yum/Errors.py
/usr/lib/python2.6/site-packages/yum/Errors.pyc
/usr/lib/python2.6/site-packages/yum/Errors.pyo
/usr/lib/python2.6/site-packages/yum/__init__.py
/usr/lib/python2.6/site-packages/yum/__init__.pyc
/usr/lib/python2.6/site-packages/yum/__init__.pyo
/usr/lib/python2.6/site-packages/yum/callbacks.py
/usr/lib/python2.6/site-packages/yum/callbacks.pyc
/usr/lib/python2.6/site-packages/yum/callbacks.pyo
/usr/lib/python2.6/site-packages/yum/comps.py
/usr/lib/python2.6/site-packages/yum/comps.pyc
/usr/lib/python2.6/site-packages/yum/comps.pyo
/usr/lib/python2.6/site-packages/yum/config.py
/usr/lib/python2.6/site-packages/yum/config.pyc
/usr/lib/python2.6/site-packages/yum/config.pyo
/usr/lib/python2.6/site-packages/yum/constants.py
/usr/lib/python2.6/site-packages/yum/constants.pyc
/usr/lib/python2.6/site-packages/yum/constants.pyo
/usr/lib/python2.6/site-packages/yum/depsolve.py
/usr/lib/python2.6/site-packages/yum/depsolve.pyc
/usr/lib/python2.6/site-packages/yum/depsolve.pyo
/usr/lib/python2.6/site-packages/yum/failover.py
/usr/lib/python2.6/site-packages/yum/failover.pyc
/usr/lib/python2.6/site-packages/yum/failover.pyo
/usr/lib/python2.6/site-packages/yum/history.py
/usr/lib/python2.6/site-packages/yum/history.pyc
/usr/lib/python2.6/site-packages/yum/history.pyo
/usr/lib/python2.6/site-packages/yum/i18n.py
/usr/lib/python2.6/site-packages/yum/i18n.pyc
/usr/lib/python2.6/site-packages/yum/i18n.pyo
/usr/lib/python2.6/site-packages/yum/logginglevels.py
/usr/lib/python2.6/site-packages/yum/logginglevels.pyc
/usr/lib/python2.6/site-packages/yum/logginglevels.pyo
/usr/lib/python2.6/site-packages/yum/mdparser.py
/usr/lib/python2.6/site-packages/yum/mdparser.pyc
/usr/lib/python2.6/site-packages/yum/mdparser.pyo
/usr/lib/python2.6/site-packages/yum/metalink.py
/usr/lib/python2.6/site-packages/yum/metalink.pyc
/usr/lib/python2.6/site-packages/yum/metalink.pyo
/usr/lib/python2.6/site-packages/yum/misc.py
/usr/lib/python2.6/site-packages/yum/misc.pyc
/usr/lib/python2.6/site-packages/yum/misc.pyo
/usr/lib/python2.6/site-packages/yum/packageSack.py
/usr/lib/python2.6/site-packages/yum/packageSack.pyc
/usr/lib/python2.6/site-packages/yum/packageSack.pyo
/usr/lib/python2.6/site-packages/yum/packages.py
/usr/lib/python2.6/site-packages/yum/packages.pyc
/usr/lib/python2.6/site-packages/yum/packages.pyo
/usr/lib/python2.6/site-packages/yum/parser.py
/usr/lib/python2.6/site-packages/yum/parser.pyc
/usr/lib/python2.6/site-packages/yum/parser.pyo
/usr/lib/python2.6/site-packages/yum/pgpmsg.py
/usr/lib/python2.6/site-packages/yum/pgpmsg.pyc
/usr/lib/python2.6/site-packages/yum/pgpmsg.pyo
/usr/lib/python2.6/site-packages/yum/pkgtag_db.py
/usr/lib/python2.6/site-packages/yum/pkgtag_db.pyc
/usr/lib/python2.6/site-packages/yum/pkgtag_db.pyo
/usr/lib/python2.6/site-packages/yum/plugins.py
/usr/lib/python2.6/site-packages/yum/plugins.pyc
/usr/lib/python2.6/site-packages/yum/plugins.pyo
/usr/lib/python2.6/site-packages/yum/repoMDObject.py
/usr/lib/python2.6/site-packages/yum/repoMDObject.pyc
/usr/lib/python2.6/site-packages/yum/repoMDObject.pyo
/usr/lib/python2.6/site-packages/yum/repos.py
/usr/lib/python2.6/site-packages/yum/repos.pyc
/usr/lib/python2.6/site-packages/yum/repos.pyo
/usr/lib/python2.6/site-packages/yum/rpmsack.py
/usr/lib/python2.6/site-packages/yum/rpmsack.pyc
/usr/lib/python2.6/site-packages/yum/rpmsack.pyo
/usr/lib/python2.6/site-packages/yum/rpmtrans.py
/usr/lib/python2.6/site-packages/yum/rpmtrans.pyc
/usr/lib/python2.6/site-packages/yum/rpmtrans.pyo
/usr/lib/python2.6/site-packages/yum/sqlitesack.py
/usr/lib/python2.6/site-packages/yum/sqlitesack.pyc
/usr/lib/python2.6/site-packages/yum/sqlitesack.pyo
/usr/lib/python2.6/site-packages/yum/sqlutils.py
/usr/lib/python2.6/site-packages/yum/sqlutils.pyc
/usr/lib/python2.6/site-packages/yum/sqlutils.pyo
/usr/lib/python2.6/site-packages/yum/transactioninfo.py
/usr/lib/python2.6/site-packages/yum/transactioninfo.pyc
/usr/lib/python2.6/site-packages/yum/transactioninfo.pyo
/usr/lib/python2.6/site-packages/yum/update_md.py
/usr/lib/python2.6/site-packages/yum/update_md.pyc
/usr/lib/python2.6/site-packages/yum/update_md.pyo
/usr/lib/python2.6/site-packages/yum/yumRepo.py
/usr/lib/python2.6/site-packages/yum/yumRepo.pyc
/usr/lib/python2.6/site-packages/yum/yumRepo.pyo
/usr/lib/yum-plugins
/usr/share/doc/yum-3.2.29
/usr/share/doc/yum-3.2.29/AUTHORS
/usr/share/doc/yum-3.2.29/COPYING
/usr/share/doc/yum-3.2.29/ChangeLog
/usr/share/doc/yum-3.2.29/INSTALL
/usr/share/doc/yum-3.2.29/README
/usr/share/doc/yum-3.2.29/TODO
/usr/share/locale/ca/LC_MESSAGES/yum.mo
/usr/share/locale/cs/LC_MESSAGES/yum.mo
/usr/share/locale/da/LC_MESSAGES/yum.mo
/usr/share/locale/de/LC_MESSAGES/yum.mo
/usr/share/locale/en_GB/LC_MESSAGES/yum.mo
/usr/share/locale/es/LC_MESSAGES/yum.mo
/usr/share/locale/fi/LC_MESSAGES/yum.mo
/usr/share/locale/fr/LC_MESSAGES/yum.mo
/usr/share/locale/it/LC_MESSAGES/yum.mo
/usr/share/locale/ja/LC_MESSAGES/yum.mo
/usr/share/locale/ms/LC_MESSAGES/yum.mo
/usr/share/locale/nb/LC_MESSAGES/yum.mo
/usr/share/locale/pa/LC_MESSAGES/yum.mo
/usr/share/locale/pl/LC_MESSAGES/yum.mo
/usr/share/locale/pt/LC_MESSAGES/yum.mo
/usr/share/locale/pt_BR/LC_MESSAGES/yum.mo
/usr/share/locale/ru/LC_MESSAGES/yum.mo
/usr/share/locale/sr/LC_MESSAGES/yum.mo
/usr/share/locale/sr@latin/LC_MESSAGES/yum.mo
/usr/share/locale/sv/LC_MESSAGES/yum.mo
/usr/share/locale/uk/LC_MESSAGES/yum.mo
/usr/share/locale/zh_CN/LC_MESSAGES/yum.mo
/usr/share/man/man5/yum.conf.5.gz
/usr/share/man/man8/yum-shell.8.gz
/usr/share/man/man8/yum.8.gz
/usr/share/yum-cli
/usr/share/yum-cli/callback.py
/usr/share/yum-cli/callback.pyc
/usr/share/yum-cli/callback.pyo
/usr/share/yum-cli/cli.py
/usr/share/yum-cli/cli.pyc
/usr/share/yum-cli/cli.pyo
/usr/share/yum-cli/output.py
/usr/share/yum-cli/output.pyc
/usr/share/yum-cli/output.pyo
/usr/share/yum-cli/shell.py
/usr/share/yum-cli/shell.pyc
/usr/share/yum-cli/shell.pyo
/usr/share/yum-cli/utils.py
/usr/share/yum-cli/utils.pyc
/usr/share/yum-cli/utils.pyo
/usr/share/yum-cli/yumcommands.py
/usr/share/yum-cli/yumcommands.pyc
/usr/share/yum-cli/yumcommands.pyo
/usr/share/yum-cli/yummain.py
/usr/share/yum-cli/yummain.pyc
/usr/share/yum-cli/yummain.pyo
/usr/share/yum-plugins
/var/cache/yum
/var/lib/yum
/var/lib/yum/history
/var/lib/yum/plugins
/var/lib/yum/uuid
/var/lib/yum/yumdb

Last edited by scratchyrat; 03-22-2013 at 05:42 AM.
 
Old 03-22-2013, 09:58 PM   #2
John VV
LQ Muse
 
Registered: Aug 2005
Location: A2 area Mi.
Posts: 17,523

Rep: Reputation: 2619Reputation: 2619Reputation: 2619Reputation: 2619Reputation: 2619Reputation: 2619Reputation: 2619Reputation: 2619Reputation: 2619Reputation: 2619Reputation: 2619
well yum is VERY dependent on the correct version of Python that is installed
now you can have two or move versions of python installed BUT the version in the update repo MUST be installed and used

Python 2.4.3 ???


from the page
http://aws.amazon.com/amazon-linux-a...release-notes/

It looks like "Amazon Linux release 2011.09" based on RHEL6 ?

can you post the output of
Code:
cat /etc/redhat-release
if "Python 2.4.3" from the update repo was removed
you have a problem
you will have to manually download the rpm files FROM the update repo

I am running ScientificLinux 6.3 - so my files will look a bit like yours
-- BUT NOT the same --
in the " /etc/yum.repos.d/" folder
the main repo file ( unsure of the name in amazons version )

you will have a section ( at the top of the file) called "baseurl"
--- mine YOURS WILL look a bit different !!!
Code:
baseurl=http://ftp.scientificlinux.org/linux/scientific/$releasever/$basearch/os/
-- description -- yours WILL be different
http://ftp.scientificlinux.org/linux/scientific/$releasever/$basearch/os/

the first mirror to read , the below is the server folder that the files are in
http://ftp.scientificlinux.org/linux/scientific

" /$releasever"--- is the VERSION of the operating system
--- in my case "6.3 "
"$basearch" --- in 32 bit or 64 bit ( i386 or x86_64 )

"os" -- just a folder

so look in the mirror for YOUR amazon server

go into the architecture 32 or 64 bit folder
and look in "updates" first
-- MY sl6 updates -- not yours so
http://ftp.scientificlinux.org/linux...ic/6.3/x86_64/
http://ftp.scientificlinux.org/linux...86_64/updates/

search through your os's updates for the version of python
if you do not see it
go up in the tree to the " os/packages"
--MY sl6 --
http://ftp.scientificlinux.org/linux...4/os/Packages/
and look for the python rpm

download it and use "rpm" to force a reinstall
see:
Code:
rpm --help
but you might want to call amazon for assistance
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
yum and No module named CElementTree vitasis Linux - Software 12 09-08-2010 04:45 AM
problem when run yum (No module named yum) ezak Linux - Distributions 4 10-16-2009 04:04 AM
Problem Installing Yum: "No module named yum" braclayrab Linux - Newbie 9 08-04-2009 06:57 PM
YUM no module named yum gimmee Fedora 7 12-06-2006 03:43 PM
broken yum - "No module named yum" shihab-alain Linux - Software 2 05-10-2006 05:09 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Software

All times are GMT -5. The time now is 07:04 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration