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, tools, and much more.

Current Customers and Partners

Log in for full access

Log In

New to Red Hat?

Learn more about Red Hat subscriptions

Using a Red Hat product through a public cloud?

How to access this content