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?
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.
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.
This has been done a while ago and released with 3.2.0
Most helpful comment
FWIW
python -m pipis recommended byconda-forgeon its recipes instead of callingpipdirectly because it also ensurespipwill 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
toxto always usepython -m pip install.