I want to include a Python package dependency (installed using pip3 install
) in an rpm
package. I cannot install using dnf
because its version is out of date. rpm
returns the following error if I install the dependency using pip3 install
:
error: Failed dependencies python3.6dist(dependency-package)
Any suggestions on how to include a Python package inside of an rpm
?
Advertisement
Answer
OK. Some of your package require python3-somepackage
or python3dist(somepackage)
. For rpm, it is just a string. Rpm does not care that the python module has been installed using pip. There must be some package which provides that string.
You have two options.
Prefered is use of pyp2rpm --srpm somepackage
. That will download the latest version of the module from PyPI and produce the src.rpm. You can then build it using mock -r epel-8-x86_64 somepackage.src.rpm
The other option is to fake the provides. You can install the module using pip and then run: create-fake-rpm --build python3-somepackage 'python3dist(somepackage)'
. This will generate the file fake-python3-somepackage-0-0.noarch.rpm
which you can install using rpm. Then you can proceed with the install of your application. Be warned, that this is cheating. Future dnf upgrade
will not update this module, you will have to take care of that yourself.