Python 3.12 "no module pkg_resources"
PmasonFF opened this issue · 0 comments
The latest Python release 3.12 no longer has a pkg_resources module by default, and this module is need for the panoptes client package.
Attempts to run the client with Python 3.12 result in an error :"no module pkg_resources".
From the Whats new in Python 3.12
Important deprecations, removals or restrictions:
....
[PEP 632](https://peps.python.org/pep-0632/): Remove the distutils package. See [the migration guide](https://peps.python.org/pep-0632/#migration-advice) for advice replacing the APIs it provided. The third-party [Setuptools](https://setuptools.pypa.io/en/latest/deprecated/distutils-legacy.html) package continues to provide distutils, if you still require it in Python 3.12 and beyond.
[gh-95299](https://github.com/python/cpython/issues/95299): Do not pre-install setuptools in virtual environments created with [venv](https://docs.python.org/3/library/venv.html#module-venv). This means that distutils, setuptools, pkg_resources, and easy_install will no longer available by default; to access these run pip install setuptools in the [activated](https://docs.python.org/3/library/venv.html#venv-explanation) virtual environment.
....
There are various ways of obtaining the module, but running
pip install setuptools
before installing the cli seems to work (And for windows users pip install python-magic-bin as the last step to deal with the libmagic warning).
Some other appilcations that used pkg_resources are fixing the issue by including setuptools as a dependency - example:
Becksteinlab/GromacsWrapper#271
This issue has also been raised a issue 257 for the panoptes cli zooniverse/panoptes-cli#257