How to use Wheels for storing PIP requirements

Using Wheels, we can easily store all the Python modules from our project into a compressed file or local folder. This will make the installation of the modules in new environments considerably faster than just using pip install from repositories.

Store requirements in wheels

Running the following command will store all your project requirements into the folder /sites/my_app/wheelhouse:

pip wheel /sites/my_app --wheel-dir=wheelhouse -r requirements.txt

Install requirements from stored wheels

Once you have all the wheels created on /sites/my_app/wheelhouse, you can install the requirements into a new project just running the following command:

pip install --no-index --find-links=/sites/my_app/wheelhouse -r requirements.txt

Important

Please note that Wheels created for OS X may not work in Linux (and the other way around), because some modules use different binaries depending on the OS.

Leave a Reply

Your email address will not be published. Required fields are marked *