I am trying to build an RPM package for some Python module (actually its graph-tool: https://git.skewed.de/count0/graph-tool/)

The question is: what do I have to put to the Requires section?

If I, say, put 'Requires: python36' it would be redundant for the environments that use Conda (and the package itself should work AFAIK since Conda sees global packages by default).

But if I don't put that Requires the package becomes broken until I install dependency.

The same question is about numpy - should it be 'Requires: python36-numpy' or not?

What is correct RPM and Pythonic way to do?

  • Isn't question more for StackOverflow that Unix ? – mrc02_kr Oct 24 '18 at 9:23
  • Well, its about packaging, not coding. I see few similar questions here. Do you think it deserves to be moved? – Anton Oct 24 '18 at 10:04
  • It does not appear to be a programming question, it appears to be a packaging question, and I think belongs here at U&L. – Jeff Schaller Oct 24 '18 at 10:05

You should requires everything what this package directly requires. If this package use numpy then you should:

Requires: python3-numpy


Requires: python2-numpy

It does not matter if some other packages specify that dependency too. The package manager will resolve it. You must be responsible to specify your dependence. The requirements of others packages may change and then your package may stop working if you do not list all your requirements.

For full python packaging guidelines see https://fedoraproject.org/wiki/Packaging:Python

  • I see your point, but as my experience tells me such approach may create problems in real environment. Say, I am building a Python library that requires Scipy in runtime, but doesnt care too much about its version. When I put 'Requires' I stick to the version in the dependent package (which is usually updated much slower than, say, pip package) and – Anton Oct 25 '18 at 7:57
  • ... prevent upgrading it using pip (actually not, but upgrading will mess RPM files). I expect your answer "If you are going to use pip why are you building RPM then?", but as I see the situation when some Python libs are available as RPMs and the others by pip or conda is not uncommon. – Anton Oct 25 '18 at 8:04
  • You do not need to specify version in Requires. And it is easy to create rpm from PYPI using pyp2rpm. – msuchy Oct 25 '18 at 21:21

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.