Skip to content

Failure of submitit 1.5.1 with python 3.12 because of missing pkg_resources #1765

Open
@GianlucaFicarelli

Description

@GianlucaFicarelli

From https://setuptools.pypa.io/en/latest/pkg_resources.html

Use of pkg_resources is deprecated in favor of importlib.resources, importlib.metadata and their backports

In python 3.12, setuptools isn't installed automatically, so pkg_resources might not be available, and submitit will fail.
For example, in a clean python 3.12 venv (without setuptools installed):

❯ pip list
Package           Version
----------------- -------
cloudpickle       3.0.0
pip               24.0
submitit          1.5.1
typing_extensions 4.11.0
>>> from submitit.core.plugins import get_executors
>>> get_executors()
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/private/tmp/venv/lib/python3.12/site-packages/submitit/core/plugins.py", line 65, in get_executors
    return {ex.name(): ex for ex in _get_plugins()[0]}
                                    ^^^^^^^^^^^^^^
  File "/private/tmp/venv/lib/python3.12/site-packages/submitit/core/plugins.py", line 24, in _get_plugins
    import pkg_resources
ModuleNotFoundError: No module named 'pkg_resources'

Needed fix: pkg_resources should be replaced by importlib.
In the meantime, a temporary workaround is to explicitly install setuptools

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions