• Home »
  • »
  • Yum Error – ImportError: No module named yummain

Yum Error – ImportError: No module named yummain

You may see an error like the below when attempting to see if a certain package is installed using the yum package manager. Yum is the default package manager on RedHat Linux and CentOS Linux. Using the “yum list *SOMETEXT*” command will list all packages that contain “sometext” or you could use “yum list sometext” which will list a package specifically called “sometext”. Below you can see an attempt to list the “git” package on a CentOS server however an error was returned.

Yum List Error Example:


  1. [web@server ~]$ yum list *GIT*
  2. Traceback (most recent call last):
  3. File "/usr/bin/yum", line 28, in ?
  4. import yummain
  5. ImportError: No module named yummain

The problem is that the user you are attempting to verify the package for does not have access to yum. Make sure you are using the proper user which would typically be root. A successful attempt to verify git will look like the below.

Successful Yum List Attempt:


  1. [root@server ~]# yum list git
  2. Loading "installonlyn" plugin
  3. Setting up repositories
  4. Reading repository metadata in from local files
  5. Installed Packages
  6. git.x86_64 installed

Running the command “yum list git” should tell you the version of git installed and if there are any updates available. Below is the output of “yum –help” to give you an idea of how yum can be used.

Output of Yum Help:


  1. [root@dev ~]# yum --help
  2. Loading "installonlyn" plugin
  3. usage: yum [options] < grouplist, localinstall, groupinfo, localupdate, resolvedep, erase, deplist, groupremove, makecache, upgrade, provides, shell, install, whatprovides, groupinstall, update, groupupdate, info, search, check-update, list, remove, clean, grouperase >
  5. options:
  6. -h, --help show this help message and exit
  7. -t, --tolerant be tolerant of errors
  8. -C run entirely from cache, don't update cache
  9. -c [config file] config file location
  10. -R [minutes] maximum command wait time
  11. -d [debug level] debugging output level
  12. -e [error level] error output level
  13. -y answer yes for all questions
  14. --version show Yum version and exit
  15. --installroot=[path] set install root
  16. --enablerepo=[repo] enable one or more repositories (wildcards allowed)
  17. --disablerepo=[repo] disable one or more repositories (wildcards allowed)
  18. -x [package], --exclude=[package]
  19. exclude package(s) by name or glob
  20. --obsoletes enable obsoletes processing during updates
  21. --noplugins disable Yum plugins

For the initial error just make sure that you are using yum with the proper user or provide the user you want to use yum the proper permissions.

Linux Administration: A Beginner’s Guide, Fifth Edition (Paperback)

List Price: $39.99
New From: $15.93 USD In Stock
Used from: $2.92 USD In Stock

The Definitive Guide to CentOS (Books for Professionals by Professionals) (Paperback)

List Price: $39.99 USD
New From: $24.06 USD In Stock
Used from: $0.55 USD In Stock