python ensurepip fails due to being unable to find files
Brian Inglis
Brian.Inglis@SystematicSw.ab.ca
Sun Mar 20 16:07:01 GMT 2022
On 2022-03-20 01:42, Brian Inglis wrote:
> On 2022-03-19 22:07, The Other wrote:
>> Using the most recent version of python3 (3.9.10), I was unable to set
>> up a
>> virtual environment with "python -m venv venv". This was due to the
>> ensurepip stage failing. As such, I tried running ensurepip directly.
>>
>> Output when running "python -m ensurepip":
>>
>> 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
>>
>> Looking at the actual code in __init__.py, the function that is failing
>> seems to be constructing a list of .whl files in "_WHEEL_DIR",
>> "/usr/share/python-wheels/", and then returning the latest version of the
>> desired one (setuptools and pip are requested). However, it can't find
>> any
>> .whl files, and so the max() function fails.
>>
>> My cygwin installation doesn't even seem to have a python-wheels
>> folder in
>> /usr/share, let alone any .whl files in it. I'm not sure if cygwin
>> downloads and stores .whl files elsewhere, or if they even get downloaded
>> at all.
>>
>> The same error occurs for other versions of python3 I have installed,
>> including python3.8 and python3.6.
>>
>> I have attached my cygcheck.out file as cygcheck.out.txt. My python 3.9
>> install is all OK, though some of the older ones are incomplete for pip.
>
> Ensure all Cygwin processes are shut down from cmd or Powershell:
>
> > tasklist /m cygwin1.dll
> INFO: No tasks are running which match the specified criteria.
>
> or usually:
>
> Image Name PID Modules
> ========================= ======== ===========
> bash.exe 9276 cygwin1.dll
> sh.exe 3844 cygwin1.dll
> xinit.exe 10652 cygwin1.dll
> XWin.exe 3596 cygwin1.dll
> dbus-launch.exe 8104 cygwin1.dll
> dbus-daemon.exe 1512 cygwin1.dll
> gnome-keyring-daemon.exe 6488 cygwin1.dll
> fbxkb.exe 2196 cygwin1.dll
> xwin-xdg-menu.exe 3372 cygwin1.dll
> gam_server.exe 3580 cygwin1.dll
> pcmanfm.exe 7496 cygwin1.dll
> mintty.exe 18284 cygwin1.dll
> bash.exe 4340 cygwin1.dll
> ssh-agent.exe 14608 cygwin1.dll
> bash.exe 8384 cygwin1.dll
>
> but be aware it shows processes, excluding services, using any
> cygwin1.dll if you have multiple environments installed;
>
> or check TaskMgr Details Image path name does not show anything running
> from your Cygwin root bin or related directories.
>
> Download and run latest Cygwin Setup program.
>
> Reinstall incomplete or missing python3{,6,7,8,9}-pip latest versions
> and also install python3{,6,7,8,9}-virtualenv which all preinstall
> dependencies python-{pip,setuptools,wheel}-wheel.
>
> Allow the setup postinstall scripts to complete and check for any issues
> in /var/log/setup.log.full.
Also forgot to suggest python3{,6,7,8,9}-tox which preinstalls
...-virtualenv and handles managing and using virtual environments.
--
Take care. Thanks, Brian Inglis, Calgary, Alberta, Canada
This email may be disturbing to some readers as it contains
too much technical detail. Reader discretion is advised.
[Data in binary units and prefixes, physical quantities in SI.]
More information about the Cygwin
mailing list