Skip to content

Bug: Import error for pkg_resources #1394

Closed

Description

@samuelbray32

Bug Report

Description

  • In fresh environment with datajoint installed, I hit an import error for pkg_resources here
  • Likely due to removal of pkg_resources in setuptool=82.0.0 release yesterday

Reproducibility

Include:

  • Linux
  • Python Version 3.13
  • DataJoint = 0.14.8
  • Minimum number of steps to reliably reproduce the issue:
import datajoint
  • Error Stack
---------------------------------------------------------------------------
ModuleNotFoundError                       Traceback (most recent call last)
Cell In[2], line 1
----> 1 import datajoint as dj

File ~/mambaforge-pypy3/envs/dj_test_313/lib/python3.13/site-packages/datajoint/__init__.py:59
     20 __all__ = [
     21     "__author__",
     22     "__version__",
   (...)     55     "cli",
     56 ]
     58 from . import errors
---> 59 from .admin import kill, set_password
     60 from .attribute_adapter import AttributeAdapter
     61 from .blob import MatCell, MatStruct

File ~/mambaforge-pypy3/envs/dj_test_313/lib/python3.13/site-packages/datajoint/admin.py:7
      4 import pymysql
      5 from packaging import version
----> 7 from .connection import conn
      8 from .settings import config
      9 from .utils import user_choice

File ~/mambaforge-pypy3/envs/dj_test_313/lib/python3.13/site-packages/datajoint/connection.py:19
     17 from .dependencies import Dependencies
     18 from .hash import uuid_from_buffer
---> 19 from .plugin import connection_plugins
     20 from .settings import config
     21 from .version import __version__

File ~/mambaforge-pypy3/envs/dj_test_313/lib/python3.13/site-packages/datajoint/plugin.py:4
      1 import logging
      2 from pathlib import Path
----> 4 import pkg_resources
      5 from cryptography.exceptions import InvalidSignature
      6 from otumat import hash_pkg, verify

ModuleNotFoundError: No module named 'pkg_resources'

Activity

  1. added
    bugIndicates an unexpected problem or unintended behavior
    triageIndicates issues, pull requests, or discussions need to be reviewed for the first time
    on Feb 9, 2026
  2. removed
    triageIndicates issues, pull requests, or discussions need to be reviewed for the first time
    on Feb 11, 2026
  3. dimitri-yatsenko commented on Feb 11, 2026

    @dimitri-yatsenko
    Member

    Analysis

    The pkg_resources module was removed from setuptools 82.0.0 (released Feb 10, 2026). DataJoint 0.14's plugin.py imports it directly for plugin discovery and verification.

    Current usage in plugin.py:

    import pkg_resources
    
    # Distribution metadata
    base_meta = pkg_resources.get_distribution(base_name)
    plugin_meta = pkg_resources.get_distribution(plugin_name)
    
    # Package paths for signature verification
    plugin_meta.module_path
    base_meta.egg_info
    plugin_meta.get_metadata(f"{plugin_name}.sig")
    
    # Entry point discovery
    pkg_resources.iter_entry_points("datajoint_plugins.{}".format(category))

    Solution options

    Option Pros Cons
    Pin setuptools<82 Minimal change, quick fix Temporary; blocks newer setuptools
    Migrate to importlib.metadata Proper fix, uses stdlib More code changes; module_path and egg_info equivalents require workarounds

    Recommendation

    Since 0.14.x is approaching end of life and this was properly addressed in DataJoint 2.x (which uses importlib.metadata), we'll go with the minimal fix: pin setuptools<82 in the runtime dependencies.

    This unblocks users immediately while they transition to 2.x.

  4. added 2 commits that reference this issue on Feb 11, 2026
    914db72
    41b1a4d
  5. samuelbray32 commented on Feb 12, 2026

    @samuelbray32
    Author

    Thanks! Just to know if I should add a version pin of setuptools on our package's end; Do you plan on a 0.14 patch release with this?

  6. dimitri-yatsenko commented on Feb 13, 2026

    @dimitri-yatsenko
    Member

    Yes, I will release this as 0.14.9 or 0.14.10 tomorrow.

  7. CBroz1 commented on Feb 13, 2026

    @CBroz1
    Contributor

    since 0.14.x is approaching end of life

    Is there a set date for the 0.14.x EOL?

  8. dimitri-yatsenko commented on Feb 17, 2026

    @dimitri-yatsenko
    Member

    Merging #1400 and cutting 0.14.9

  9. dimitri-yatsenko commented on Feb 17, 2026

    @dimitri-yatsenko
    Member
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Labels

bugIndicates an unexpected problem or unintended behavior

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions