Skip to content

Bug: conda-forge Python 3.13 | ModuleNotFoundError: No module named 'pkg_resources' #1218

Closed
@drewyangdev

Description

@drewyangdev

Bug Report

Description

While working with conda-forge release, I found the datajoint-feedtest test would fail for me on python 3.13

python -c 'import datajoint as dj; assert dj.diagram.diagram_active'
# ModuleNotFoundError: No module named 'pkg_resources'

Reproducibility

Include:

  • OS (Linux)
  • Python Version 3.13
  • DataJoint Version Unreleased 3e39771
  • Minimum number of steps to reliably reproduce the issue
which conda
# /home/drewyang/miniconda3/condabin/conda
conda --version
# conda 25.1.1
conda create -n dj313 -c conda-forge python=3.13 # installed from conda-forge instead of the defaults channel 'conda-forge/linux-64::python-3.13.2-hf636f53_101_cp313'
conda activate dj313
# cd <datajoint-python repo>
git checkout 3e3977147aedcef735561427664a4c7a81d3862f # latest master as of 20250320
pip install -e .
python -c 'import datajoint as dj; assert dj.diagram.diagram_active'
  • Complete error stack as a result of evaluating the above steps
Traceback (most recent call last):
  File "<string>", line 1, in <module>
    import datajoint as dj; assert dj.diagram.diagram_active
    ^^^^^^^^^^^^^^^^^^^^^^
  File "/home/drewyang/Documents/DataJoint/datajoint-python/datajoint/__init__.py", line 59, in <module>
    from .admin import kill, set_password
  File "/home/drewyang/Documents/DataJoint/datajoint-python/datajoint/admin.py", line 7, in <module>
    from .connection import conn
  File "/home/drewyang/Documents/DataJoint/datajoint-python/datajoint/connection.py", line 19, in <module>
    from .plugin import connection_plugins
  File "/home/drewyang/Documents/DataJoint/datajoint-python/datajoint/plugin.py", line 4, in <module>
    import pkg_resources
ModuleNotFoundError: No module named 'pkg_resources'

Expected Behavior

which conda
# /home/drewyang/miniconda3/condabin/conda
conda --version
# conda 25.1.1
conda create -n dj312 -c conda-forge python=3.12 # installed from conda-forge instead of the defaults channel 'conda-forge/linux-64::python-3.13.2-hf636f53_101_cp313'
conda activate dj312
# cd <datajoint-python repo>
git checkout 3e3977147aedcef735561427664a4c7a81d3862f # latest main as of 20250320
pip install -e .
python -c 'import datajoint as dj; assert dj.diagram.diagram_active'

# No output or error

Additional Research and Context

setuptools isn't a default dependency of Python 3.13 anymore, suggest to add to the pyproject.toml.
However, I also tried the same on Mac, which installed the conda default channel's python 3.13 for osx-64, it does include setuptools, which didn't cause the same issue.

I suggest we explicitly include setuptools in pyproject.yaml as a dependency(not a build dependency, but a package dependency)

Also setuptools.pkg_resources will be deprecated.

Use of pkg_resources is deprecated in favor of importlib.resources, importlib.metadata and their backports (importlib_resources, importlib_metadata). Some useful APIs are also provided by packaging (e.g. requirements and version parsing). Users should refrain from new usage of pkg_resources and should work to port to importlib-based solutions.

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