1

I'm trying to work around the Python bug listed here:

The bug does not seem to have been officially solved. In any case, I was not able to run python get-pip.py since it resulted in an error. After doing an enormous amount of research I was able to put the program found here:

And run the program. That gave me my scripts folder. I then placed the scripts folder within python/python38/.

I then add to the path system variable such that my system variables look like this:

C:\Users\Owner\Documents\python;C:\Users\Owner\Documents\python\python38\scripts

system variables

I then quit the command prompt and restarted it and ran:

terminal

The contents of my scripts folder look like this:

pip

Is there supposed to be a pip.exe file?

What am I doing wrong?

It could very well be that I am not setting the system variables properly (I'm a first time windows user). I have the paths to the system variables separated with semicolons which I think is the right thing to do.

################ UPDATE

I solved the problem. I'm a new windows user, being a mac user for 20 years so that might have been part of my problem. In any case, I watched a youtube video https://www.youtube.com/watch?v=4zllTMFUJK8

and followed the instructions exactly. One thing that the youtuber did differently was that he had visualstudios c++ installed. I find it annoying that that is a dependency for Python. Python should automatically check that that it is installed before permitting the installation. I then chose a different Python folder to download, that was also annoying. I didn't know the difference between the different Python packages. Third, I had trouble getting rid of the old version of Python that wasn't working, but by deleting system and environment variables and restarting the computer I was able to get it to work.

bobsmith76
  • 160
  • 1
  • 9
  • 26
  • That is a pip.exe!? Windows Explorer has a bug since Windows 95 that hides file endings by default. – Sören Jun 10 '22 at 06:35
  • so do i have to do anything differently? – bobsmith76 Jun 10 '22 at 06:36
  • Yes. Configure your explorer to show file endings. No, this is not a programming question. – Sören Jun 10 '22 at 07:01
  • Ok, I did that, but that didn't solve my problem. – bobsmith76 Jun 10 '22 at 07:37
  • What version of python are you running? – greatusername Jun 12 '22 at 21:48
  • Did you try `python -m ensurepip`? Copying those files into your `scripts` folder is not enough, you also need the `pip` *module*, which should be a folder named `pip` inside `C:\Users\Owner\Documents\python\python38\lib\site-packages`, containing the module files (among which `__init__.py`). Do you have this folder? I believe you do not. See also [this post](https://stackoverflow.com/questions/29817447/how-to-run-pip-commands-from-cmd/29817514#29817514) and [this other one](https://stackoverflow.com/questions/4750806/how-can-i-install-pip-on-windows?rq=1). – Marco Bonelli Jun 12 '22 at 22:01
  • No, I don't have `ensurepip` and after visiting 5 sites which discuss the error `no module named ensurepip` it's not obvious how I get this module or where am I supposed to put it once I have the module. – bobsmith76 Jun 12 '22 at 22:54
  • btw, I used the command `python -m ensurepip`. – bobsmith76 Jun 12 '22 at 22:55
  • @bobsmith76 what is the output of the command `python -c "import sysconfig; print(sysconfig.get_paths()['purelib'])"`? Usually, the resulted path from the above command should contain the pure python packages including pip – guy szweigman Jun 14 '22 at 18:00
  • with the command `where pip` check the location of pip and add/update the path of pip. – Abhijit Manepatil Jun 16 '22 at 13:30
  • How did you install Python in the first place (what installer, to what directory, with which permissions)? It seems to be a user install; why are you editing the system's PATH variable? – FObersteiner Jun 18 '22 at 12:49

4 Answers4

2

Refresh your environment variables

First note, the Python scripts folder is capitalized, i.e. \Python\Scripts\ not \python\scripts (Although Windows paths aren't usually case sensitive).

The first thing you should try is logging out of your Windows account and logging back in. Environment variables in Windows aren't refreshed until after a login. It looks like you have pip now, so it's likely your Path is just stale:

See the docs:

... note that modifications to the environment variables do not result in immediate change. For example, if you start another Command Prompt after making the changes, the environment variables will reflect the previous (not the current) values. The changes do not take effect until you log off and then log back on.

Check your PATH

After logging off and back on (or restarting) try this:

You can try running pip through Python as a module: python -m pip --version. If you get an output, it means pip is successfully installed somewhere, but is still not on your path.

You should see output similar to:

pip 22.1.2 from C:\Users\...\AppData\Local\Programs\Python\Python310\lib\site-packages\pip (python 3.10)

That is the path you will want to make sure you set in the PATH Windows setting so you can run pip later without the preface python -m. It looks like your PATH format is correct, but you can see this answer for more info on that. If prefacing your pip commands with python -m isn't a big deal, then you don't need to worry about adding pip to PATH.

Install pip

If the python -m pip --version gives you a module not found error, then try opening a Command Prompt or Power Shell window as an admin and from the elevated shell use ensurepip:

python -m ensurepip --upgrade 

(I know you mentioned in the comments you tried this, but I want the answer to be complete for others).

If that still fails, update your question with your install logs (Type %TEMP% into the address bar of a Windows Explorer window and look for the most recently created set of python*.log files).

Nuclear option

If all else fails, you can run the uninstaller from Control Panel -> Programs -> Uninstall a Program then select Python. Restart your computer and re-install Python from the official download. On the installer, pay attention as there is a checkbox to automatically add it to your PATH as well. Restart Windows after the install and try again.

Salvatore
  • 10,815
  • 4
  • 31
  • 69
0

Assuming that the python path is set, try using command

python -m ensurepip --upgrade

if this also does not help for the timing you can simply use

python -m pip install package name

for setting up the environment.

0

I have experienced same thing when I download pip file separately, it can shows path error and pip not recognized.

first of all I can clear your misconception

In Script folder you can see pip file and its type is application. This is your .exe file.

Reason :

when download pip file it can write a path inside a pip.exe which is basically python file, you replace pip file anywhere but the path write inside your pip file can not over write. so it cannot run, if you want to run pip than download in a specific folder and not replace it or move it.

Solution Uninstalled Python and remove packages from your Hidden files then again install or modify your Python it can shows option to download pip so choose that option and also choose an option to Add Path (it can auto add path on your environment variable). Hopefully it can resolve your Issue same as mine.

Mehmaam
  • 573
  • 7
  • 22
-1

I have encountered the issue you have before

you must ensure the pip was installed properly, and when you try to try to install an application with a pip command with a specific folder it would command not found, what you can do is copy the pip from the python folder packages and put that in the specific folder so you can do pip commands from there, without an error, that's what i do using windows 10 since it has a bug for python

Arjay
  • 21
  • 5