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's vendored pkg_resources should stop using pkgutil.ImpImporter

See original GitHub issue

Description

pkgutil.ImpImporter has been deprecated since Python 3.3. It is slated to be removed in Python 3.12 but until pip no longer uses it, we probably can’t remove this long deprecated class.

Expected behavior

No response

pip version

22.2.2

Python version

3.12

OS

macOS

How to Reproduce

  1. Grab the CPython branch: gh pr checkout 98059
  2. configure && make test
  3. test_venv fails because pip uses this API
  4. See https://github.com/python/cpython/actions/runs/3215689824/jobs/5256965254

Output

No response

Code of Conduct

Issue Analytics

  • State:open
  • Created a year ago
  • Comments:9 (6 by maintainers)

github_iconTop GitHub Comments

5reactions
uranusjrcommented, Oct 10, 2022

Since we are already moving from pkg_resources to importlib.metadata, we can make Python 3.12 our cutoff to switch entirely to the latter backend. This would mean that we can simply keep pkg_resources as-is since those usages will only be accessed on earlier Python versions.

0reactions
pradyunsgcommented, Oct 10, 2022

I’m not sure how to figure out which version of setuptools pip is currently vendoring.

So… this issue made me realise that I’d broken our update logic in a subtle manner, which means we’re on a ~2 year old version.

https://github.com/pypa/pip/blob/8f381cd439ff3ded9d124ba23ecb1c2581c008ed/src/pip/_vendor/vendor.txt#L19

https://github.com/pypa/pip/issues/11500#issuecomment-1272683142 is where I noticed that. I’ll be trying to bump to the latest setuptools version in the next pip release, as a part of https://github.com/pypa/pip/pull/11502 (or a follow up); assuming it’s tractable in the limited free time that I have. 😃

Read more comments on GitHub >

github_iconTop Results From Across the Web

Update vendored packages for 22.3 · Issue #11500 · pypa/pip · GitHub
So while I can point out where things don't work on Windows, I'm pretty lost ... pip's vendored pkg_resources should stop using pkgutil.ImpImporter...
Read more >
blob
The package resource API is designed to work with normal filesystem packages, .egg files, and unpacked .egg files. It can also work in...
Read more >
Daiyi Zhuang
The package resource API is designed to work with normal filesystem packages,. 13 .egg files, and unpacked .egg files. It can also work...
Read more >
pkgutil — Package extension utility
Because the place where the package stops and the object hierarchy starts can't be inferred by inspection, repeated attempts to import must be...
Read more >
Issues with pip - python
Check your PYTHONPATH environment variable. On Linux you can do echo $PYTHONPATH . Turns out my PYTHONPATH had several locations to ...
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