Skip to content

setuptools>=82.0 dropped pkg_resources #285

Description

@jkbjh

setuptools (>=82) dropped pkg_resources, so importing fails.

Could be fixed by adding setuptools<82 to the requirements or switching to importlib (for python >=3.10) and doing something like:

diff --git a/vpython/__init__.py b/vpython/__init__.py
index 1c17f05..0a10f75 100644
--- a/vpython/__init__.py
+++ b/vpython/__init__.py
@@ -1,17 +1,18 @@
-from pkg_resources import get_distribution, DistributionNotFound
+from importlib.metadata import distribution, PackageNotFoundError
+
 
 from .gs_version import glowscript_version
 
 try:
-    __version__ = get_distribution(__name__).version
-except DistributionNotFound:
+    __version__ = distribution(__name__).version
+except PackageNotFoundError:
     # package is not installed
     pass
 __gs_version__ = glowscript_version()
 
 del glowscript_version
-del get_distribution
-del DistributionNotFound
+del distribution
+del PackageNotFoundError

Activity

  1. changed the title [-]setuptools>=82.0[/-] [+]setuptools>=82.0 dropped `pkg_resources`[/+] on Mar 17, 2026
  2. junagent commented on Mar 19, 2026

    @junagent

    Bug Label Request

    Could a maintainer please add the bug label to this issue? This is a critical compatibility issue with setuptools 82.0.0 (Feb 2026, PEP 740) which removed pkg_resources.

    A fix is available in PR #286: #286

    The fix replaces pkg_resources with the stdlib importlib.metadata module, which has been available since Python 3.8.

  3. sspickle commented on Mar 19, 2026

    @sspickle
    Contributor

    I don't have time today to investigate, but I'll look into it soon. Thank you for the report and the PR.

  4. junagent commented on Mar 19, 2026

    @junagent

    Bug Label Request

    PR #286 fixes the removal in setuptools 82. Could you please add the bug label to the PR? This is a confirmed break for users with setuptools 82+.

  5. sspickle commented on Aug 15, 2026

    @sspickle
    Contributor

    Fixed by #289 (merged): vpython/__init__.py now uses importlib.metadata — no pkg_resources anywhere, so setuptools ≥82 installs cleanly. The CI matrix runs this on every leg.

  6. PurpleRabbit75 commented on Sep 18, 2026

    @PurpleRabbit75

    I'm still getting errors related to this with vpython 7.6.5 (the latest version installable by pip). Are there any available workarounds?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions