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

Python 3.12: AttributeError: module 'pkgutil' has no attribute 'ImpImporter'. Did you mean: 'zipimporter'? #23

Closed
wallrite opened this issue Apr 18, 2024 · 2 comments

Comments

@wallrite
Copy link

wallrite commented Apr 18, 2024

Hello,

Trying to use pyinstaller on windows 11 and python 3.12.
Got next exception:

Traceback (most recent call last):
  File "<frozen runpy>", line 198, in _run_module_as_main
  File "<frozen runpy>", line 88, in _run_code
  File "C:\Users\valeriyi\AppData\Local\pypoetry\Cache\virtualenvs\pg-device-config-server-SeUiqVb2-py3.12\Scripts\pyinstaller.exe\__main__.py", line 7, in <module>
  File "C:\Users\valeriyi\AppData\Local\pypoetry\Cache\virtualenvs\pg-device-config-server-SeUiqVb2-py3.12\Lib\site-packages\PyInstaller\__main__.py", line 228, in _console_script_run
    run()
  File "C:\Users\valeriyi\AppData\Local\pypoetry\Cache\virtualenvs\pg-device-config-server-SeUiqVb2-py3.12\Lib\site-packages\PyInstaller\__main__.py", line 170, in run
    parser = generate_parser()
             ^^^^^^^^^^^^^^^^^
  File "C:\Users\valeriyi\AppData\Local\pypoetry\Cache\virtualenvs\pg-device-config-server-SeUiqVb2-py3.12\Lib\site-packages\PyInstaller\__main__.py", line 136, in generate_parser
    import PyInstaller.building.build_main
  File "C:\Users\valeriyi\AppData\Local\pypoetry\Cache\virtualenvs\pg-device-config-server-SeUiqVb2-py3.12\Lib\site-packages\PyInstaller\building\build_main.py", line 28, in <module>
    from PyInstaller.building.api import COLLECT, EXE, MERGE, PYZ
  File "C:\Users\valeriyi\AppData\Local\pypoetry\Cache\virtualenvs\pg-device-config-server-SeUiqVb2-py3.12\Lib\site-packages\PyInstaller\building\api.py", line 32, in <module>
    from PyInstaller.building.splash import Splash  # argument type validation in EXE
    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\valeriyi\AppData\Local\pypoetry\Cache\virtualenvs\pg-device-config-server-SeUiqVb2-py3.12\Lib\site-packages\PyInstaller\building\splash.py", line 23, in <module>
    from PyInstaller.depend import bindepend
  File "C:\Users\valeriyi\AppData\Local\pypoetry\Cache\virtualenvs\pg-device-config-server-SeUiqVb2-py3.12\Lib\site-packages\PyInstaller\depend\bindepend.py", line 25, in <module>
    from PyInstaller.depend import dylib, utils
  File "C:\Users\valeriyi\AppData\Local\pypoetry\Cache\virtualenvs\pg-device-config-server-SeUiqVb2-py3.12\Lib\site-packages\PyInstaller\depend\utils.py", line 31, in <module>
    from PyInstaller.lib.modulegraph import modulegraph
  File "C:\Users\valeriyi\AppData\Local\pypoetry\Cache\virtualenvs\pg-device-config-server-SeUiqVb2-py3.12\Lib\site-packages\PyInstaller\lib\modulegraph\modulegraph.py", line 34, in <module>
    from altgraph.ObjectGraph import ObjectGraph
  File "C:\Users\valeriyi\AppData\Local\pypoetry\Cache\virtualenvs\pg-device-config-server-SeUiqVb2-py3.12\Lib\site-packages\altgraph\__init__.py", line 142, in <module>
    import pkg_resources
  File "C:\Users\valeriyi\AppData\Local\pypoetry\Cache\virtualenvs\pg-device-config-server-SeUiqVb2-py3.12\Lib\site-packages\pkg_resources\__init__.py", line 2158, in <module>
    register_finder(pkgutil.ImpImporter, find_on_path)
                    ^^^^^^^^^^^^^^^^^^^
AttributeError: module 'pkgutil' has no attribute 'ImpImporter'. Did you mean: 'zipimporter'?

The root cause is from here:

importlib.abc.Finder, pkgutil.ImpImporter, and pkgutil.ImpLoader have been removed. (Contributed by Barry Warsaw in gh-98040.)

@ronaldoussoren
Copy link
Owner

You probably need to upgrade setuptools, pkg_resources is part of the the setuptools package and not of altgraph

@wallrite
Copy link
Author

Hi, @ronaldoussoren,

Indeed, upgrading setuptools helped:
Updating setuptools (57.4.0 -> 69.5.1)

Thank you!

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

2 participants