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

Unable to upgrade pip on Windows #786

Closed
jaraco opened this issue Apr 10, 2018 · 3 comments
Closed

Unable to upgrade pip on Windows #786

jaraco opened this issue Apr 10, 2018 · 3 comments
Assignees
Labels
area:testenv-creation feature:change something exists already but should behave differently

Comments

@jaraco
Copy link

jaraco commented Apr 10, 2018

I'd like to start testing some select projects against the pending pip 10 release. To do so, in rwt, I've added this commit. Unfortunately, that leads to this failure when running on Windows.

As a seasoned Windows user, I know exactly what's going on here. It's a longstanding weakness in Windows - it's difficult if not impossible to replace a file that's in use. And since pip.exe is in use, pip can't upgrade itself.

Fortunately, there's a workaround.

Instead of invoking pip install, use python -m pip install. As pip doesn't have any binary dependencies (shared libraries), all the modules will be loaded and their files closed immediately, allowing pip to upgrade itself. This technique also works on Unix-based systems so can be applied uniformally.

Is another workaround possible? preferable?

@jaraco
Copy link
Author

jaraco commented Apr 10, 2018

I found another workaround in jaraco/rwt (referenced in the commit above) by creating a custom build command that first upgrades pip (using python -m pip), then installs everything else with the new pip.

@nicoddemus
Copy link
Member

FWIW python -m pip is recommended by conda-forge on its recipes instead of calling pip directly because it also ensures pip will install the packages in the expected Python environment; if by accident a user has not installed pip in the environment's Python, it will fail with a clear message instead of installing in the wrong location..

I propose we change tox to always use python -m pip install.

@obestwalter obestwalter self-assigned this Apr 10, 2018
@obestwalter obestwalter added area:testenv-creation feature:change something exists already but should behave differently labels Apr 10, 2018
@gaborbernat
Copy link
Member

This has been done a while ago and released with 3.2.0

@tox-dev tox-dev locked and limited conversation to collaborators Jan 14, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
area:testenv-creation feature:change something exists already but should behave differently
Projects
None yet
Development

No branches or pull requests

4 participants