Repository navigation
Installing environments fails: No matching distribution found for setuptools>=38.2.5 #960
Copy link
Copy link
Closed
Labels
Description
Each time I try to commit something, the following error appears:
Python version: 3.6.7
[INFO] Installing environment for https://github.com/ambv/black.
[INFO] Once installed this environment will be reused.
[INFO] This may take a few minutes...
An unexpected error has occurred: CalledProcessError: Command: ('F:\\.cache\\pre-commit\\repo_d7sntw_\\py_env-python3.6\\Scripts\\pip.exe', 'install', '.')
Return code: 1
Expected return code: 0
Output:
Processing f:\.cache\pre-commit\repo_d7sntw_
Installing build dependencies: started
Installing build dependencies: finished with status 'error'
Complete output from command f:\.cache\pre-commit\repo_d7sntw_\py_env-python3.6\scripts\python.exe -m pip install --ignore-installed --no-user --prefix C:\Users\bmar\AppData\Local\Temp\pip-build-env-jlhy83f_ --no-warn-script-location --no-binary :none: --only-binary :none: -i https://pypi.org/simple -- setuptools>=38.2.5 wheel:
Collecting setuptools>=38.2.5
Retrying (Retry(total=4, connect=None, read=None, redirect=None, status=None)) after connection broken by 'NewConnectionError('<pip._vendor.urllib3.connection.VerifiedHTTPSConnection object at 0x00000173CCA64390>: Failed to establish a new connection: [Errno 11003] getaddrinfo failed',)': /simple/setuptools/
Retrying (Retry(total=3, connect=None, read=None, redirect=None, status=None)) after connection broken by 'NewConnectionError('<pip._vendor.urllib3.connection.VerifiedHTTPSConnection object at 0x00000173CCA64278>: Failed to establish a new connection: [Errno 11003] getaddrinfo failed',)': /simple/setuptools/
Retrying (Retry(total=2, connect=None, read=None, redirect=None, status=None)) after connection broken by 'NewConnectionError('<pip._vendor.urllib3.connection.VerifiedHTTPSConnection object at 0x00000173CCA645C0>: Failed to establish a new connection: [Errno 11003] getaddrinfo failed',)': /simple/setuptools/
Retrying (Retry(total=1, connect=None, read=None, redirect=None, status=None)) after connection broken by 'NewConnectionError('<pip._vendor.urllib3.connection.VerifiedHTTPSConnection object at 0x00000173CCA64208>: Failed to establish a new connection: [Errno 11003] getaddrinfo failed',)': /simple/setuptools/
Retrying (Retry(total=0, connect=None, read=None, redirect=None, status=None)) after connection broken by 'NewConnectionError('<pip._vendor.urllib3.connection.VerifiedHTTPSConnection object at 0x00000173CCA4E630>: Failed to establish a new connection: [Errno 11003] getaddrinfo failed',)': /simple/setuptools/
Could not find a version that satisfies the requirement setuptools>=38.2.5 (from versions: )
No matching distribution found for setuptools>=38.2.5
----------------------------------------
Errors:
Command "f:\.cache\pre-commit\repo_d7sntw_\py_env-python3.6\scripts\python.exe -m pip install --ignore-installed --no-user --prefix C:\Users\bmar\AppData\Local\Temp\pip-build-env-jlhy83f_ --no-warn-script-location --no-binary :none: --only-binary :none: -i https://pypi.org/simple -- setuptools>=38.2.5 wheel" failed with error code 1 in None
.pre-commit-config.yaml
repos:
- repo: https://github.com/ambv/black
rev: 18.9b0
hooks:
- id: black
language_version: python3.6
- repo: https://gitlab.com/pycqa/flake8
rev: 3.7.7 # pick a git hash / tag to point to
hooks:
- id: flake8
args: [--show-source, --statistics, --doctests]
Reactions are currently unavailable
Activity
asottile commentedon Mar 4, 2019
That error looks like either your installation of python3.6 is broken, pypi was temporarily down, or your dns settings are broken -- none of which pre-commit can do anything about. Does it persist if you try again?
asottile commentedon Mar 4, 2019
I found this which is potentially related: pypa/pip#5568
mnboos commentedon Mar 5, 2019
Does this mean, pre-commit installs the required packages within a virtual environment? Because it even fails, if I run it outside of a venv.
It worked at home, but failed on the machine of a work collegue. I fear it's somehow related to our network config (which we cannot change).
mnboos commentedon Mar 5, 2019
I now notice, the commands are run from the
F:\drive, even though my console is onC:\as well as my userprofile and python installation.And if I run
pre-commitmanually, it works like a charm:But if this is triggered by
git commit -am "test commit"things go south.asottile commentedon Mar 5, 2019
that is very weird! If you re-run
pre-commit installdoes it fix committing?The
F:/bits are coming fromos.path.expanduser('~/...')which on windows I believe looks at theHOMEPATHvariableasottile commentedon Mar 9, 2019
@mnboos any updates?
mnboos commentedon Mar 9, 2019
It's not working yet. Setting PYTHONPATH didn't help either. I don't want to blame pre-commit, because it seems to work for everbody else and it works on my Ubuntu VM.
asottile commentedon Mar 9, 2019
It's interesting to me that
pre-commit(when run by itself) works, but not insidegit.Can you run this for me?
python -c 'import pprint, os; pprint.pprint(tuple(sorted(os.environ.items())))'And try putting this near the beginning of
.git/hooks/pre-commitAnd then running
git commitand posting the output of those two commands here? I'd be curious to see if there's any environment differences.Can you also run each of these commands and produce their output here? Might help in debugging what's different 🤔
mnboos commentedon Mar 11, 2019
Just for clarification: I'm using a Windows machine here, not Linux (i.e. it works on Linux, not on this Windows machine)
mnboos commentedon Mar 11, 2019
I found a workaround (i.e.
set HOMEDRIVE=C:)asottile commentedon Mar 11, 2019
Interesting, that does appear to be the difference.
Here's the relevant diff from the environ splat that I can see:
What I believe is happening:
gitcommands go throughgit.exewhich is an msys program. This "normalizes" the environment for POSIX, among other things making sureHOMEis set. I suspect there's a microbug in msys which makesHOMEDRIVE=F:andHOME=\\normalize toHOME=F:\\(this is probably a bug in msys, it should honorUSERPROFILEfirst).os.path.expanduseron windows usesos.environ['HOME']in preference toos.environ['USERPROFILE']-- this is ~maybe a bug in pythonpre-committo build environments on that network drive, tickling the pip bug above)In your case, I'd suggest the following workaround instead, to
set HOME=%USERPROFILE%Is that something you can configure for your user?
asottile commentedon Mar 11, 2019
I've created a bpo issue for this: https://bugs.python.org/issue36264
asottile commentedon Mar 14, 2019
yay, python3.8 will ship with a fix to
os.path.expanduser-- and you have a workaround for now by setting an environment variableI couldn't figure out how to send an issue to mingw for the
HOMEthing :SI think there's nothing left to do here so I'm closing this -- thanks for the issue 🎉
mnboos commentedon Mar 14, 2019
Awesome! Thanks a lot for your support!