Closed joaompinto closed 2 years ago
After some research I have that the error is related to the pip-scripts* binary path.
I was able to fix it by changing the first line with the following function:
def fix_pip_scripts():
scriptsPath = Path(sys.executable).parent.joinpath("Scripts").absolute()
pip_scripts = scriptsPath.glob("pip*-script.py")
for script in pip_scripts:
print(f"Fixing {script}")
with open(script) as script_file:
script_data = script_file.readlines()
script_data[0] = f"#!{sys.executable}\n"
with open(script, "w") as script_file:
script_file.writelines(script_data)
Is this something that should be added to the documentation ?
Thanks
I had issues with pip on Win10 too, but seems related to this: https://github.com/indygreg/python-build-standalone/issues/85
I guess you had a problem when using python -m pip, that works out of the box for me with the last release, what does not work is pip.exe :)
The .py
based files in Scripts
have disappeared after commit cd2a0ff18b56b5ffd3d57ce0fc43029d33454697. I don't think those were standard files, as the official CPython distributions don't contain them.
Unfortunately, the pip.exe
executables still appear to be referencing the build directory. e.g.
c:\dev\src\python-build-standalone\build\python\install>Scripts\pip.exe
Fatal error in launcher: Unable to create process using '"C:\Users\gps\AppData\Local\Temp\python-build-y9tt79xu\out\python\install\python.exe" "c:\dev\src\python-build-standalone\build\python\install\Scripts\pip.exe" ': The system cannot find the file specified.
This absolute path appears to be embedded in the built binary. We'll have to cajole the generation of these .exe
to reference a relative path. I'm unsure if that is trivial. It might be best to delete these executables from the distributions and tell consumers to use python.exe -m pip
instead.
Removing the binaries and documenting the need to use -m pip would be a reasonable "fix" in my opinion :)
To reproduce, from a Windows 10 system:
Results in the following error: