Up to now we installed psutil via our custom pypi server.
Now we have a new environment where we should not install gcc.
Now the old way (pip starts gcc during install) does not work any more.
The context:
I see these alternatives:
Create a RPM. Since we already run our virtualenv with --system-site-packages
this works. This forces all virtualenvs on the server to use the same version of psutil
. But this would be no big problem.
I have never used that.
Use a tool like cx_freeze
. I have never done this before.
I guess there are other, maybe better, ways to solve this.
psutil
is just an example in this case. The same question comes up for other python packages containing c-extensions. Imagine there are no RPMs here yet.
The most idiomatic way is to use wheels. In fact, your use case is one of the reasons why the wheel format was created.
Building a platform wheel is easy:
python setup.py bdist_wheel
You might get an error "invalid command 'bdist_wheel'". In this case you have to install the wheel
package:
pip install wheel
After building the wheel, it is in e.g. dist/psutil-4.2.0-cp27-cp27mu-linux_x86_64.whl
. You can install it by:
pip install dist/psutil-4.2.0-cp27-cp27mu-linux_x86_64.whl
In general, installing and using the wheel only works on a system which is binary-compatible. As this is not guaranteed across different Linux distributions and versions, there are restrictions when uploading wheels to the central PyPI. These restrictions don't apply when running your own PyPI server.
You can upload the wheel to your custom PyPI by:
python setup.py bdist_wheel upload --repository <url-to-custom-pypi>
And install it from your custom PyPI by e.g.:
pip install --index-url <url-to-custom-pypi> psutil
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With