Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to avoid rebuilding existing wheels when using pip?

With pip 1.5.X, we can use pip wheel to build and cache a wheel of a package, then use --use-wheel with pip install to install from the cached wheel.

I'm trying to use this feature in a environment setup script. This is what I'm trying:

pip wheel --wheel-dir=/tmp Cython==0.19.2
pip install Cython==0.19.2 --use-wheel --no-index --find-links=/tmp

I'm expecting pip wheel to check if the wheel already exists before building it. But it seems to ignore the existing wheel and build every single time.

Is it possible to avoid this?

like image 440
satoru Avatar asked Mar 12 '14 09:03

satoru


People also ask

What is building wheel in pip?

If you've installed a Python package using pip , then chances are that a wheel has made the installation faster and more efficient. Wheels are a component of the Python ecosystem that helps to make package installs just work. They allow for faster installations and more stability in the package distribution process.

Should I pip install wheel?

According to the Python Packaging Authority (PyPA), wheels are the preferred way that pip installs Python modules from the Python Package Index (PyPI) because they're smaller, faster to install, and more efficient than building the package from the source code contained in an sdist.

When you use pip to install a package that requires one or more dependencies?

Pip relies on package authors to stipulate the dependencies for their code in order to successfully download and install the package plus all required dependencies from the Python Package Index (PyPI). But if packages are installed one at a time, it may lead to dependency conflicts.


1 Answers

I've been using the option

    --find-links=/tmp

where /tmp is the wheelhouse. This seems to actually check the wheelhouse and not re-download things. Using your example, try this:

    pip wheel --find-links=/tmp --wheel-dir=/tmp Cython==0.19.2
like image 112
Nick Loadholtes Avatar answered Oct 06 '22 09:10

Nick Loadholtes