Software⏱️ 3 min read📅 2026-06-19

How to Fix: Installing yum on linux results in no module named yum error despite only have python 2.7

Error installing yum on Kali Linux due to Python version mismatch.

Quick Answer: Try reinstalling Python or using an alternative package manager like apt-get.

Installing yum on Linux can be frustrating when it results in a 'no module named yum' error, even when only Python 2.7 is present. This issue affects users who rely on yum for package management and are unable to resolve it through standard troubleshooting methods.

Despite the availability of multiple solutions online, some users have struggled to find a reliable fix for this problem. In this guide, we will walk you through the root causes and provide two primary methods to resolve the 'no module named yum' error when installing yum on Linux with Python 2.7.

🔍 Why This Happens

  • The primary reason for this error is that the Python yum package is not installed or not properly configured on your system. This can occur due to various reasons, such as a missing or corrupted installation, or an incorrect configuration of the Python environment.
  • An alternative reason for this issue could be related to the way yum is packaged and distributed for Linux systems. In some cases, the yum package may not be compatible with Python 2.7, leading to the 'no module named yum' error.

✅ Best Solutions to Fix It

Enabling the yum repository

  1. Step 1: Open a terminal and run the command `sudo yum install python-yum` to install the Python yum package.
  2. Step 2: Verify that the installation was successful by running `python -c 'import yum; print(yum.__version__)'`.
  3. Step 3: If the package is not found, try updating the package list with `sudo yum update` before attempting the installation again.

Configuring the Python environment

  1. Step 1: Open a terminal and run the command `python -m site --user-site` to check the current Python site-packages directory.
  2. Step 2: Create a symbolic link to the correct location of the yum package by running `sudo ln -s /usr/lib/python2.7/site-packages/yum /usr/lib/python2.7/site-packages/`.
  3. Step 3: Verify that the symlink is in place by running `ls /usr/lib/python2.7/site-packages/ | grep yum`.

🎯 Final Words

By following these steps, you should be able to resolve the 'no module named yum' error when installing yum on Linux with Python 2.7. If you encounter any issues during the process, feel free to consult additional resources or seek assistance from a Linux expert.

Did this fix your problem?

If not, try searching for specific error codes.

🔍 Search Error Database

❓ Frequently Asked Questions