You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This issue basically tracks the root goal of obviating pkg_resources, in particular that Setuptools depends on it.
Over the past few years, myself and others have worked hard to create importlib.resources and importlib.metadata in the goal of superseding pkg_resources. These libraries are now very stable and replacing much of the functionality provided by pkg_resources.
In python/importlib_metadata#38, I examined the setuptools package to determine its level of dependency on pkg_resources. Unsurprisingly, there is a diverse set of interfaces on which setuptools relies.
Nevertheless, this project should work toward Setuptools adopting the importlib features in place of pkg_resources.
This somehow breaks projects entry points to pyramid/paste it seems, which aren't able to find their entry point anymore (I have no idea what's the cause)
Error for Google:
LookupError: Entry point 'main' not found in egg 'my.package' (dir: xxx/.pyenv-python3.7/lib/python3.7/site-packages; protocols: paste.app_factory, paste.composite_factory, paste.composit_factory; entry_points: )
Attempting to remove pkg_resources, the pbr tests fail with this traceback:
File "/Users/jaraco/draft/.venv/lib/python3.13/site-packages/pbr/core.py", line 53, in <module>
from pbr import util
File "/Users/jaraco/draft/.venv/lib/python3.13/site-packages/pbr/util.py", line 75, in <module>
import pkg_resources
ModuleNotFoundError: No module named 'pkg_resources'
pbr uses pkg_resources in exactly one place, to evaluate markers. That's definitely a deprecated use and superseded by 'importlib.metadata' and 'packaging'.
I tried uploading a copy of pkg_resources to PyPI, but it seems that name is blocked:
pkg_resources main 🐚 twine upload dist/*
Uploading distributions to https://upload.pypi.org/legacy/
Uploading pkg_resources-1.0.0-py3-none-any.whl
100% ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 45.0/45.0 kB • 00:00 • 346.9 MB/s
WARNING Error during upload. Retry with the --verbose option for more details.
ERROR HTTPError: 403 Forbidden from https://upload.pypi.org/legacy/
The user 'jaraco' isn't allowed to upload to project 'pkg-resources'. See https://pypi.org/help/#project-name for more information.
I don't think it's worth trying to reclaim that name, so I'm going to assume that supplying a separate pkg_resources package to supplement setuptools without pkg_resources. Environments that rely on setuptools will simply have to install setuptools<81.
I don't think it's worth trying to reclaim that name, so I'm going to assume that supplying a separate pkg_resources package to supplement setuptools without pkg_resources. Environments that rely on setuptools will simply have to install setuptools<81.
It is a bit unfortunate that we cannot publish to PyPI. I can see a couple of situations in which it would be useful. If we want to be very conservative and try to reduce backwards incompatibility we could:
We could return pkg_resources in setuptools.build_meta:__legacy__.get_requires_for_build_sdist/wheel (either by default, or by using an heuristic like searching for the pkg_resources string in setup.py.
I tried uploading a copy of pkg_resources to PyPI, but it seems that name is blocked:
...
I don't think it's worth trying to reclaim that name, so I'm going to assume that supplying a separate pkg_resources package to supplement setuptools without pkg_resources. Environments that rely on setuptools will simply have to install setuptools<81.
Does the project need to be named pkg_resources? Wouldn't something like pkg_resources_backport (or similar) work?
You're right that replacing the deprecated APIs isn't an issue, at least not for actively maintained projects. What I'm a bit concerned about is unnecessarily breaking those which haven't received an update in a while. Especially in larger projects those dependencies aren't always avoidable.
For Home Assistant we had a similar situation with the move to Python 3.13. The removal of stdlib modules broke a lot of packages. We wouldn't be able to use 3.13 now if it weren't for backport packages. I'd assume it will be similar for the pkg_resources removal. Yes, pinning setuptools is an option but not a very good one IMO.
To be sure, if there's a common/impactful scenario where the presence of a backfill project would help, I'll definitely work on creating that project. The problem is that the scenarios I've thought of where it might help would be just as easily addressed by pinning Setuptools. After all, if you can require or install pkg_resources, that's the point where you could also require setuptools<81, no? The dependency is at runtime and not build time, so the complications that come with being a build time dependency are moot, I think.
If users are noticing the warning now, let's explore those cases and see what options are available.
After all, if you can require or install pkg_resources, that's the point where you could also require setuptools<81, no?
Yes, though I'd prefer to not have to do that as it "forever" limits which setuptools version is used. There might be other packages in the future which depend on a newer version and would thus be incompatible.
"forever" might be an exaggeration but some packages might not have received an update in over 3 years. Those are unlikely to get fixed. So the setuptools pin would have to stay until these are eventually removed.
The dependency is at runtime and not build time, so the complications that come with being a build time dependency are moot, I think.
If it were a build time dependency, I don't think there is an option to remove it. Thankfully this shouldn't be the case (?). Yes PIP_CONSTRAINTS exists but it's not easy to use for most people and until overwriting build requirements gets easier this would be the only option.
Yes, though I'd prefer to not have to do that as it "forever" limits which setuptools version is used. There might be other packages in the future which depend on a newer version and would thus be incompatible.
Acknowledged. And if there's a scenario that warrants this bridge, we'll deal with it then.
I am maintaining zc.buildout. This still heavily depends on pkg_resources. See buildout/buildout#685. As described in that ticket, theoretically it might be possible to get rid of this dependency, but likely this needs breaking changes in the whole ecosystem of Buildout extensions and recipes. This breakage would probably not be worth the trouble.
So for Buildout it could be useful to have a backport of pkg_resources available.
Alternatively, I am pondering to just copy the current pkg_resources package to zc.buildout. I just did the same for the removed package_index.py module.
Note that supporting pkg_resources namespaces could also be a reason for a backport package. But for my part (speaking as Plone release manager), the Zope and Plone communities are working on updating our packages to move to native namespaces. We want them completely gone in Plone 6.2, which is expected in the fall of this year. It could prove more difficult for Plone add-ons, which are often using the collective.* namespace. So a backport could have value there.
For the record, you can install Zope and Plone just fine with pip, and many are using just that, plus some other tooling. But Buildout has useful constructs that go beyond merely installing packages, so old farts like me still appreciate it. ;-)
Reacted by Jeff Shell, Shane Hathaway and Godefroid Chapelle
Since setuptools no longer relies on pkg_resources, I'm going to close this issue. We can use #863 to track the publishing of a separate pkg_resources backport package.
Hey @jaraco , seems the pkg_resources documentation needs an update as it still lists pkg_resources as only "deprecated", with no mention of it actually being removed (nor active plans for its removal). That was my first port of call to check for its removal when the Lektor-based build system of our legacy site broke (in star-fleet-tours/star-fleet-tours-website#101 ) due to missing pkg_resources, since I recalled you'd deprecated it, but as I didn't see anything there I checked into a few other things before checking the changelog.
I'd offer to contribute a PR, but I'm traveling at the moment and I figure you know what you want to say as the maintainer and all :)
Activity
romuald commentedon Feb 14, 2022
This somehow breaks projects entry points to pyramid/paste it seems, which aren't able to find their entry point anymore (I have no idea what's the cause)
Error for Google:
armanckeser commentedon Feb 14, 2022
The same pr causes this issue I think #3102
Remove reference to pkg_resources. Ref #3085
jaraco commentedon May 20, 2025
Now that the setuptools code base no longer depends on pkg_resources, I'm considering once again republishing pkg_resources as a separate package.
I've reactivated the pypa/pkg_resources repo and re-run a filter operation on this repo to re-capture the history of that code there:
I'm now pondering publishing that code to see if the setuptools tests can continue to run by requiring that package at test time.
jaraco commentedon May 21, 2025
Attempting to remove pkg_resources, the pbr tests fail with this traceback:
It seems that pbr is reliant on the interface.
jaraco commentedon May 21, 2025
pbr uses pkg_resources in exactly one place, to evaluate markers. That's definitely a deprecated use and superseded by 'importlib.metadata' and 'packaging'.
jaraco commentedon May 21, 2025
I tried uploading a copy of
pkg_resourcesto PyPI, but it seems that name is blocked:I don't think it's worth trying to reclaim that name, so I'm going to assume that supplying a separate
pkg_resourcespackage to supplement setuptools without pkg_resources. Environments that rely on setuptools will simply have to installsetuptools<81.abravalheri commentedon May 23, 2025
It is a bit unfortunate that we cannot publish to PyPI. I can see a couple of situations in which it would be useful. If we want to be very conservative and try to reduce backwards incompatibility we could:
pkg_resourcesinsetuptools.build_meta:__legacy__.get_requires_for_build_sdist/wheel(either by default, or by using an heuristic like searching for thepkg_resourcesstring insetup.py.Set a deadline for the removal of pkg_resources later this year (Dece…
cdce8p commentedon May 27, 2025
Does the project need to be named
pkg_resources? Wouldn't something likepkg_resources_backport(or similar) work?You're right that replacing the deprecated APIs isn't an issue, at least not for actively maintained projects. What I'm a bit concerned about is unnecessarily breaking those which haven't received an update in a while. Especially in larger projects those dependencies aren't always avoidable.
For Home Assistant we had a similar situation with the move to Python 3.13. The removal of stdlib modules broke a lot of packages. We wouldn't be able to use 3.13 now if it weren't for backport packages. I'd assume it will be similar for the
pkg_resourcesremoval. Yes, pinning setuptools is an option but not a very good one IMO.jaraco commentedon May 27, 2025
To be sure, if there's a common/impactful scenario where the presence of a backfill project would help, I'll definitely work on creating that project. The problem is that the scenarios I've thought of where it might help would be just as easily addressed by pinning Setuptools. After all, if you can require or install pkg_resources, that's the point where you could also require setuptools<81, no? The dependency is at runtime and not build time, so the complications that come with being a build time dependency are moot, I think.
If users are noticing the warning now, let's explore those cases and see what options are available.
cdce8p commentedon May 27, 2025
Yes, though I'd prefer to not have to do that as it "forever" limits which setuptools version is used. There might be other packages in the future which depend on a newer version and would thus be incompatible.
"forever" might be an exaggeration but some packages might not have received an update in over 3 years. Those are unlikely to get fixed. So the setuptools pin would have to stay until these are eventually removed.
If it were a build time dependency, I don't think there is an option to remove it. Thankfully this shouldn't be the case (?). Yes
PIP_CONSTRAINTSexists but it's not easy to use for most people and until overwriting build requirements gets easier this would be the only option.jaraco commentedon May 27, 2025
Acknowledged. And if there's a scenario that warrants this bridge, we'll deal with it then.
Avasam commentedon Jun 1, 2025
FWIW, there's already an issue opened concerning distributing
pkg_resourcesseparatly: #863Although nowadays the answer might be "use importlib_metadata".
mauritsvanrees commentedon Jun 4, 2025
I am maintaining
zc.buildout. This still heavily depends onpkg_resources. See buildout/buildout#685. As described in that ticket, theoretically it might be possible to get rid of this dependency, but likely this needs breaking changes in the whole ecosystem of Buildout extensions and recipes. This breakage would probably not be worth the trouble.So for Buildout it could be useful to have a backport of
pkg_resourcesavailable.Alternatively, I am pondering to just copy the current
pkg_resourcespackage tozc.buildout. I just did the same for the removedpackage_index.pymodule.Note that supporting
pkg_resourcesnamespaces could also be a reason for a backport package. But for my part (speaking as Plone release manager), the Zope and Plone communities are working on updating our packages to move to native namespaces. We want them completely gone in Plone 6.2, which is expected in the fall of this year. It could prove more difficult for Plone add-ons, which are often using thecollective.*namespace. So a backport could have value there.For the record, you can install Zope and Plone just fine with
pip, and many are using just that, plus some other tooling. But Buildout has useful constructs that go beyond merely installing packages, so old farts like me still appreciate it. ;-)jaraco commentedon Feb 8, 2026
Since setuptools no longer relies on pkg_resources, I'm going to close this issue. We can use #863 to track the publishing of a separate pkg_resources backport package.
CAM-Gerlach commentedon Feb 8, 2026
Hey @jaraco , seems the
pkg_resourcesdocumentation needs an update as it still listspkg_resourcesas only "deprecated", with no mention of it actually being removed (nor active plans for its removal). That was my first port of call to check for its removal when the Lektor-based build system of our legacy site broke (in star-fleet-tours/star-fleet-tours-website#101 ) due to missingpkg_resources, since I recalled you'd deprecated it, but as I didn't see anything there I checked into a few other things before checking the changelog.I'd offer to contribute a PR, but I'm traveling at the moment and I figure you know what you want to say as the maintainer and all :)
abravalheri commentedon Feb 9, 2026
@CAM-Gerlach, would #5173 solve the problem?
python 3.9+, ansible: pin setuptools 80.9.0 (pkg_resources), fatal im…