2

On a CentOS 7 I have installed python3 with the following command:

yum install -y python3

However, when I call import rpm, I get this error:

File "\<stdin>", line 1, in \<module>
ModuleNotFoundError: No module named 'rpm'

So how do I import the python3 rpm module?

Running rpm --version returns

RPM version 4.11.3

Accessing python (2.7.5) and running the import command works. So I could call a python2 script from python 3, as described here but this just feels wrong.

There are similar questions to this but they all relate to the rpm module being unavailable from Python2 and I don't have that problem. None deal with making the rpm module available in Python3.

greenbeast
  • 364
  • 2
  • 8
  • 21

1 Answers1

0

Did you install the rpm python package for the python3 distribution?

pip3 install rpm-py-installer

Per the homepage of RPM this seems to be a required step.

orcaman
  • 6,263
  • 8
  • 54
  • 69
  • I tried this, but I get an error stating: Command "python setup.py egg_info" failed with error code 1 in /tmp/pip-build-df6b5wx8/rpm-py-installer. I found a suggestion to run 'pip3 install --upgrade setuptools'. But the error persists when I run the command again. – greenbeast May 22 '21 at 11:26