Skip to content

Python 3.12: ModuleNotFoundError: No module named 'distutils' #22

@hugovk

Description

@hugovk

With Python 3.12:

Python 3.12.1 (v3.12.1:2305ca5144, Dec  7 2023, 17:23:38) [Clang 13.0.0 (clang-1300.0.29.30)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> import calmap
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/Library/Frameworks/Python.framework/Versions/3.12/lib/python3.12/site-packages/calmap/__init__.py", line 18, in <module>
    from distutils.version import StrictVersion
ModuleNotFoundError: No module named 'distutils'

This is because distutils is no longer part of Python from 3.12 onwards:

A workaround is to install Setuptools, but the recommended advice to to replace distutils.version with the modern packaging.version API:

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions