pypa / get-pip

Helper scripts to install pip, in a Python installation that doesn't have it.
https://bootstrap.pypa.io/pip/
MIT License
740 stars 293 forks source link

import of setuptools causes problems #137

Closed jaraco closed 2 years ago

jaraco commented 2 years ago

get-pip during its initialization will check to see if setuptools is installed by invoking import setuptools. For various historical reasons, importing setuptools is expensive and messy.

In pypa/setuptools#2993, an issue was reported illustrating a conflict between setuptools expectation on import and the need to avoid making that expectation for pip.

I believe the best workaround for this situation would be to avoid importing setuptools at all. Maybe just invoke the "finder" or "get_spec" for setuptools but not actually load/run it. Or consider inspecting the metadata to see if a "setuptools" package is present (may require Python 3.8).

pradyunsg commented 2 years ago

PRs would be welcome! :)

Stikus commented 2 years ago

Hello, looks like here is PR: https://github.com/pypa/get-pip/pull/140

Can you merge it if everything ok?

Some scripts using get-pip struggling until fix is in place. Like https://github.com/google/deepvariant

pradyunsg commented 2 years ago

Closing since 22.0.x uses a less invasive mechanism.