Becksteinlab / GromacsWrapper

GromacsWrapper wraps system calls to GROMACS tools into thin Python classes (GROMACS 4.6.5 - 2024 supported).
https://gromacswrapper.readthedocs.org
GNU General Public License v3.0
169 stars 53 forks source link

Python 3.12: No module named 'pkg_resources' #263

Closed njzjz closed 12 months ago

njzjz commented 1 year ago
  File "/opt/hostedtoolcache/Python/3.12.0/x64/lib/python3.12/site-packages/gromacs/__init__.py", line 218, in <module>
    from . import config
  File "/opt/hostedtoolcache/Python/3.12.0/x64/lib/python3.12/site-packages/gromacs/config.py", line 266, in <module>
    from pkg_resources import resource_filename, resource_listdir
ModuleNotFoundError: No module named 'pkg_resources'

pkg_resources is a part of setuptools, and https://github.com/python/cpython/issues/95299 removes setuptools from Python environments. It needs to be manually added to the requirements.

orbeckst commented 1 year ago

Probably better to replace it with importlib anyway.

orbeckst commented 1 year ago

p.s.: PRs welcome :-)

jandom commented 12 months ago

'importlib' is not my forte, so i'm not going to venture into this, unless with a help from ChatGPT... For now can we get started with declaring the dependency on setuptools? That's easy enough to add.

I've had issues reproducing the bug because setuptools are installed (somehow) when creating a developer env using the test_env.yaml

orbeckst commented 12 months ago

Band-aid is good enough — if you have a fix, please do a PR!

In MDAnalysisData we recently did the replacement https://github.com/MDAnalysis/MDAnalysisData/pull/76

path = importlib.resources.files('MDAnalysisData') / description_dir / filename

jandom commented 12 months ago

Okay, here is my proposed band-aid https://github.com/Becksteinlab/GromacsWrapper/pull/271/