Szabolcs Dombi
Szabolcs Dombi

Reputation: 5783

Python Wheels on linux (how? and why?)

I know that wheels are binary version of a module uploaded on PyPI.

with pip install

I tried to add wheels to my package as well. But I am only able to upload wheels for windows.

Note: I know a bit about Fedora rpm packages. I am interested now in wheels on Ubuntu.

Upvotes: 12

Views: 8154

Answers (1)

selurvedu
selurvedu

Reputation: 501

Why do some packages provide wheels for Linux platform?

Why shouldn't they, as long as source distributions are available as well? :)

Your question is not clear. If you meant

Why do some packages provide platform-specific wheels for Linux platform instead of platfom-independent ones?

then take a look at this question and its answers. If not, please clarify your question.


On Ubuntu: I should get the source distribution of the package BUT in some cases I get wheels.

Try using:

pip install --no-binary :all: somepackage

This should make pip download a source distribution if it exists on PyPI. I don't know why there are no source packages for PyQt5 on PyPI, probably because they are not installable with pip and need a whole toolchaing for compilation.


Is this okay? Providing binaries instead of the source?

It's okay as long as you provide both binaries and the source. I suggest you doing so.


Why I cannot provide wheels?

Try python setup.py bdist_wheel. You need to install wheel package (on PyPI) to make it work. If your package supports both Python 2 and 3 and contains no C extensions, append the --universal option to make a "universal wheel".

Replace bdist_wheel with sdist to make a source distribution. It will create an archive in dist directory.

sdist creates the archive of the default format for the current platform. The default format is a gzip’ed tar file (.tar.gz) on Unix, and ZIP file on Windows.

You can specify as many formats as you like using the --formats option, for example:

python setup.py sdist --formats=gztar,zip

to create a gzipped tarball and a zip file

(Quote from https://docs.python.org/3/distutils/sourcedist.html)


More info about packaging and wheels is available here: https://packaging.python.org/distributing/#packaging-your-project

Upvotes: 10

Related Questions