How can I install pip on Windows?
Solution 1
Python 2.7.9+ and 3.4+
Good news! Python 3.4 (released March 2014) and Python 2.7.9 (released December 2014) ship with Pip. This is the best feature of any Python release. It makes the community's wealth of libraries accessible to everyone. Newbies are no longer excluded from using community libraries by the prohibitive difficulty of setup. In shipping with a package manager, Python joins Ruby, Node.js, Haskell, Perl, Go—almost every other contemporary language with a majority open-source community. Thank you, Python.
If you do find that pip is not available when using Python 3.4+ or Python 2.7.9+, simply execute e.g.:
py -3 -m ensurepip
Of course, that doesn't mean Python packaging is problem solved. The experience remains frustrating. I discuss this in the Stack Overflow question Does Python have a package/module management system?.
And, alas for everyone using Python 2.7.8 or earlier (a sizable portion of the community). There's no plan to ship Pip to you. Manual instructions follow.
Python 2 ≤ 2.7.8 and Python 3 ≤ 3.3
Flying in the face of its 'batteries included' motto, Python ships without a package manager. To make matters worse, Pip was—until recently—ironically difficult to install.
Official instructions
Per https://pip.pypa.io/en/stable/installing/#do-i-need-to-install-pip:
Download get-pip.py
, being careful to save it as a .py
file rather than .txt
. Then, run it from the command prompt:
python get-pip.py
You possibly need an administrator command prompt to do this. Follow Start a Command Prompt as an Administrator (Microsoft TechNet).
This installs the pip package, which (in Windows) contains ...\Scripts\pip.exe that path must be in PATH environment variable to use pip from the command line (see the second part of 'Alternative Instructions' for adding it to your PATH,
Alternative instructions
The official documentation tells users to install Pip and each of its dependencies from source. That's tedious for the experienced and prohibitively difficult for newbies.
For our sake, Christoph Gohlke prepares Windows installers (.msi
) for popular Python packages. He builds installers for all Python versions, both 32 and 64 bit. You need to:
For me, this installed Pip at C:\Python27\Scripts\pip.exe
. Find pip.exe
on your computer, then add its folder (for example, C:\Python27\Scripts
) to your path (Start / Edit environment variables). Now you should be able to run pip
from the command line. Try installing a package:
pip install httpie
There you go (hopefully)! Solutions for common problems are given below:
Proxy problems
If you work in an office, you might be behind an HTTP proxy. If so, set the environment variables http_proxy
and https_proxy
. Most Python applications (and other free software) respect these. Example syntax:
http://proxy_url:port
http://username:password@proxy_url:port
If you're really unlucky, your proxy might be a Microsoft NTLM proxy. Free software can't cope. The only solution is to install a free software friendly proxy that forwards to the nasty proxy. http://cntlm.sourceforge.net/
Unable to find vcvarsall.bat
Python modules can be partly written in C or C++. Pip tries to compile from source. If you don't have a C/C++ compiler installed and configured, you'll see this cryptic error message.
Error: Unable to find vcvarsall.bat
You can fix that by installing a C++ compiler such as MinGW or Visual C++. Microsoft actually ships one specifically for use with Python. Or try Microsoft Visual C++ Compiler for Python 2.7.
Often though it's easier to check Christoph's site for your package.
Solution 2
-- Outdated -- use distribute, not setuptools as described here. --
-- Outdated #2 -- use setuptools as distribute is deprecated.
As you mentioned pip doesn't include an independent installer, but you can install it with its predecessor easy_install.
So:
- Download the last pip version from here: http://pypi.python.org/pypi/pip#downloads
- Uncompress it
- Download the last easy installer for Windows: (download the .exe at the bottom of http://pypi.python.org/pypi/setuptools ). Install it.
- copy the uncompressed pip folder content into
C:\Python2x\
folder (don't copy the whole folder into it, just the content), because python command doesn't work outsideC:\Python2x
folder and then run:python setup.py install
- Add your python
C:\Python2x\Scripts
to the path
You are done.
Now you can use pip install package
to easily install packages as in Linux :)
Solution 3
2014 UPDATE:
1) If you have installed Python 3.4 or later, pip is included with Python and should already be working on your system.
2) If you are running a version below Python 3.4 or if pip was not installed with Python 3.4 for some reason, then you'd probably use pip's official installation script get-pip.py
. The pip installer now grabs setuptools for you, and works regardless of architecture (32-bit or 64-bit).
The installation instructions are detailed here and involve:
To install or upgrade pip, securely download get-pip.py.
Then run the following (which may require administrator access):
python get-pip.py
To upgrade an existing setuptools (or distribute), run
pip install -U setuptools
I'll leave the two sets of old instructions below for posterity.
OLD Answers:
For Windows editions of the 64 bit variety - 64-bit Windows + Python used to require a separate installation method due to ez_setup, but I've tested the new distribute method on 64-bit Windows running 32-bit Python and 64-bit Python, and you can now use the same method for all versions of Windows/Python 2.7X:
OLD Method 2 using distribute:
- Download distribute - I threw mine in
C:\Python27\Scripts
(feel free to create aScripts
directory if it doesn't exist. - Open up a command prompt (on Windows you should check out conemu2 if you don't use PowerShell) and change (
cd
) to the directory you've downloadeddistribute_setup.py
to. - Run distribute_setup:
python distribute_setup.py
(This will not work if your python installation directory is not added to your path - go here for help) - Change the current directory to the
Scripts
directory for your Python installation (C:\Python27\Scripts
) or add that directory, as well as the Python base installation directory to your %PATH% environment variable. - Install pip using the newly installed setuptools:
easy_install pip
The last step will not work unless you're either in the directory easy_install.exe
is located in (C:\Python27\Scripts would be the default for Python 2.7), or you have that directory added to your path.
OLD Method 1 using ez_setup:
Download ez_setup.py and run it; it will download the appropriate .egg file and install it for you. (Currently, the provided .exe installer does not support 64-bit versions of Python for Windows, due to a distutils installer compatibility issue.
After this, you may continue with:
- Add
c:\Python2x\Scripts
to the Windows path (replace thex
inPython2x
with the actual version number you have installed) - Open a new (!) DOS prompt. From there run
easy_install pip
Solution 4
2016+ Update:
These answers are outdated or otherwise wordy and difficult.
If you've got Python 3.4+ or 2.7.9+, it will be installed by default on Windows. Otherwise, in short:
- Download the pip installer: https://bootstrap.pypa.io/get-pip.py
- If paranoid, inspect file to confirm it isn't malicious (must b64 decode).
- Open a console in the download folder as Admin and run
get-pip.py
. Alternatively, right-click its icon in Explorer and choose the "run as Admin...".
The new binaries pip.exe
(and the deprecated easy_install.exe
) will be found in the "%ProgramFiles%\PythonXX\Scripts"
folder (or similar), which is often not in your PATH
variable. I recommend adding it.
Solution 5
Python 3.4, which was released in March 2014, comes with pip
included:
http://docs.python.org/3.4/whatsnew/3.4.html
So, since the release of Python 3.4, the up-to-date way to install pip on Windows is to just install Python.
The recommended way to use it is to call it as a module, especially with multiple python distributions or versions installed, to guarantee packages go to the correct place:
python -m pip install --upgrade packageXYZ
https://docs.python.org/3/installing/#work-with-multiple-versions-of-python-installed-in-parallel
mit
Updated on July 08, 2022Comments
-
mit almost 2 years
pip
is a replacement foreasy_install
. But should I installpip
usingeasy_install
on Windows? Is there a better way?-
Civilian over 12 yearsFrom PyCon 2011: blip.tv/pycon-us-videos-2009-2010-2011/… The dirty secret is that pip is a wrapper for easy_install :)
-
Liam Dawson almost 12 yearsLike how apt-get uses dpkg at the core - but it doesn't make it any less useful!
-
Colonel Panic over 11 yearsRuby ships with Gem and Nodejs with Npm, giving users full-featured package management out the box. I for one am envious. stackoverflow.com/a/11453972/284795
-
Mike 'Pomax' Kamermans about 11 yearsAs an extra comment - open the command prompt with administrator rights. If you use UAC (and you probably should be) you'll need admin rights in order for easy_install to install pip.
-
Cody Piersall over 9 yearsThis is the most popular question with the Windows tag on Stackoverflow. I'm so glad pip ships with Python now.
-
ccpizza over 6 yearsfor recent versions of python2 and python3 you can just use
python -m ensurepip
-
Admin over 5 yearsOn Windows you could use Anaconda installer instead of pip
-
Hydro almost 4 yearsIf you install Python you already have "pip". You use "pip" to install packages for python. You use "pip" in Command Prompt. For example I wan't to install pygame I write there: "pip install pygame". Hope this is a good answer and solved your problem
-
Dr. Manuel Kuehner about 2 yearsWith a current official Python installation, you already have pip, see youtu.be/PUFnDSdk1jQ for example.
-
-
Sridhar Ratnakumar about 13 yearsIt must be noted that ActivePython also includes pip and easy_install. PyPM is a binary package manger, while pip/easy_install are, essentially, source package managers. See code.activestate.com/help/faq/…
-
Yoo Matsuo about 13 yearsWhen run the command "python setup.py install", if you got "error: pip.egg-info\PKG-INFO: Permission denied", then try to remove the read only attribute on the uncompressed pip directory.
-
Chris almost 13 yearsIf you install a 64-bit version of python, setuptools will not detect your python executable. I found some binaries here that will, though (unofficial): lfd.uci.edu/~gohlke/pythonlibs
-
Mridang Agarwalla over 12 yearsOnce I've installed
pip
usingeasy_install
can I removesetuptools
bypip uninstall setuptools
? Is this okay or would it lead to issues later on? -
emmanuel honore over 12 yearsFor Win 64, you can download peak.telecommunity.com/dist/ez_setup.py. Open pythonwin as Adminstrator and execute it. After that open the windows command line also as Admin and do step 4 and 5.
-
Chelonian about 12 yearsI did this and then tried to use "pip install package" at the DOS prompt and got "pip is not recognized as an internal or external command, operable program or batch file."
-
Adrián Deccico about 12 years@Chelonian seems like pip command is not in the path. Check step 5 and remember you have to start a new command window after modifying the path. Also restarting your computer will help.
-
David Fraser almost 12 yearsAh, I missed that there's a
launcher.c
that needs manual compiling... adjusted and rebuiltdistribute
- that does mean that this iswin32
-only... -
Elliot Cameron almost 12 yearsOn Windows 64-bit, you have to fix the Python installation. Copy all of the
HKEY_LOCAL_MACHINE\SOFTWARE\Python
registry key into theHKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node
key. You can do this by exporting thePython
key, modifying the paths, and merging it back in. -
Jitendra Vyas almost 12 years
go to the uncompressed pip directory and: python setup.py install
where to type this commandpython setup.py install
-
Jitendra Vyas almost 12 years@Rafe Kettlet - When I try to install pip in Activepython it gives this error
-
nicolas over 11 yearsSo the install is easyinstall, then pip, then virtualenv, then virtualenvwrapper , then configure independents environments. with script modif in the middle for dealing with proxies... aaarrrgg
-
AndrewPK over 11 years@nicolas Yeah, easyinstall is just an outdated interface to setuptools. Pip is awesome, and virtualenv offers the kind of control that you don't get in many other languages without WAY more hackish tactics; perl being the only comparable exception. Ruby has gemsets, but in order to easily swap out Rubies, it's recommended to use either rbenv or rvm - both of which have always felt somewhat hackish to me (though they work beautifully once set up properly).
-
Derek Veit over 11 yearsYou do not need to copy the pip folder content into your c:\python2x folder as described in step 4. You can just add c:\python2x to your PATH environment variable or otherwise just use the full path when running python.
-
Pierre Carbonnelle over 11 yearsThis exact procedure is automated by pip for windows.
-
dbjohn over 11 years+1, help note for noobs like me: don't type "python2x" literally in the windows path environment variable. Replace x with the python version you have, e.g. python27
-
Gringo Suave over 11 yearsI believe you'll still need distribute or setuptools.
-
Pyderman about 11 yearsAs an alternative to step 4, simply run setup.py from wherever pip was dowloaded to e.g. from firefox C:\Users\Tony\Downloads\pip-1.2.1\pip-1.2.1
-
joshuanapoli about 11 yearsOn my system, I also needed to add C:\Python33\Scripts to the PATH.
-
Gringo Suave about 11 yearsCurl isn't shipped with windows.
-
Gringo Suave about 11 yearsThis should work, but it is worth noting that this could be extremely dangerous if one doesn't have the expertise or bother to inspect the url-file before executing such a command.
-
h--n about 11 years@GringoSuave Curl is so commonly used, everyone should have it. If that's not preferred, these two scripts can be just downloaded with any browser directly.
-
Fernando Macedo about 11 yearsI think the simplicity is worth the risk. We are talking about a hack at python-distribute.org? There is a similar approach with sublime package control.
-
Gringo Suave about 11 yearsYes, I have checked the distribute URL and it is ok (for now at least). The problem is in the general case where the inexperienced run remote executables on recommendation from a forum. It should come at least with a minimal warning.
-
Fernando Macedo about 11 yearsI agree with you, the real issue is for who execute arbitrary code after read a post. The question is: can you trust me? I'll update the answer to notify the flow of actions being executed. I think that up/down votes can be used as "trust filter" too.
-
matt wilkie about 11 yearsCombine this with @Fernando's answer, stackoverflow.com/a/15294806/14420, for how to do the same without curl.
-
matt wilkie about 11 yearsHere's a pure python adaptation of @h--n answer which uses curl, and the urlib example above by Fernando. It attempts to adapt to py2 or 3 and issues a usage warning about executing arbitrary code: gist.github.com/maphew/5393935
-
DevPlayer about 11 yearsAnd if python is already installed? This caused me nightmares. With python already installed via other means and trying cinst pip just game me errors.
-
marshall almost 11 yearsI installed distribute and pip as above but now I get "error: Unable to find vcvarsall.bat" when I try to use pip.
-
mit almost 11 years@Jitendra - ActivePython already installs pip for you, so there is no need to install it again afterwards.
-
HelpingHand almost 11 yearsWasn't
distribute
deprecated whensetuptools
arrived? -
HelpingHand almost 11 years
-
user1063287 almost 11 yearsdistribute does not seem to be available anymore at url noted (lfd.uci.edu/~gohlke/pythonlibs/#distribute).
-
user1063287 almost 11 yearsfor anyone wanting to know how to install distribute on windows, these were my steps (as installer above isn't available at the moment):
start>accessories>windows powershell>windows powershell (right click and run as administrator)
and then in powershell typePS C:\> python distribute_setup.py
. when i tried to do this in standardcmd
shell, it wouldn't allow me to write the files to disk, hence why i tried powershell as administrator and it worked. -
Mike McMahon almost 11 yearsnote if you already have strawberry perl installed you won't be able to run
pip install <module>
until you've either removed strawberry perl or manually enter the path to python's pip! -
Colonel Panic almost 11 years@MikeMcMahon that happened to me too. Put Python before Perl in your path, so typing
pip
gets you the Python package manager. -
Mike McMahon almost 11 years@ColonelPanic thanks for that bit of info! I wonder though, will that cause any issues with Stawberry Perl?
-
Dave Halter over 10 yearsThis is really the only SANE solution on windows. Not because of
PyPM
, but because it comes withpip
and adds things automatically to thePATH
. -
fatuhoku over 10 yearsChocolatey doesn't seem very robust especially wrt. dependencies.
cinst pip
at the time of writing just assumes easy_install has been installed, which is not necessarily the case. -
charles ross over 10 yearsInstall GitHub for Windows and it customizes your Powershell with many goodies, such as curl.
-
JuanPablo over 10 yearswindows setuptools install pypi.python.org/pypi/setuptools#windows and pip pip-installer.org/en/latest/…
-
CaptainCodeman over 10 yearsI didn't have to do any of this, I just followed the instructions on pip-installer.org/en/latest/installing.html (basically you just write "python ez_setup.py" and then "python get-pip.py")
-
Joris over 10 yearsMD5 checksums of the files: get-pip.py=60a3d165e93999895e26b96681b65090 setuptools-1.3.2.tar.gz=441f2e58c0599d31597622a7b9eb605f
-
Dejell over 10 yearsI don't see scripts folder on my machine I am using python 3.3
-
Philipp Gayret over 10 yearsI've edited the question, to make it work you'll need to have easy_install before you get pip, you can just do
cinst easy.install
-
matt wilkie over 10 yearsas of pip 1.5.1
distribute_setup
is no longer required. So now the answer is just "download get-ip.py and runpython get-pip.py
" -
matt wilkie over 10 yearsAs of pip 1.5.1 (Jan 2014) ez_setup/setuptools/distribute isn't needed ahead of time. If needed get-pip will acquire the requirements as well as pip itself.
-
Dr. Jan-Philip Gehrcke over 10 yearsI can only support this solution, happily used ActivePython for years.
-
Curtis Yallop about 10 yearsGo to pip-installer.org/en/latest/installing.html run "python get-pip.py". It installed setuptools and pip in <10 seconds, no questions. C:\Python27\Scripts\pip.exe
-
drobison about 10 yearsI had trouble with this at first. I think you need to make sure you: 1: Setup your environment path: stackoverflow.com/a/6318188/1674958 2: Restart your command prompt after each command if you run into issues.
-
Mouseroot almost 10 yearsId like to note, i had to use 'python -m pip' to use the module in windows.
-
pitchblack408 over 9 yearsHow do you install pip on windows for Jython? I downloading the installed and it isn't able to install on jython. I am using jython2.7b2
-
Pavel Minaev over 9 yearsGood news for those who run into vsvarsall.bat error message with Python 2.7! aka.ms/vcpython27
-
Andrew almost 9 yearsThis is probably a dumb question. I entered python get-pip.py on a windows prompt but get "python is not recognized as an internal or external command, operable program or batch file." Am I doing something wrong? I have Python 2.7.8 installed. Do I need to change the directory? Thanks.
-
Colonel Panic almost 9 years@Andrew you need add eg.
C:\Python27
to the system PATH (which is where the command prompt looks for programs), follow superuser.com/a/143121/62691 -
Andrew almost 9 yearsThat worked. It installed pip here: C:\Python27\ArcGIS10.3\Lib\site-packages. In Windows prompt I get 'pip is not a recognized as internal....." when I write 'pip help'. I tried adding C:\Python27 and C:\Python27\ArcGIS10.3\Lib\site-packages to the system PATH.
-
Josie Thompson over 8 yearsI'm reallly confused. I have python 2.7.10 and I get 'No module named pip' when I try to install something using 'python -m pip install arbitrary_mod_name' I also have no Scripts folder??
-
Roberto over 8 yearsNote that it also applies to Python 2.7.9
-
matth over 8 yearsPython 2.x is legacy, Python 3.x is the present and future of the language, according to Python2orPython3
-
MattDMo over 8 yearsthat doesn't have anything to do with pip, but it has everything to do with how your development environment is set up, including which environment variables point where, and whether everything is on your
PATH
. Yes, your version of MSVC needs to match the one used to compile Python, but pip is just using what's in the environment. -
Dmitry Rubanovich over 8 years@MattDMo, generally when people ask a question about how to install a package manager, that means they want to know how to also configure it (and its running environment) so that it can install packages. Most people run into trouble when trying to install numpy with PIP because they have a later version of MSVC installed and after pip pulls in the numpy sources, setup.py can't compile it. I stand by my answer.
-
annena over 8 yearsHmm I installed Python 3.4.4 and I could find pip3.exe following the path in this answer, but in cmd
pip
is still not recognized. Can anyone help? -
matth over 8 yearsIn a command prompt, cd to the directory where
pip3.exe
resides and execute for examplepip3 install -U sphinx
. -
Jesper Jensen over 8 yearsJust tried it. "cinst easy.install" fails but "cinst pip" installs easy.install. BTW, Windows 10.
-
gaborous over 8 yearsThis method still works very well as of 02/2016 to install pip (and then nose!) on Python 2.6 on Windows. Indeed, using Gohlke's binaries is no longer an option since he replaced them all by wheels.
-
emmanuel honore about 8 yearsTo start the "build in" pip you have to use
python -m pip
on windows! -
IgorGanapolsky about 8 yearsMakes no sense. I installed Python 3.5.1 and still cannot run pip.
-
IgorGanapolsky about 8 years@Philipp If you run
cinst pip
, it will automatically invoke easy.install -
Dylan Hogg over 7 yearsGood overview of python packaging past and present as of Aug 2016: glyph.twistedmatrix.com/2016/08/python-packaging.html
-
Kyle Delaney over 7 years
'pip' is not recognized as an internal or external command, operable program or batch file.
I have Python 3.5 and I already ranpython -m pip
. How do I use the pip command? -
jkt123 almost 7 years@IgorGanapolsky New versions of Python come with pip installed as a module, and not as an installed executable (at least at the path listed). With Windows 10 and Python 3.6.1, I used
py -m pip install xxx
from the Windows command-prompt successfully. -
Parrybird almost 7 yearsMy gotcha - I was running Python 3.2 which is not officially supported, but an alternative get-pip file is available at bootstrap.pypa.io/3.2/get-pip.py
-
flywire almost 6 yearsYou forgot to mention you don't have firewall issues
-
Lars almost 6 yearsJust installed 'python3' using chocolatery and it included pip by default.
-
Alex - GlassEditor.com over 5 yearsOnly the 32bit python 2.7 installer for windows worked for me.
-
Gaurav about 5 years@Gringo the get-pip.py throws "RuntimeError: Python 3.4 or later is required".
-
Gaurav about 5 yearsOn python 3.3, it throws "RuntimeError: Python 3.4 or later is required"
-
Pedro Lobito about 5 yearsIt may not be available for your OS or python version. I updated the answer, give it a try.
-
Gringo Suave about 5 years@gaurav What Python version do you have? Latest pip may not support 2.6 or 3.0 to 3.3, as those are ancient. Perhaps an older version of pip would.
-
Gaurav about 5 years@GringoSuave python 3.3
-
Ivana almost 5 yearsIt is 2019 and i can confirm the solution by @jkt123 works on windows 10 with python 3.7.
-
john ktejik over 4 yearsHow can they use pip if its not installed??
-
barteks2x about 4 yearsNote for others possibly running into the issue I did: When attempting to use the built-in pip on windows 10, on some systems even running "python -m pip" won't work - it will run but produce no output (same with python3 instead of python). The solution is to run "py -m pip".
-
10 Rep almost 4 years@CaptainCodeman That is until recently. Before, it was ridiculously hard to install pip. I for one can remember.
-
Jon-Eric almost 4 yearsOr
curl -L get-pip.io | python
. -
Abhishek Dujari almost 4 yearsi used chocolatey to install on windows. I am new to this windows as dev environment stuff. I looked at PATH and the python isntall. pip was missing and so was easy_install. Win 10 home, i was able to do the
py -3 -m ensurepip
however it installs as pip3. Now I need to figure out alias on windows. thanks -
Peter Mortensen over 3 yearsCan you make this more specific and add some details?