yum command reports "No module named yum"
search cancel

yum command reports "No module named yum"

book

Article ID: 372793

calendar_today

Updated On: 10-22-2024

Products

VMware Tanzu Greenplum Pivotal Data Suite Non Production Edition VMware Tanzu Data Suite VMware Tanzu Data Suite Greenplum

Issue/Introduction

When running "yum" utility on a Greenplum host, it reports the following error:

[root@mdw gpadmin]# yum list
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.7.5 (default, Jun 28 2022, 15:30:04)
[GCC 4.8.5 20150623 (Red Hat 4.8.5-44)]

If you cannot solve this problem yourself, please go to
the yum faq at:
  http://yum.baseurl.org/wiki/Faq


[root@mdw gpadmin]#

Environment

Greenplum all versions

Cause

This is usually caused by environment variables set by the Greenplum file "${GPHOME}/greenplum_path.sh.

yum utility is a python script and needs to use the python installed on the host and avoid the use of the python delivered with Greenplum.

The Greenplum file ${GPHOME}/greenplum_path.sh sets PYTHONHOME, PYTHONPATH and LD_LIBRARY_PATH which can stop the yum utility from running.

Resolution

Option 1

When switching user to root use "su -" and not just "su".

"su -" will clear the Greenplum environment variables and source the "root" user environment to allow yum to run.

Option 2

If the Greenplum environment was sourced, clear the settings for PYTHONHOME, PYTHONPATH and LD_LIBRARY_PATH

unset PYTHONHOME
unset PYTHONPATH
unset LD_LIBRARY_PATH