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

Posted on

Solving problem is about exposing yourself to as many situations as possible like How do I install a Python package with a .whl file? and practice these strategies over and over. With time, it becomes second nature and a natural way you approach any problems in general. Big or small, always start with a plan, use other strategies mentioned here till you are confident and ready to code the solution.
In this post, my aim is to share an overview the topic about How do I install a Python package with a .whl file?, which can be followed any time. Take easy to follow this discuss.

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

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.

But how do I install .whl files?


  • I’ve found documents on wheel, but they don’t seem so staightforward in explaining how to install .whl files.
  • This question is a duplicate with this question, which wasn’t directly answered.
Asked By: e9t


Answer #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-dirsome-file.whl) use the following command line parameters —

pip install C:/some-dir/some-file.whl
Answered By: kpierce8

Answer #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
Answered By: Burhan Khalid

Answer #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

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).

Answered By: elachell

Answer #4:

I am in the same boat as the OP.

Using a Windows command prompt, from directory:

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:Python34Scripts>, 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.

Answered By: Patrick

Answer #5:

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

Answered By: Steel

Answer #6:

On Windows you can’t just upgrade using pip install --upgrade pip, because the pip.exe is in use and there would be an error replacing it. Instead, you should upgrade pip like this:

easy_install --upgrade pip

Then check the pip version:

pip --version

If it shows 6.x series, there is wheel support.

Only then, you can install a wheel package like this:

pip install your-package.whl
Answered By: Rockallite

Answer #7:

To be able to install wheel files with a simple doubleclick on them you can do one the following:

1) Run two commands in command line under administrator privileges:

assoc .whl=pythonwheel
ftype pythonwheel=cmd /c pip.exe install "%1" ^& pause

2) Alternatively, they can be copied into a wheel.bat file and executed with ‘Run as administrator’ checkbox in the properties.

PS pip.exe is assumed to be in the PATH.


(1) Those can be combined in one line:

assoc .whl=pythonwheel& ftype pythonwheel=cmd /c pip.exe install -U "%1" ^& pause

(2) Syntax for .bat files is slightly different:

assoc .whl=pythonwheel& ftype pythonwheel=cmd /c pip.exe install -U "%%1" ^& pause

Also its output can be made more verbose:

@assoc .whl=pythonwheel|| echo Run me with administrator rights! && pause && exit 1
@ftype pythonwheel=cmd /c pip.exe install -U "%%1" ^& pause || echo Installation error && pause && exit 1
@echo Installation successfull & pause

see my blog post for details.

Answered By: axil

Answer #8:


To avoid having to download such files, you can try:

pip install --use-wheel pillow

For more information, see this.

Answered By: andyw

Leave a Reply

Your email address will not be published.