packaging.python.org icon indicating copy to clipboard operation
packaging.python.org copied to clipboard

What happens if both .whl and .tar.gz are indist folder?

Open akshaykanawat opened this issue 6 years ago • 3 comments

If there are two compressed files in dist folder, one is .whl extension and the other has .tar.gz extension i.e. both built and source distribution are created. Now if I install the package on mac os, which one will be installed and why?

akshaykanawat avatar Feb 12 '19 06:02 akshaykanawat

It depends on how you install the package. If you just do pip install /path/to/project/folder or similar, neither one will be installed; pip will instead build a new wheel from the source tree and install that. The only way to install from a file in dist/ is to explicitly specify that file, e.g., pip install /path/to/project/folder/dist/project-0.1.0-py3-none-any.whl.

jwodder avatar Feb 13 '19 17:02 jwodder

If you install using pip install project --find-links dist then pip will prefer the wheel, assuming the version is the same, and that the wheel is valid for the target platform/architecture.

But the question begs, why do you care? For the same version of a given project, the wheel and sdist are expected to give functionally identical results when you install them, so it shouldn't matter to you in any practical sense which pip uses.

pfmoore avatar Feb 13 '19 17:02 pfmoore

I think the question here may come from #598

merwok avatar Jun 19 '20 23:06 merwok