zooniverse / panoptes-cli

A command-line interface for Panoptes
Apache License 2.0
18 stars 5 forks source link

Python 3.12 "no module pkg_resources" #257

Closed PmasonFF closed 1 month ago

PmasonFF commented 9 months ago

The latest Python release 3.12 no longer has a pkg_resources module by default, and this module is need for the cli via the panoptes client package.
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 prior to installing the cli seems to resolve the issue. (And for windows users pip install python-magic-bin as the last step to eliminate the libmagic warning.)

Some other appilcations that used pkg_resources are fixing the issue by including setuptools as a dependency - example: https://github.com/Becksteinlab/GromacsWrapper/pull/271

Pmason

arw36 commented 6 months ago

Ugh also dealing with this issue... Yes, uninstalling both then re-installing setuptools then panoptescli seems to work.