Python scripts running on Red Hat Enterprise Linux 8 can not "import yum"

Solution Verified - Updated -


  • python2/python3 scripts fail to import the python module
  • When I run my python script that is copied over from Red Hat Enterprise Linux 7 or before, the following is seen:
Traceback (most recent call last):
ImportError: No module named yum


  • Red Hat Enterprise Linux 8
  • Python 2.7
  • Python 3.6

Subscriber exclusive content

A Red Hat subscription provides unlimited access to our knowledgebase of over 48,000 articles and solutions.

Current Customers and Partners

Log in for full access

Log In