Skip to content

Incompatible setuptools==59.2.0 with Python 3.12 due to pkgutil.ImpImporter removal for version 84. #1096

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
ramnathnayak-ibm opened this issue Apr 28, 2025 · 0 comments

Comments

@ramnathnayak-ibm
Copy link

Description

When attempting to install opencv-python-headless for the version 4.10.0.84 or 84 using pip install . on Python 3.12 (specifically tested on ppc64le architecture), the installation fails with the following error:

  File "E:\dev\py\Lib\site-packages\pip\_vendor\pyproject_hooks\_in_process\_in_process.py", line 353, in <module>
            main()
          File "E:\dev\py\Lib\site-packages\pip\_vendor\pyproject_hooks\_in_process\_in_process.py", line 335, in main
            json_out['return_val'] = hook(**hook_input['kwargs'])
                                     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
          File "E:\dev\py\Lib\site-packages\pip\_vendor\pyproject_hooks\_in_process\_in_process.py", line 112, in get_requires_for_build_wheel
            backend = _build_backend()
                      ^^^^^^^^^^^^^^^^
          File "E:\dev\py\Lib\site-packages\pip\_vendor\pyproject_hooks\_in_process\_in_process.py", line 77, in _build_backend
            obj = import_module(mod_path)
                  ^^^^^^^^^^^^^^^^^^^^^^^
          File "E:\dev\py\Lib\importlib\__init__.py", line 90, in import_module
            return _bootstrap._gcd_import(name[level:], package, level)
                   ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
          File "<frozen importlib._bootstrap>", line 1293, in _gcd_import
          File "<frozen importlib._bootstrap>", line 1266, in _find_and_load
          File "<frozen importlib._bootstrap>", line 1216, in _find_and_load_unlocked
          File "<frozen importlib._bootstrap>", line 400, in _call_with_frames_removed
          File "<frozen importlib._bootstrap>", line 1293, in _gcd_import
          File "<frozen importlib._bootstrap>", line 1266, in _find_and_load
          File "<frozen importlib._bootstrap>", line 1237, in _find_and_load_unlocked
          File "<frozen importlib._bootstrap>", line 841, in _load_unlocked
          File "<frozen importlib._bootstrap_external>", line 994, in exec_module
          File "<frozen importlib._bootstrap>", line 400, in _call_with_frames_removed
          File "C:\Users\shikingram\AppData\Local\Temp\pip-build-env-pk9ws81z\overlay\Lib\site-packages\setuptools\__init__.py", line 16, in <module>
            import setuptools.version
          File "C:\Users\shikingram\AppData\Local\Temp\pip-build-env-pk9ws81z\overlay\Lib\site-packages\setuptools\version.py", line 1, in <module>
            import pkg_resources
          File "C:\Users\shikingram\AppData\Local\Temp\pip-build-env-pk9ws81z\overlay\Lib\site-packages\pkg_resources\__init__.py", line 2172, in <module>
            register_finder(pkgutil.ImpImporter, find_on_path)
                            ^^^^^^^^^^^^^^^^^^^
        AttributeError: module 'pkgutil' has no attribute 'ImpImporter'. Did you mean: 'zipimporter'?
        [end of output]
  
    note: This error originates from a subprocess, and is likely not a problem with pip.
  error: subprocess-exited-with-error

This is due to setuptools==59.2.0 relying on pkgutil.ImpImporter, which has been removed in Python 3.12 (Python 3.12 changelog).

Reproduction

  1. Set up a Python 3.12 virtual environment
  2. Run pip install . in the opencv-python-headless source directory for the version 84.
  3. Build fails due to incompatible setuptools version

Diagnosis

Older versions (e.g. 84) of the project set:

requires = ["setuptools==59.2.0"]

In the newer version i.e. 86 this is taken care of:

requires = ["setuptools<70.0.0; python_version>='3.12'"]

Would you like me to check if an issue or PR already exists for this, or help prepare a PR?

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

No branches or pull requests

1 participant