TLDR: On Cygwin install python-setuptools-wheel
and python-pip-wheel
packages.
To find the specific reason I installed a venv without pip support first (python3 -m venv venv --without-pip
) loaded it and ran the failing command (python -Im ensurepip --upgrade --default-pip
) manually. This generated a stack trace suggesting that it iterates over all versions of the setuptools wheel but none is actually installed:
Traceback (most recent call last):
File "/usr/lib/python3.9/runpy.py", line 188, in _run_module_as_main
mod_name, mod_spec, code = _get_module_details(mod_name, _Error)
File "/usr/lib/python3.9/runpy.py", line 147, in _get_module_details
return _get_module_details(pkg_main_name, error)
File "/usr/lib/python3.9/runpy.py", line 111, in _get_module_details
__import__(pkg_name)
File "/usr/lib/python3.9/ensurepip/__init__.py", line 30, in <module>
_SETUPTOOLS_VERSION = _get_most_recent_wheel_version("setuptools")
File "/usr/lib/python3.9/ensurepip/__init__.py", line 27, in _get_most_recent_wheel_version
return str(max(_wheels[pkg], key=distutils.version.LooseVersion))
ValueError: max() arg is an empty sequence
After installing python-setuptools-wheel
it generates the same stack trace but with _get_most_recent_wheel_version("pip")
-- hence python-setuptools-pip
is also missing. After installing that as well the command works and generating a venv with pip support also works.