Reputation: 16422
I'm trying to install a Python package on Windows, using Christoph Gohlke's Windows binaries here:
http://www.lfd.uci.edu/~gohlke/pythonlibs/#jpype
The package is made available here as a .whl
file. How do I install that?
Upvotes: 1290
Views: 2670328
Reputation: 117
I resolved this in next steps:
Upvotes: 4
Reputation: 1874
Theoretically:
Because wheel
is a built distribution
spec ie, no dependency on a build system and because it's a ZIP-format archive, it just has to be unpacked to the target location in-order to be used.
While pip install *.wheel
adds extra features, we can also unzip (using a standard archive tool eg: 7zip) the .whl file into site-packages
directory to use the package.
https://packaging.python.org/specifications/binary-distribution-format/
Upvotes: 3
Reputation: 2584
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.
Python3
pip install package.whl
OR
pip install wheel
And then by using wheel
wheel unpack some-package.whl
Python2
pip install some-package.whl
Upvotes: 29
Reputation: 174700
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
Upvotes: 95
Reputation: 896
Download the package (.whl).
Put the file inside the script folder of python directory
C:\Python36\Scripts
Use the command prompt to install the package.
C:\Python36\Scripts>pip install package_name.whl
Upvotes: 3
Reputation: 69
I would be suggesting you the exact way how to install .whl file. Initially I faced many issues but then I solved it, Here is my trick to install .whl files.
Follow The Steps properly in order to get a module imported
cd c:\python 3.7
3.Now, enter the command written below
>py -3.7(version name) -m pip install (file name).whl
Click enter and make sure you enter the version you are currently using with correct file name.
Once you press enter, wait for few minutes and the file will be installed and you will be able to import the particular module.
In order to check if the module is installed successfully, import the module in idle and check it.
Thank you:)
Upvotes: 4
Reputation: 184
What I did was first updating the pip by using the command:
pip install --upgrade pip
and then I also installed wheel by using command: pip install wheel
and then it worked perfectly Fine.
Hope it works for you I guess.
Upvotes: 3
Reputation: 5716
On the MacOS, with pip
installed via MacPorts into the MacPorts python2.7, I had to use @Dunes solution:
sudo python -m pip install some-package.whl
Where python
was replaced by the MacPorts python in my case, which is python2.7
or python3.5
for me.
The -m
option is "Run library module as script" according to the manpage.
(I had previously run sudo port install py27-pip py27-wheel
to install pip
and wheel
into my python 2.7 installation first.)
Upvotes: 4
Reputation: 6564
In-case if you unable to install specific package directly using PIP.
You can download a specific .whl
(wheel) package from - https://www.lfd.uci.edu/~gohlke/pythonlibs/
CD (Change directory) to that downloaded package and install it manually by -
pip install PACKAGENAME.whl
ex:
pip install ad3‑2.1‑cp27‑cp27m‑win32.whl
Upvotes: 6
Reputation: 1062
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:\Some\PAth\filename
.
Also make sure the .whl file is of the same platform as you are using, do a python -V
to find out which version of Python you are running and if it is win32 or 64, install the correct version according to it.
Upvotes: 5
Reputation: 2687
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).
Upvotes: 25
Reputation: 275
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.
Upvotes: 24
Reputation: 1697
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.
Update:
(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.
Upvotes: 12
Reputation: 20478
New Python users on Windows often forget to add Python's \Scripts directory to the PATH variable during the installation. I recommend to use the Python launcher and execute pip as a script with the -m
switch. Then you can install the wheels for a specific Python version (if more than one are installed) and the Scripts directory doesn't have to be in the PATH. So open the command line, navigate (with the cd
command) to the folder where the .whl file is located and enter:
py -3.6 -m pip install your_whl_file.whl
Replace 3.6
by your Python version or just enter -3
if the desired Python version appears first in the PATH. And with an active virtual environment: py -m pip install your_whl_file.whl
.
Of course you can also install packages from PyPI in this way, e.g.
py -3.6 -m pip install pygame
Upvotes: 4
Reputation: 169
You have to run pip.exe from the command prompt on my computer.
I type C:/Python27/Scripts/pip2.exe install numpy
Upvotes: 16
Reputation: 304
I downloaded NumPy from here https://pypi.python.org/pypi/numpy
https://pypi.python.org/packages/d7/3c/d8b473b517062cc700575889d79e7444c9b54c6072a22189d1831d2fbbce/numpy-1.11.2-cp35-none-win32.whl#md5=e485e06907826af5e1fc88608d0629a2
PS C:\Program Files (x86)\Python35-32> .\python -m pip install C:/Users/MyUsername/Documents/Programs/Python/numpy-1.11.2-cp35-none-win32.whl
Processing c:\users\MyUsername\documents\programs\numpy-1.11.2-cp35-none-win32.whl
Installing collected packages: numpy
Successfully installed numpy-1.11.2
PS C:\Program Files (x86)\Python35-32>
PS.: I installed it on Windows 10.
Upvotes: 3
Reputation: 16927
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
Upvotes: 1522
Reputation: 16945
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
Upvotes: 13