Skip to content

distutils is removed in python 3.12 #379

@simokamaa

Description

@simokamaa

Bug Report: distutils is Removed in Python 3.12

Describe the bug

The distutils package, which includes StrictVersion, has been removed in Python 3.12. This causes issues in applications that rely on StrictVersion from distutils.version for version comparison, leading to import errors or broken functionality.

To Reproduce

Steps to reproduce the behavior:

  1. Use Python 3.12.
  2. Run a Django project that imports StrictVersion from distutils.version.
  3. Observe the import error caused by the removal of distutils.

Expected behavior

The code should work without import errors and continue to perform version comparisons as expected. Ideally, the use of StrictVersion should be replaced with a compatible alternative that works in Python 3.12, such as Version from the packaging.version module.

Screenshots

Not applicable for this issue.

System (please complete the following information):

  • OS: [e.g. Ubuntu 22.04]
  • Python version: 3.12
  • Lib version: [e.g. Django 4.2, notifications 1.8.2]

Additional context

The recommended fix is to replace StrictVersion with Version from the packaging.version module, as distutils is deprecated and removed in Python 3.12. This ensures compatibility with the latest Python versions.

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