Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Upgrade deletes pip #9527

Closed
baterflyrity opened this issue Jan 28, 2021 · 5 comments · Fixed by #10560
Closed

Upgrade deletes pip #9527

baterflyrity opened this issue Jan 28, 2021 · 5 comments · Fixed by #10560

Comments

@baterflyrity
Copy link

baterflyrity commented Jan 28, 2021

Environment

  • pip version: 20.3.3
  • Python version: 3.9 x64
  • OS: Windows 10 x64
  • Chocolatey distributive

Description

>pip list
...
WARNING: You are using pip version 20.3.3; however, version 21.0 is available.
You should consider upgrading via the 'c:\python39\python.exe -m pip install --upgrade pip' command.
>py -m pip install --upgrade pip
Requirement already satisfied: pip in c:\python39\lib\site-packages (20.3.3)
Collecting pip
  Downloading pip-21.0-py3-none-any.whl (1.5 MB)
Installing collected packages: pip
  Attempting uninstall: pip
    Found existing installation: pip 20.3.3
    Uninstalling pip-20.3.3:
ERROR: Could not install packages due to an EnvironmentError: [WinError 5] �������� � �������: 'c:\\python39\\scripts\\pip.exe'
Consider using the `--user` option or check the permissions.
>pip
C:\Python39\python.exe: No module named pip

Guys how much more years you need to fix that sequence of upgrade????
Remember: firstly install then delete.

Fix
Run from admin console or install python not to system disk or use sudo (e.g. gsudo.exe).

@pradyunsg pradyunsg added the S: needs triage Issues/PRs that need to be triaged label Mar 6, 2021
@DiddiLeija
Copy link
Member

Could you try python -m ensurepip --upgrade or get-pip.py?

@DiddiLeija DiddiLeija added the S: awaiting response Waiting for a response/more information label Aug 25, 2021
@baterflyrity
Copy link
Author

baterflyrity commented Sep 8, 2021

Could you try python -m ensurepip --upgrade or get-pip.py?

Thanks but it does not work. The problem is that "Ask for Forgiveness than Permission" does not work when you do not ask for neither.

Fix
Run from admin console or install python not to system disk or use sudo (e.g. gsudo.exe).

@no-response no-response bot removed the S: awaiting response Waiting for a response/more information label Sep 8, 2021
@DiddiLeija
Copy link
Member

Thanks but it does not work. The problem is that "Ask for Forgiveness than Permission" does not work when you do not ask for neither.

Can you post what you got when trying these methods? Also, can you try pip install --upgrade pip?

@baterflyrity
Copy link
Author

Thanks but it does not work. The problem is that "Ask for Forgiveness than Permission" does not work when you do not ask for neither.

Can you post what you got when trying these methods? Also, can you try pip install --upgrade pip?

Ok... Here it is:

user@host MINGW64 ~                                                                                  
$ pip list | grep pip                                                                                           
pip                       21.2.3                                                                                
WARNING: You are using pip version 21.2.3; however, version 21.2.4 is available.                                
You should consider upgrading via the 'C:\Python39\python.exe -m pip install --upgrade pip' command.            
                                                                                                                
user@host MINGW64 ~                                                                                  
$ pip install --upgrade pip                                                                                     
Requirement already satisfied: pip in c:\python39\lib\site-packages (21.2.3)                                    
Collecting pip                                                                                                  
  Using cached pip-21.2.4-py3-none-any.whl (1.6 MB)                                                             
Installing collected packages: pip                                                                              
  Attempting uninstall: pip                                                                                     
    Found existing installation: pip 21.2.3                                                                     
    Uninstalling pip-21.2.3:                                                                                    
ERROR: Could not install packages due to an OSError: [WinError 5] Permission denied: 'c:\\python39\\scripts\\pi
p.exe'                                                                                                          
Consider using the `--user` option or check the permissions.                                                    
                                                                                                                
                                                                                                                
user@host MINGW64 ~                                                                                  
$ pip list | grep pip                                                                                           
Traceback (most recent call last):                                                                              
  File "C:\Python39\lib\runpy.py", line 197, in _run_module_as_main                                             
    return _run_code(code, main_globals, None,                                                                  
  File "C:\Python39\lib\runpy.py", line 87, in _run_code                                                        
    exec(code, run_globals)                                                                                     
  File "C:\Python39\Scripts\pip.exe\__main__.py", line 4, in <module>                                           
ModuleNotFoundError: No module named 'pip'                                                                      

And another one (this is the most funny, created #10453):

user@host MINGW64 ~
$ pip list | grep pip
pip                       21.2.3
WARNING: You are using pip version 21.2.3; however, version 21.2.4 is available.
You should consider upgrading via the 'C:\Python39\python.exe -m pip install --upgrade pip' command.

user@host MINGW64 ~
$ py -m ensurepip --upgrade
Looking in links: c:\Users\BATERF~1\AppData\Local\Temp\tmpuv4go5fy
Requirement already satisfied: setuptools in c:\python39\lib\site-packages (57.4.0)
Requirement already satisfied: pip in c:\python39\lib\site-packages (21.2.3)

user@host MINGW64 ~
$ pip list | grep pip
pip                       21.2.3
WARNING: You are using pip version 21.2.3; however, version 21.2.4 is available.
You should consider upgrading via the 'C:\Python39\python.exe -m pip install --upgrade pip' command.

And the last one (created issue #10452 again - old bug but has not been fixed yet!):

user@host MINGW64 ~                                                                                  
$ pip list | grep pip                                                                                           
pip                       21.2.3                                                                                
WARNING: You are using pip version 21.2.3; however, version 21.2.4 is available.                                
You should consider upgrading via the 'C:\Python39\python.exe -m pip install --upgrade pip' command.            
                                                                                                                
user@host MINGW64 ~                                                                                  
$ curl https://bootstrap.pypa.io/get-pip.py > get-pip.py                                             
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current                                 
                                 Dload  Upload   Total   Spent    Left  Speed                                   
100 1911k  100 1911k    0     0  2359k      0 --:--:-- --:--:-- --:--:-- 2362k                                  
                                                                                                                
baterflyrity@Desktop MINGW64 ~                                                                                  
$ py get-pip.py                                                                                                 
Collecting pip                                                                                                  
  Using cached pip-21.2.4-py3-none-any.whl (1.6 MB)                                                             
Installing collected packages: pip                                                                              
  Attempting uninstall: pip                                                                                     
    Found existing installation: pip 21.2.3                                                                     
    Uninstalling pip-21.2.3:                                                                                    
ERROR: Could not install packages due to an OSError: [WinError 5] Permission denied: 'c:\\python39\\scripts\\pi
p.exe'                                                                                                          
Consider using the `--user` option or check the permissions.                                                    
                                                                                                                
                                                                                                                
user@host MINGW64 ~                                                                                  
$ pip list | grep pip                                                                                           
Traceback (most recent call last):                                                                              
  File "C:\Python39\lib\runpy.py", line 197, in _run_module_as_main                                             
    return _run_code(code, main_globals, None,                                                                  
  File "C:\Python39\lib\runpy.py", line 87, in _run_code                                                        
    exec(code, run_globals)                                                                                     
  File "C:\Python39\Scripts\pip.exe\__main__.py", line 4, in <module>                                           
ModuleNotFoundError: No module named 'pip'                                                                      

p.s.
Related issues #9566, #9395.

baterflyrity added a commit to baterflyrity/pip that referenced this issue Sep 9, 2021
Add check for write permissions for non user installs.
@baterflyrity
Copy link
Author

Wrote fix #10454

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants