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

Python 3.12 "no module pkg_resources" #305

Closed
PmasonFF opened this issue Dec 18, 2023 · 0 comments · Fixed by #316
Closed

Python 3.12 "no module pkg_resources" #305

PmasonFF opened this issue Dec 18, 2023 · 0 comments · Fixed by #316

Comments

@PmasonFF
Copy link

PmasonFF commented Dec 18, 2023

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

@PmasonFF PmasonFF changed the title Python 3.12 "no module pkg_resources" in virtual environments Python 3.12 "no module pkg_resources" Dec 21, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant