question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

pip wheels (from ensurepip) show nonexistant entry_points in importlib.metadata

See original GitHub issue

Description

I was working on some code (a conan generator to write cmake add_executable(... IMPORTED) bindings based on importlib.metadata.entry_points), and noticed something odd - there was an entry point for pip3.8 showing up that didn’t actually have a corresponding launcher pip3.8.exe (since I was/am stuck using python 3.7 to avoid https://github.com/pypa/pip/issues/8649 until a cpython release picks up pip 21.2, the actual launcher was pip3.7.exe).

Expected behavior

importlib.metadata.Distribution.entry_points will correspond to the entry_point launchers that actually exist.

pip version

20.2.3-21.2.4

Python version

3.9.4

OS

Windows

How to Reproduce

from importlib.metadata import distribution
distribution("pip").entry_points

note the presence of EntryPoint(name='pip3.8', value='pip._internal.cli.main:main', group='console_scripts'), even though this is python 3.9, not 3.8.

where pip3.8
INFO: Could not find files for the given pattern(s).
>where pip3.9
C:\Program Files\Python39\Scripts\pip3.9.exe

Output

[EntryPoint(name='pip', value='pip._internal.cli.main:main', group='console_scripts'), EntryPoint(name='pip3', value='pip._internal.cli.main:main', group='console_scripts'), EntryPoint(name='pip3.8', value='pip._internal.cli.main:main', group='console_scripts')]

entry_points.txt

[console_scripts]
pip = pip._internal.cli.main:main
pip3 = pip._internal.cli.main:main
pip3.8 = pip._internal.cli.main:main

The wheel for 21.2.4 still seems to show the same sort of thing going on: https://files.pythonhosted.org/packages/ca/31/b88ef447d595963c01060998cb329251648acf4a067721b0452c45527eb8/pip-21.2.4-py3-none-any.whl (though there it’s pip3.9 that is present)

Code of Conduct

Issue Analytics

  • State:open
  • Created 2 years ago
  • Comments:25 (22 by maintainers)

github_iconTop GitHub Comments

3reactions
pradyunsgcommented, Aug 13, 2021

Cool. Given that everyone on this thread doesn’t think this is important or worth fixing, let’s close this?

2reactions
pfmoorecommented, Aug 12, 2021

Yes, that’s because we generate versioned values in entry_points.txt which are not needed when we generate the scripts, but (as I understand it from @uranusjr’s comment) are used by Linux distributions, who build the wheels, but don’t use pip to install them, but rather extract the wheel using their own process (which presumably relies on the entry points).

I’m saying that to be correct, our entry point should just be pip (because entry points cann’t be dependent on the installation environment), but if we did that those Linux distributions would have to make new arrangements to generate the right scripts.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Using importlib.metadata — Python 3.11.1 documentation
importlib_metadata is a library that provides access to the metadata of an installed Distribution Package, such as its entry points or its top-level...
Read more >
Changelog - pip documentation v22.3.1
Enable the importlib.metadata metadata implementation by default on Python 3.11 (or later). ... Show entry points for projects installed via wheel. (#3122).
Read more >
pip Changelog - pyup.io
When pip rewrites the shebang line in a script during wheel installation, ... Enable the ``importlib.metadata`` metadata implementation by default on
Read more >
`importlib-metadata` version is incompatible with `setuptools ...
I had the same issue in a Centos 7 machine. It was solved by: pip install importlib-metadata==4.12.
Read more >
更新日志-BeJSON.com
bpo-46985: Upgrade pip wheel bundled with ensurepip (pip 22.0.4) ... bpo-46246: Add missing __slots__ to importlib.metadata.DeprecatedList .
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found