Skip to content

fix: use setuptools>=68.0.0 for Python 3.12+ (distutils removed)#1222

Open
molhamfetnah wants to merge 196 commits intoopencv:masterfrom
molhamfetnah:fix/distutils-python-312
Open

fix: use setuptools>=68.0.0 for Python 3.12+ (distutils removed)#1222
molhamfetnah wants to merge 196 commits intoopencv:masterfrom
molhamfetnah:fix/distutils-python-312

Conversation

@molhamfetnah
Copy link
Copy Markdown

Summary

  • Fix Python 3.12+ compatibility issue where ModuleNotFoundError: No module named distutils occurs during installation
  • Updated pyproject.toml to require setuptools>=68.0.0 for Python 3.12+
  • Python 3.12 removed distutils from stdlib; setuptools>=68 bundles distutils in setuptools._distutils

Changes

  • pyproject.toml: Changed setuptools<70.0.0 to setuptools>=68.0.0 for Python 3.12+

Root Cause

Python 3.12 removed distutils from the standard library. Older setuptools versions still rely on import distutils internally, causing failures on Python 3.12+. setuptools 68.0.0+ includes setuptools._distutils which provides the needed compatibility layer.

Testing

Compatibility

  • Python 3.12+: Uses setuptools>=68.0.0 (includes distutils compatibility)
  • Python <3.12: Uses existing setuptools==59.2.0 (unchanged)

cc: @opencv-python/admins

asenyaev and others added 30 commits July 29, 2022 18:13
* Scheduled rolling workflows

* Fixed a bug in commit/date for package version

* Changed the name of Windows pipelines
* Scheduled rolling workflows

* Fixed a bug in commit/date for package version

* Changed the name of Windows pipelines
* Added zlib build from the source on Linux, handling auditwheel issues

* Removed unused variable

* Removed bzip2 from dependencies for OpenCV Python packages
…) (opencv#718)

* Added zlib build from the source on Linux, handling auditwheel issues

* Removed unused variable

* Removed bzip2 from dependencies for OpenCV Python packages
…n_win

Stick to CMake 3.24 on Windows to work around 3.25 regression
avdivan and others added 24 commits December 10, 2025 13:47
---------
Co-authored-by: Alexander Smorkalov <alexander.smorkalov@opencv.ai>
…_4.13.0

Dependencies update for 4.13.0 release.
Switched MacOS Intel builds to own host
…_headless

Disable libavdevice for headless builds on Linux to get rid of X libs dependency
Python 3.12 removed distutils from stdlib. setuptools>=68 includes
the distutils module in setuptools._distutils, ensuring compatibility
with Python 3.12+ builds.
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot encountered an error and was unable to review this pull request. You can try again by re-requesting a review.

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 this pull request may close these issues.