Skip to content
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

[BUG]: Python 3.12 will remove deprecated ImpImporter from pgkutil #4646

Closed
3 tasks done
tacaswell opened this issue May 1, 2023 · 4 comments
Closed
3 tasks done
Labels
triage New bug, unverified

Comments

@tacaswell
Copy link

Required prerequisites

What version (or hash if on master) of pybind11 are you using?

main

Problem description

Processing /home/tcaswell/source/p/pybind/pybind11
  Preparing metadata (pyproject.toml): started
  Preparing metadata (pyproject.toml): finished with status 'error'

  error: subprocess-exited-with-error

  × Preparing metadata (pyproject.toml) did not run successfully.
  │ exit code: 1
  ╰─> [33 lines of output]
      Traceback (most recent call last):
        File "/home/tcaswell/.virtualenvs/bleeding/lib/python3.12/site-packages/pip/_vendor/pyproject_hooks/_in_process/_in_process.py", line 353, in <module>
          main()
        File "/home/tcaswell/.virtualenvs/bleeding/lib/python3.12/site-packages/pip/_vendor/pyproject_hooks/_in_process/_in_process.py", line 335, in main
          json_out['return_val'] = hook(**hook_input['kwargs'])
                                   ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
        File "/home/tcaswell/.virtualenvs/bleeding/lib/python3.12/site-packages/pip/_vendor/pyproject_hooks/_in_process/_in_process.py", line 142, in prepare_metadata_for_build_wheel
          backend = _build_backend()
                    ^^^^^^^^^^^^^^^^
        File "/home/tcaswell/.virtualenvs/bleeding/lib/python3.12/site-packages/pip/_vendor/pyproject_hooks/_in_process/_in_process.py", line 77, in _build_backend
          obj = import_module(mod_path)
                ^^^^^^^^^^^^^^^^^^^^^^^
        File "/home/tcaswell/.pybuild/bleeding/lib/python3.12/importlib/__init__.py", line 124, in import_module
          return _bootstrap._gcd_import(name[level:], package, level)
                 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
        File "<frozen importlib._bootstrap>", line 1332, in _gcd_import
        File "<frozen importlib._bootstrap>", line 1305, in _find_and_load
        File "<frozen importlib._bootstrap>", line 1255, in _find_and_load_unlocked
        File "<frozen importlib._bootstrap>", line 400, in _call_with_frames_removed
        File "<frozen importlib._bootstrap>", line 1332, in _gcd_import
        File "<frozen importlib._bootstrap>", line 1305, in _find_and_load
        File "<frozen importlib._bootstrap>", line 1276, in _find_and_load_unlocked
        File "<frozen importlib._bootstrap>", line 841, in _load_unlocked
        File "<frozen importlib._bootstrap_external>", line 1027, in exec_module
        File "<frozen importlib._bootstrap>", line 400, in _call_with_frames_removed
        File "/home/tcaswell/.virtualenvs/bleeding/lib/python3.12/site-packages/setuptools/__init__.py", line 16, in <module>
          import setuptools.version
        File "/home/tcaswell/.virtualenvs/bleeding/lib/python3.12/site-packages/setuptools/version.py", line 1, in <module>
          import pkg_resources
        File "/home/tcaswell/.virtualenvs/bleeding/lib/python3.12/site-packages/pkg_resources/__init__.py", line 2191, 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: metadata-generation-failed

This was caused by python/cpython#98573

Reproducible example code

Try to install pybind11 on development branch of CPython.

Is this a regression? Put the last known working version here if it is.

unlikely any version will work

@tacaswell tacaswell added the triage New bug, unverified label May 1, 2023
@tacaswell
Copy link
Author

Sigh, re-reading the error message a bit more carefully 15s after I posted I see that this is actually in setuptools.

Sorry for the noise.

@statetroopee
Copy link

Hello there,

I'm really new to python and I'm facing the same problem. How did you manage to solve this issue?

@tacaswell
Copy link
Author

If I recall correctly, update setuptools. However if you are new to Python I am curious how you have ended up with a pre-release version of CPython (3.12 is not out yet).

You may be better served by using a released version (that will have built binary artifacts available via what ever package manager you prefer).

@RuthKassahun
Copy link

Downgrading to python==3.11 might help

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
triage New bug, unverified
Projects
None yet
Development

No branches or pull requests

3 participants