7

I am trying to install pip on my Windows 10 system. I got the get-pip.py file and ran the command

python get-pip.py

Here's a snapshot of the terminal

$ python get-pip.py
Collecting pip
Using cached 
https://files.pythonhosted.org/packages/46/dc/7fd5df840e
fb3e56c8b4f768793a237ec4ee59891959d6a215d63f727023/pip-19.0.1-py2
.py3-none-any.whl
Collecting setuptools
  Using cached 
https://files.pythonhosted.org/packages/ff/47/1dfa4795e
24fd6f93d5d58602dd716c3f101cfd5a77cd9acbe519b44a0a9/wheel-0.32.3-py2.py3- 
none-any.whl
Installing collected packages: pip, setuptools, wheel
Successfully installed pip-19.0.1 setuptools-40.8.0 wheel-0.32.3

Now when I try to check the version with

pip -V

I get this -

Traceback (most recent call last):
 File "runpy.py", line 193, in _run_module_as_main
 File "runpy.py", line 85, in _run_code
 File "C:\Program Files\Python\python-3.6.3-embed- 
 amd64\Scripts\pip.exe\__main__.py", line 5, in <module>
ModuleNotFoundError: No module named 'pip'

Why is this happening? It JUST said pip installed successfully and when I try to see the version to check if its installed, it says No module named 'pip'

Also, I have included C:/Program/Files/Python/python3/Scripts in the PATH variable.

Please help ! ! ! !

  • try `pip3 -V` also not working? – gameon67 Feb 08 '19 at 04:25
  • @gameon67, same error. :'( no module named 'pip' – Krithika Raghavendran Feb 08 '19 at 04:26
  • python 3 comes with pip so you shouldn't have needed to install it. Also, are you sure you installed python for all users? if not its likely your python 3 is installed at the directory c:/users//appdata/local/programs/python/python36/ – typedef struct James Feb 08 '19 at 04:26
  • @typedefstructJames, if pip is already installed how come it says "command not found" if I try to do "pip -V" ?? – Krithika Raghavendran Feb 08 '19 at 04:28
  • Have you tried to restart your laptop? Or tried any solutions provided [here](https://stackoverflow.com/questions/32639074/why-am-i-getting-importerror-no-module-named-pip-right-after-installing-pip) or [here](https://stackoverflow.com/questions/4750806/how-do-i-install-pip-on-windows?rq=1) ? – Avicenna Wisesa Feb 08 '19 at 04:14
  • Tried to restart the system and checked with pip -V. Still getting the same "No module named 'pip' " error. :( – Krithika Raghavendran Feb 08 '19 at 04:20
  • you would still need to add the correct environment path variable, which is why I asked are you sure its not located in the directory I just named? – typedef struct James Feb 08 '19 at 04:29
  • try `python -m ensurepip` ? – gameon67 Feb 08 '19 at 04:30
  • @typedefstructJames, I just checked C:/users//appdata/local/programs/python/python37/ and python is installed there. So what? I have added python PATH to my environment variables and it is available everywhere to use. – Krithika Raghavendran Feb 08 '19 at 04:31
  • or add `C:\Python34\Scripts` to your PATH – gameon67 Feb 08 '19 at 04:31
  • @gameon67, I have already added Scripts to my PATH. Mentioned that in my question. – Krithika Raghavendran Feb 08 '19 at 04:32
  • so if it is located in appdata/local/ ... the appropriate path to add would NOT be `C:/Program/Files/Python/python3/Scripts`, it would be `c:/users//appdata/local/programs/python/python36/scripts/`. If this STILL doesnt work for you I would suggest re-installing python and make sure you click `add PATH variable` while installing so the install process will handle this for you – typedef struct James Feb 08 '19 at 04:36
  • @typedefstructJames, my issue here is with pip installation. Python is running fine. I tried to install pip again with the new PATH variable - still doesn't work. :'( – Krithika Raghavendran Feb 08 '19 at 04:42
  • I understand your issue... pip is located in `c:/users//appdata/local/programs/python/python36/scripts/`. If this path is not added to your environment variables then you will not be able to launch it from the command line. Again, pip comes packaged with python3 so there is no need to install over it. Re-installing python and clicking `add python to path` would solve this for you. Additionally, once you modify your environment variables you must close your terminal and open a new one for the changes to take place. – typedef struct James Feb 08 '19 at 04:47
  • 1
    navigate to `c:/users//appdata/local/programs/python/python36/scripts/`, if pip.exe is in there, you have pip. – typedef struct James Feb 08 '19 at 04:48
  • @typedefstructJames, do I navigate to this folder and check pip -V? When I try it, I STILL get the no module error. :( – Krithika Raghavendran Feb 08 '19 at 04:54
  • @KrithikaRaghavendran just a suggestion. on windows 10, you could install Ubuntu as an app from app store and then you could do most of your work inside that. Its sort of like a virtual environment and saves you a lot of development time – Sriram Feb 08 '19 at 05:25

4 Answers4

14

After running python get-pip.py, python install-dir will increase dir Lib\site-packages

Method 1. try to cp the pip dir into the python install-dir

or

Method 2. change file python3x._pth in python install-dir,append this line Lib\site-packages

run pip, problem will be solved

demianzhang
  • 556
  • 4
  • 13
  • 1
    cheers @demianzhang not sure why the answer isn't accepted. But Method 1 worked for me. – misguided Apr 26 '19 at 02:13
  • You could also make a symlink named pip in your Python installation directory. `mklink /D pip .\Lib\site-packages\pip` – Vince Jan 29 '20 at 09:35
5

The following steps may be followed to install pip on windows:

  1. Download python file: get-pip.py (nearly 1.8 MB size) from link: https://pip.pypa.io/en/stable/installing/#installing-with-get-pip-py and save it to your desktop
  2. Go to command prompt and Check your python version: c:> python
  3. From command prompt run: c:> python get-pip.py
  4. The above will install new version of pip. check by running C:> pip --version
  5. You may also update setup tools - C:> pip install --upgrade pip setuptools
Hanumanth s
  • 71
  • 1
  • 2
0

Use following commands can be used to find out whether pip extraction path is included or not.

>>> import sys
>>> sys.path

if Lib\site-packages path is not included then update file python37._pth.

Run the command again and path should be visible.

pip install <module name> worked successfully for me after this.

Thanks @demianzhang for the hint or even for the solution.

Suit Boy Apps
  • 3,005
  • 8
  • 36
  • 54
0

I found files in my Windows lib\site-packages directory ~ip ~ip-20-0.2.dist-info

Renamed them to pip pip-20-0.2.dist-info

And it worked to run pip install --upgrade pip