pptk icon indicating copy to clipboard operation
pptk copied to clipboard

Setup broken on pip 20.0

Open m-pilia opened this issue 4 years ago • 4 comments

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.

m-pilia avatar Apr 23 '20 19:04 m-pilia

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?

Adrianordp avatar Jun 04 '20 19:06 Adrianordp

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

m-pilia avatar Jun 04 '20 20:06 m-pilia

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/

Adrianordp avatar Jun 04 '20 21:06 Adrianordp

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}

bk-mtg avatar Jul 10 '20 08:07 bk-mtg