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

Setup broken on pip 20.0 #37

Open
m-pilia opened this issue Apr 23, 2020 · 4 comments
Open

Setup broken on pip 20.0 #37

m-pilia opened this issue Apr 23, 2020 · 4 comments

Comments

@m-pilia
Copy link

m-pilia commented Apr 23, 2020

The following error arises when trying to build with pip 20.0

Traceback (most recent call last):
  File "setup.py", line 9, in <module>
    from pip._internal import wheel
ImportError: cannot import name 'wheel' from 'pip._internal' (/usr/lib/python3.8/site-packages/pip/_internal/__init__.py)

This is because pip._internal.wheel was moved, and pep425tags is now called pip._internal.utils.compatibility_tags.

I would like to point out that pip._internal is indeed internal to pip, you should not be using it in your setup.py, and this is the reason.

@Adrianordp
Copy link

The following error arises when trying to build with pip 20.0

Traceback (most recent call last):
  File "setup.py", line 9, in <module>
    from pip._internal import wheel
ImportError: cannot import name 'wheel' from 'pip._internal' (/usr/lib/python3.8/site-packages/pip/_internal/__init__.py)

This is because pip._internal.wheel was moved, and pep425tags is now called pip._internal.utils.compatibility_tags.

I would like to point out that pip._internal is indeed internal to pip, you should not be using it in your setup.py, and this is the reason.

How do we fix setup.py then?

@m-pilia
Copy link
Author

m-pilia commented Jun 4, 2020

Hi Adriano,
If I were building this for myself, I would probably just remove the python_tag and plat_name from the setup.py.

@Adrianordp
Copy link

Adrianordp commented Jun 4, 2020

Hi Adriano,
If I were building this for myself, I would probably just remove the python_tag and plat_name from the setup.py.

Hello Martino. Thanks for your attention!
I was really struggling to build it (first time dealing with a python wheel). This is my solution, if anyone wonders how to fix it as I did:
- 9 from pip._internal import wheel
- 11 wheel_tags = wheel.pep425tags.get_supported()[0]
- 88 'python_tag': wheel_tags[0],
- 89 'plat_name': wheel_tags[2]}})
+ 88 'python_tag': 'py38',
+ 89 'plat_name': 'linux_x86_64'}})
For inclusions I followed the wheel tag convention on https://www.python.org/dev/peps/pep-0425/

@bk-mtg
Copy link

bk-mtg commented Jul 10, 2020

Looks like the "new way" to get the same data (not clear whether it's really needed) is by importing packaging.tags. Specifically, something like:

import packaging.tags
# get the first (most detailed) tag describing this system
# analogous to wheel.pep425tags.get_supported()[0]
sys_tag = packaging.tags.sys_tags().__next__()
# tag names are now referenced by name
opts = {'python_tag': sys_tag.interpreter, 'plat_name': sys_tag.platform}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants