How do I install a Python package with a .whl file?

Python Programming

Question or problem about Python programming:

I’m having trouble installing a Python package on my Windows machine, and would like to install it with Christoph Gohlke’s Window binaries. (Which, to my experience, alleviated much of the fuss for many other package installations). However, only .whl files are available.

http://www.lfd.uci.edu/~gohlke/pythonlibs/#jpype

But how do I install .whl files?

How to solve the problem:

Solution 1:

I just used the following which was quite simple. First open a console then cd to where you’ve downloaded your file like some-package.whl and use

pip install some-package.whl

Note: if pip.exe is not recognized, you may find it in the “Scripts” directory from where python has been installed. If pip is not installed, this page can help:
How do I install pip on Windows?

Note: for clarification
If you copy the *.whl file to your local drive (ex. C:\some-dir\some-file.whl) use the following command line parameters —

pip install C:/some-dir/some-file.whl

Solution 2:

First, make sure you have updated pip to enable wheel support:

pip install --upgrade pip

Then, to install from wheel, give it the directory where the wheel is downloaded. For example, to install package_name.whl:

pip install --use-wheel --no-index --find-links=/where/its/downloaded package_name

Solution 3:

There are several file versions on the great Christoph Gohlke’s site.

Something I have found important when installing wheels from this site is to first run this from the Python console:

import pip
print(pip.pep425tags.get_supported())

so that you know which version you should install for your computer. Picking the wrong version may fail the installing of the package (especially if you don’t use the right CPython tag, for example, cp27).

Solution 4:

I am in the same boat as the OP.

Using a Windows command prompt, from directory:

C:\Python34\Scripts>
pip install wheel

seemed to work.

Changing directory to where the whl was located, it just tells me ‘pip is not recognized’. Going back to C:\Python34\Scripts>, then using the full command above to provide the ‘where/its/downloaded’ location, it says Requirement 'scikit_image-...-win32.whl' looks like a filename, but the filename does not exist.

So I dropped a copy of the .whl in Python34/Scripts, ran the exact same command over again (with the --find-links= still going to the other folder), and this time it worked.

Solution 5:

You have to run pip.exe from the command prompt on my computer.
I type C:/Python27/Scripts/pip2.exe install numpy

Hope this helps!