Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Incorrect wheel tag for platform-dependent packages on PyPy #1820

Open
3 tasks done
mmaslowskicc opened this issue Jan 3, 2020 · 5 comments
Open
3 tasks done

Incorrect wheel tag for platform-dependent packages on PyPy #1820

mmaslowskicc opened this issue Jan 3, 2020 · 5 comments
Labels
kind/bug Something isn't working as expected

Comments

@mmaslowskicc
Copy link

Issue

When running on PyPy and having the build key in pyproject.toml, Poetry chooses a wheel tags that is not supported by the platform, so it cannot be installed afterwards.

When running docker build . with files from the linked Gist:

Step 6/7 : RUN poetry build
 ---> Running in a893c9f76461
Creating virtualenv wheeltagtest-9TtSrW0h-py3.6 in /root/.cache/pypoetry/virtualenvs
Building wheeltagtest (0.1.0)
 - Building sdist
 - Built wheeltagtest-0.1.0.tar.gz

 - Building wheel
 - Built wheeltagtest-0.1.0-pp369-pypy36_pp73-linux_x86_64.whl
Removing intermediate container a893c9f76461
 ---> c99768df9fda
Step 7/7 : RUN poetry run pip install dist/*.whl
 ---> Running in 33d70ae40527
ERROR: wheeltagtest-0.1.0-pp369-pypy36_pp73-linux_x86_64.whl is not a supported wheel on this platform.
WARNING: You are using pip version 19.2.3, however version 19.3.1 is available.
You should consider upgrading via the 'pip install --upgrade pip' command.
The command '/bin/sh -c poetry run pip install dist/*.whl' returned a non-zero code: 1

A proper wheel tag would contain pp373 instead of pp369: this runs on PyPy 7.3.0 (which is otherwise compatible with Python 3.6.9).

@mmaslowskicc mmaslowskicc added the kind/bug Something isn't working as expected label Jan 3, 2020
@lambdaclan
Copy link

Might be related to #1616. There seems to be issues with platform detection in general.

@mmaslowskicc
Copy link
Author

I did found this issue when working around #1616. If I install one package from wheel on CPython, a differently named package from wheel on PyPy, then I can install dependencies for the proper platform. However, if I build the platform-dependent wheel for PyPy using Poetry, I get the incorrect wheel tag and it isn't installable.

A fix is to use sys.pypy_version_info like in https://github.com/pypa/wheel/blob/master/wheel/pep425tags.py#L56 (with proper changes for obtaining versions from the virtualenv if one is used). I can fix it, but I'm not exactly sure how to test it properly (this probably needs being able to run Poetry tests on PyPy).

@mmaslowskicc
Copy link
Author

packaging.tags has its own implementation of PEP 425 tags and pip master uses it. It considers pp36-pypy36_pp73-linux_x86_64 valid for this case, while both pp369 and pp373 are unsupported.

@gitonthescene
Copy link

Connecting related issue. #3509

@domvwt
Copy link

domvwt commented Mar 25, 2023

For anyone else waiting on this fix, the following shell script may be sufficient as a temporary workaround:

#!/bin/bash

# Rename the wheel file to match the currently active python version
wheel_file=$(find dist/ -type f -name '*.whl')
echo "Renaming ${wheel_file}"
python_ver=$(python -c 'import platform; print("".join(platform.python_version_tuple()[:2]))')
echo "Using Python version: ${python_ver}"
new_wheel_file=$(echo ${wheel_file} | sed "s/-cp[0-9]*/-cp${python_ver}/g")
echo "New wheel file name: ${new_wheel_file}"
mv ${wheel_file} ${new_wheel_file}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
kind/bug Something isn't working as expected
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants