Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Closed
yambottle opened this issue Mar 21, 2025 · 0 comments · Fixed by #1219
Closed
Assignees
Labels
bug Indicates an unexpected problem or unintended behavior in-progress Indicates work in progress

Comments

@yambottle
Copy link
Contributor

yambottle commented Mar 21, 2025

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.

@yambottle yambottle added bug Indicates an unexpected problem or unintended behavior triage Indicates issues, pull requests, or discussions need to be reviewed for the first time labels Mar 21, 2025
@yambottle yambottle removed the triage Indicates issues, pull requests, or discussions need to be reviewed for the first time label Mar 21, 2025
@github-actions github-actions bot added the triage Indicates issues, pull requests, or discussions need to be reviewed for the first time label Mar 21, 2025
@yambottle yambottle removed the triage Indicates issues, pull requests, or discussions need to be reviewed for the first time label Mar 21, 2025
@yambottle yambottle changed the title Bug: py3.13 | ModuleNotFoundError: No module named 'pkg_resources' Bug: conda-forge Python 3.13 | ModuleNotFoundError: No module named 'pkg_resources' Mar 21, 2025
@yambottle yambottle self-assigned this Mar 21, 2025
@yambottle yambottle added the in-progress Indicates work in progress label Mar 21, 2025
@yambottle yambottle linked a pull request Mar 21, 2025 that will close this issue
yambottle added a commit to yambottle/datajoint-python that referenced this issue Mar 24, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Indicates an unexpected problem or unintended behavior in-progress Indicates work in progress
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants