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.
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
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
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).
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.
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
You have to run pip.exe from the command prompt on my computer.
I type C:/Python27/Scripts/pip2.exe install numpy
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
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.
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
EDIT: THIS NO LONGER IS A PART OF PIP
To avoid having to download such files, you can try:
pip install --use-wheel pillow
For more information, see this.
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.
The only way I managed to install NumPy was as follows:
I downloaded NumPy from here
https://pypi.python.org/pypi/numpy
This Module
https://pypi.python.org/packages/d7/3c/d8b473b517062cc700575889d79e7444c9b54c6072a22189d1831d2fbbce/numpy-1.11.2-cp35-none-win32.whl#md5=e485e06907826af5e1fc88608d0629a2
Command execution from Python's installation path in PowerShell
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.
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
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
Make sure your .whl file is kept in the python 2.7/3.6/3.7/.. folder.
Initially when you download the .whl file the file is kept in downloaded folder, my
suggestion is to change the folder. It makes it easier to install the file.
Open command prompt and open the folder where you have kept the file by entering
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:)
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.)
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.
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
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/
Related
I'm on windows and want to use python and a few packages, however, due to our policies it is not possible to have admin rights and any fetch requests done by pip (or any other package manager I'd assume) are being blocked.
So far I've downloaded Python (3.9.6) and "installed" it by manually unzipping and setting the PATH env variable.
I know that packages can be manually downloaded and installed as well using setup.py, however I also do not have setuptools, so is there any way to manually install that?
pip doesn't require admin rights just use it with --user.If you want to avoid using pip here the steps
if the folder has setup.py in it
Download the packages and uncompress if needed open folder
holding shift click open with cmd or powershell
run python setup.py install --user or python3 setup.py install --user
if not present setup.py check the install documentation provided by module.
Have a bit of an issue here. I haven't got admin access to my work computer (working on getting it) so I can't install packages. IT has given me a temporary Admin password but Admin doesn't have internet access.
So I have to download the library itself. I went to
https://github.com/scikit-learn-contrib/imbalanced-learn.git
and downloaded "imbalanced-learn-master.zip"
My question now is - how do I install this on my computer locally? I can "Run as Administrator" anything from the command prompt
First. How You install packages.
If from command line then you can use --user switch
then command will look
pip install --user imbalanced-learn
Other option is to install from wheel file. So download: https://files.pythonhosted.org/packages/eb/aa/eba717a14df36f0b6f000ebfaf24c3189cd7987130f66cc3513efead8c2a/imbalanced_learn-0.6.1-py3-none-any.whl
and then
pip install imbalanced_learn-0.6.1-py3-none-any.whl
or without admin privileges
pip install --user imbalanced_learn-0.6.1-py3-none-any.whl
Third option is to install from source (as you asked). You need to unpack zip file and in terminal go to main folder (with setup.py) and then
pip install .
But you also need to install package dependencies. You can found them in setup.py
For current master it is
INSTALL_REQUIRES = [
'numpy>=1.11',
'scipy>=0.17',
'scikit-learn>=0.22',
'joblib>=0.11'
]
You need to use the pip (or any package installer) through your corporate proxy.
pip install package_name --proxy=http://corporate-proxy.company_website.com:8080
I have spent hours trying to install a new package for Python (XlsxWriter) but Ican't figure out how to do it. (I am using Python 2.7.10)
I download the two files from here and copied them into my main Python directory:
https://pypi.python.org/pypi/XlsxWriter
In their documentation they recommended using
'pip install XlsxWriter' to install.
I followed the instructions to install pip from here (downloading file and running 'python get-pip.py'):
https://pip.pypa.io/en/latest/installing/#install-pip
That seemed to work but when I type 'pip install XlsxWriter' it still says "'pip' is not recognized as an internal or external command" e.t.c.
Also, as I had downloaded a tarball, I tried the line tar -zxvf XlsxWriter-0.7.7.tar.gz but it just says tar isn't a recognised command again.
If I load python in the command prompt by just typing 'python' and then try the above commands it just says invalid syntax
Where am I going wrong?
Sorry this is so simple but I have no one to ask in real life and have followed the instructions to install python packages in a few places but still can't get it to work.
try python -m pip install XlsxWriter
invoke it as a python module... Your path may not be properly set to just recognize pip
Add your python installation bin folder to your environment path
The problem is your pip installation. You have make pip work first:
http://pip.readthedocs.org/en/stable/installing/
Then you can do pip install XlsxWriter without downloading the package first.
Alternatively you can unpack the archive (tar -xvf XlsxWriter-0.7.7.tar.gz on Linux/Mac) and then do python setup.py install.
My familiarity with pip ends up with the ability to do: 'pip install', 'pip uninstall', and 'pip list' - with the name of the package I want to install as the single argument.
This limited knowledge carried me so far, to the extent I'm able to install most of the simple packages, and sometime, when I'm luck, I'm even able to install packages that requires compilation. This is all magic for me.
I'm now facing a situation where I need to do a little bit of editing to the C file (side note: this seems to be a known workaround for the 'netifaces' package - which everyone seems to be in peace with. By itself this is an amazing phenomena).
So I would like to break the installation into smaller steps:
Download the egg file (I've figured out this one: pip install --download).
Unzip or otherwise unpackage the package file, to the point I can edit individual
Do my custom modification.
Do the build
Do the installation.
Other than step #1, I don't know how to proceed.
Modern pip (Since 1.10)
Use pip download:
pip download mypackage
pip 1.5 - 1.9
Use pip install -d
pip install -d . --allow-external netifaces --allow-unverified netifaces netifaces
tar xzf netifaces-0.8.tar.gz # Unpack the downloaded file.
cd netifaces-0.8
Now do your modifications and continue:
pip install .
Old pip (Before 1.5)
Install the package with --no-install option; with --no-install option, pip downloads and unpacks all packages, but does not actually install the package.
pip install --no-install netifaces
Change to the build directory. If you don't know where is the build directory, issue above command again, then it display the location.
cd /tmp/pip_build_falsetru/netifaces
Do the custom modification.
Install the package using pip install . (add --no-clean option if you want keep the build directory) or python setup.py install.
sudo pip install --no-clean .
First, download the source to 0.8 from the author's home page (there's no direct download link from PyPI, for some reason). Go to the directory where you downloaded it and unzip it:
tar zxvf netifaces-0.8.tar.gz
Enter the netifaces-0.8/ directory and edit netifaces.c with your favorite editor. Save the file. Then, build the module:
python setup.py build
and install it:
sudo python setup.py install
To test, first leave the directory, then start your python interpreter and import netifaces to see if it works.
Good luck!
Download your selected package, extract the files,edit what you want. Then, open the directory with your terminal\cmd and run:
python setup.py install
Depending on your os you might need to add a little sudo to the beginning of this command (if you intend to install globally on a Unix machine)
You could just download the source from pypi, edit it and use setup.py buid, setup.py install
Can someone give me a guide for morons? I am somewhat out of my depth here. So far I have downloaded xlrd 0.9.2 and tried to follow the readme, but neither I nor ctrl-f can find the installer mentioned.
download
The current version of xlrd can be found here:
https://pypi.python.org/pypi/xlrd
extract the folder somewhere
go to the folder you extracted to ... find setup.py
open command window (start -> run-> cmd)
cd into the directory with setup.py
type: python setup.py install
you may need setup tools (which can be gotten here https://pypi.python.org/pypi/setuptools#installation-instructions)
If windows this should work.
Browser to "folder with python"\scripts Open cmd here (shift + right click and and it should be an option in the context menu.)
type inn: easy_install.exe xlrd
It should download and install if for you.
I don't think that it is really necessary for you to download the file from pypi because you have the following easy option:
$ pip install xlrd
As simple as that!
You can install it using pip, easy_install, virtualenv or even install the module manually.
The method of downloading the file(s) and installing is called manual installation.
You can do that after you have unzipped the folder and then cd to the folder and do the following:
$ python setup.py install
If you have installed pip which is available with python installation file; then just do the following steps:
Open Command Line
Type "pip install xlrd"
Hope it will work