question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

pip upgrade fails with "Successfully installed"

See original GitHub issue

Description

I’ve set a global.target configuration under C:\ProgramData\pip\pip.ini

[global]
target = C:\Program Files\Python\3.10\pip\site-packages\

Next when attempting an upgrade of pip from v21.2.4 to v21.3.1 no changes will be made despite a Successfully installed pip-21.3.1 message.

Expected behavior

pip install -v --upgrade pip should either update the current version or display an error message.

pip version

21.2.4

Python version

3.10.1

OS

Windows 11 (OS Build 22000.376)

How to Reproduce

  1. Install python from “python-3.10.1-amd64.exe”
  2. Create pip.ini under C:\ProgramData\pip\ with the following contents:
[global]
target = C:\Program Files\Python\3.10\pip\site-packages\
  1. Move the site-packages directory to its new location.
  2. Ensure the current user has sufficient acces to the C:\Program Files\Python\3.10\pip\site-packages\ directory. I’ve given full access to the User group
  3. attempt to update pip though the command pip install -v --upgrade pip

Output

PS C:\Users\Janos> pip config list
global.target='C:\\Program Files\\Python\\3.10\\pip\\site-packages\\'

PS C:\Users\Janos> pip list
Package    Version
---------- -------
pip        21.2.4
setuptools 58.1.0
WARNING: You are using pip version 21.2.4; however, version 21.3.1 is available.
You should consider upgrading via the 'C:\Program Files\Python\3.10\python.exe -m pip install --upgrade pip' command.

PS C:\Users\Janos> pip show pip
Name: pip
Version: 21.2.4
Summary: The PyPA recommended tool for installing Python packages.
Home-page: https://pip.pypa.io/
Author: The pip developers
Author-email: distutils-sig@python.org
License: MIT
Location: c:\program files\python\3.10\lib\site-packages
Requires:
Required-by:

PS C:\Users\Janos> icacls "C:\Program Files\Python\3.10\pip\site-packages"
C:\Program Files\Python\3.10\pip\site-packages BUILTIN\Users:(I)(OI)(CI)(F)
                                               NT SERVICE\TrustedInstaller:(I)(F)
                                               NT SERVICE\TrustedInstaller:(I)(CI)(IO)(F)
                                               NT AUTHORITY\SYSTEM:(I)(F)
                                               NT AUTHORITY\SYSTEM:(I)(OI)(CI)(IO)(F)
                                               BUILTIN\Administrators:(I)(F)
                                               BUILTIN\Administrators:(I)(OI)(CI)(IO)(F)
                                               BUILTIN\Users:(I)(OI)(CI)(IO)(GR,GE)
                                               Hyron-1\Janos:(I)(F)
                                               CREATOR OWNER:(I)(OI)(CI)(IO)(F)
                                               APPLICATION PACKAGE AUTHORITY\ALL APPLICATION PACKAGES:(I)(RX)
                                               APPLICATION PACKAGE AUTHORITY\ALL APPLICATION PACKAGES:(I)(OI)(CI)(IO)(GR,GE)
                                               APPLICATION PACKAGE AUTHORITY\ALL RESTRICTED APPLICATION PACKAGES:(I)(RX)
                                               APPLICATION PACKAGE AUTHORITY\ALL RESTRICTED APPLICATION PACKAGES:(I)(OI)(CI)(IO)(GR,GE)

Successfully processed 1 files; Failed processing 0 files

PS C:\Users\Janos> pip install -v --upgrade pip
Using pip 21.2.4 from C:\Program Files\Python\3.10\lib\site-packages\pip (python 3.10)
Collecting pip
  Using cached pip-21.3.1-py3-none-any.whl (1.7 MB)
Installing collected packages: pip
  Creating C:\Users\Janos\AppData\Local\Temp\pip-target-ox67vwws\bin
Successfully installed pip-21.3.1
WARNING: You are using pip version 21.2.4; however, version 21.3.1 is available.
You should consider upgrading via the 'C:\Program Files\Python\3.10\python.exe -m pip install --upgrade pip' command.

PS C:\Users\Janos> pip show pip
Name: pip
Version: 21.2.4
Summary: The PyPA recommended tool for installing Python packages.
Home-page: https://pip.pypa.io/
Author: The pip developers
Author-email: distutils-sig@python.org
License: MIT
Location: c:\program files\python\3.10\lib\site-packages
Requires:
Required-by:

Code of Conduct

Issue Analytics

  • State:open
  • Created 2 years ago
  • Comments:7 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
Wynadorncommented, Jan 4, 2022

Ok figured it out, here’s what it comes down to:

pip install --target \test-path\ pip will install pip to the target directory:

PS C:\> pip install --target \test-path\ pip
Collecting pip
  Using cached pip-21.3.1-py3-none-any.whl (1.7 MB)
Installing collected packages: pip
Successfully installed pip-21.3.1
WARNING: You are using pip version 21.2.4; however, version 21.3.1 is available.
You should consider upgrading via the 'C:\Program Files\Python\3.10\python.exe -m pip install --upgrade pip' command.

executing \test-path\bin\pip.exe --version will then point to the following

PS C:\> \test-path\bin\pip.exe --version
pip 21.2.4 from C:\Program Files\Python\3.10\lib\site-packages\pip (python 3.10)

Thus even though pip-21.3.1 has been installed to the \test-path\ directory, pip.exe will point to the original version. Version 21.3.1 exist, under \test-path\pip\__init__.py

Finally, as for the use of --target, what I was really looking for is python’s sites, listed by python -m site.

I assumed I had changed my installation directory to the value set in C:\ProgramData\pip.ini, which I did, however python was using the directories listed under python -m site which made the update ineffective.

0reactions
Wynadorncommented, Jan 3, 2022

I’ll have a look at verifying this issue with a clean installation tomorrow.

It seems that after I deleted the --target parameter I was able to update pip, since then I’ve been unable to reproduce the issue.

Read more comments on GitHub >

github_iconTop Results From Across the Web

pip upgrade issue using python -m pip install - Stack Overflow
It seems that if you're not careful when installing/upgrading pip you can inadvertently change it's availability from global to user-specific, ...
Read more >
Error while upgrading pip ERROR Could not install packages ...
1: Successfully uninstalled pip-19.1.1 ERROR: Could not install packages due to an EnvironmentError: [Error 5] Access is denied: 'c:\\users\\ ...
Read more >
How to Install Pip on Windows - ActiveState
Adding PIP to Windows Environment Variables ... One of the most common problems with running Python tools like pip is the “not on...
Read more >
Pip Command Not Found on Windows: A Guide | Built In
A “pip: command not found” error occurs when you fail to properly install the package installer for Python (pip) needed to run Python...
Read more >
Package installation issues | PyCharm Documentation
You might encounter a problem when installing a Python package in the project settings or in the Python Package tool window. Eventually, most...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found