Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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.

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

But how do I install .whl files?

Notes

  • 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.
like image 586
e9t Avatar asked Jan 11 '15 08:01

e9t


People also ask

What is .WHL file in Python?

A Python . whl file is essentially a ZIP ( . zip ) archive with a specially crafted filename that tells installers what Python versions and platforms the wheel will support. A wheel is a type of built distribution.

How do I open a .WHL file?

If you cannot open your WHL file correctly, try to right-click or long-press the file. Then click "Open with" and choose an application. You can also display a WHL file directly in the browser: Just drag the file onto this browser window and drop it.

How do I install WHL file without pip?

whl files are just zip archives, so you can just extract their content and play with libraries path variable to make it work.

How to open WHL file in Python 3?

There's a slight difference between accessing the .whl file in python2 and python3. In python3, you need to install wheel first and then you can access .whl files. Show activity on this post. In-case if you unable to install specific package directly using PIP.

How do I install the WHL package?

1) Download the .WHL package install file. 2) Make Sure path [C:\Progra~1\Python27\Scripts] is in the system PATH string. This is for using both [pip.exe] and [easy-install.exe]. 3) Make sure the latest version of pip.EXE is now installed. At this time of posting: 4) Run pip.EXE in an Admin command shell.

How do I Find my Python package?

If your package is not present in PyPI, you can search for Python package on unofficial sites. After you download a file, you can use a file archiver, such as 7zip and look inside it. You will notice that the wheel consists of many py, txt, json, dll, and exe files.

How do I install a WHL file using pip?

You can install the .whl file, using pip install filename. Though to use it in this form, it should be in the same directory as your command line, otherwise specify the complete filename, along with its address like pip install C:SomePAthfilename.


2 Answers

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 
like image 157
kpierce8 Avatar answered Oct 27 '22 12:10

kpierce8


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 
like image 26
Burhan Khalid Avatar answered Oct 27 '22 12:10

Burhan Khalid