Closed
Description
Environment
- pip version: 19.2.2
- Python version: 3.8b3
- OS: Windows 10
Description
As described by @rdb in pypa/packaging#180:
On Windows, pip fails to install binary wheels with the following error:
ERROR: mypackage-1.0.0-cp38-cp38-win_amd64.whl is not a supported wheel on this platform.
Expected behavior
pip
installs wheels with Python 3.8.
How to Reproduce
:: Goes through (but fails because it is not a zip) even though the ABI tag cp38m is not valid
echo > project-0.1.0-cp38-cp38m-win_amd64.whl
pip install ./project-0.1.0-cp38-cp38m-win_amd64.whl
:: Fails to consider this file even though it has the valid cp38 ABI tag
echo > project-0.1.0-cp38-cp38-win_amd64.whl
pip install ./project-0.1.0-cp38-cp38-win_amd64.whl
Output
(.venv) C:\Users\User\Desktop\test>echo > project-0.1.0-cp38-cp38m-win_amd64.whl
(.venv) C:\Users\User\Desktop\test>pip install ./project-0.1.0-cp38-cp38m-win_amd64.whl
Processing c:\users\user\desktop\test\project-0.1.0-cp38-cp38m-win_amd64.whl
ERROR: Exception:
Traceback (most recent call last):
File "c:\users\user\desktop\test\.venv\lib\site-packages\pip\_internal\cli\base_command.py", line 188, in main
status = self.run(options, args)
File "c:\users\user\desktop\test\.venv\lib\site-packages\pip\_internal\commands\install.py", line 345, in run
resolver.resolve(requirement_set)
File "c:\users\user\desktop\test\.venv\lib\site-packages\pip\_internal\legacy_resolve.py", line 196, in resolve
self._resolve_one(requirement_set, req)
File "c:\users\user\desktop\test\.venv\lib\site-packages\pip\_internal\legacy_resolve.py", line 359, in _resolve_one
abstract_dist = self._get_abstract_dist_for(req_to_install)
File "c:\users\user\desktop\test\.venv\lib\site-packages\pip\_internal\legacy_resolve.py", line 305, in _get_abstract_dist_for
abstract_dist = self.preparer.prepare_linked_requirement(
File "c:\users\user\desktop\test\.venv\lib\site-packages\pip\_internal\operations\prepare.py", line 195, in prepare_linked_requirement
unpack_url(
File "c:\users\user\desktop\test\.venv\lib\site-packages\pip\_internal\download.py", line 1051, in unpack_url
unpack_file_url(link, location, download_dir, hashes=hashes)
File "c:\users\user\desktop\test\.venv\lib\site-packages\pip\_internal\download.py", line 985, in unpack_file_url
unpack_file(from_path, location, content_type, link)
File "c:\users\user\desktop\test\.venv\lib\site-packages\pip\_internal\utils\misc.py", line 732, in unpack_file
unzip_file(
File "c:\users\user\desktop\test\.venv\lib\site-packages\pip\_internal\utils\misc.py", line 612, in unzip_file
zip = zipfile.ZipFile(zipfp, allowZip64=True)
File "C:\opt\python.3.8.0-b3\tools\lib\zipfile.py", line 1232, in __init__
self._RealGetContents()
File "C:\opt\python.3.8.0-b3\tools\lib\zipfile.py", line 1299, in _RealGetContents
raise BadZipFile("File is not a zip file")
zipfile.BadZipFile: File is not a zip file
(.venv) C:\Users\User\Desktop\test>echo > project-0.1.0-cp38-cp38-win_amd64.whl
(.venv) C:\Users\User\Desktop\test>pip install ./project-0.1.0-cp38-cp38-win_amd64.whl
ERROR: project-0.1.0-cp38-cp38-win_amd64.whl is not a supported wheel on this platform.
Details
In pep425flags here when constructing our ABI tag, we check:
- if
sysconfig.get_config_var('SOABI')
, then use that - otherwise, if
sysconfig.get_config_var('WITH_PYMALLOC')
, addm
- otherwise, if we're running CPython, add
m
On Windows, neither SOABI
or WITH_PYMALLOC
are defined, so then we unconditionally add m
to our required ABI tags for CPython. But this is incorrect since m
was removed from the ABI as part of 3.8 per bpo-36707.
On macOS and Linux we already have the correct tag since SOABI
is defined.
See also
Activity