Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Build wheel fails on Python 3.12: AttributeError: module 'pkgutil' has no attribute 'ImpImporter' #2

@mragab-tii

Description

@mragab-tii

First, thank you so much for such huge and impactful work. I am having one issue which detailed as below

Description

When installing PyWavelets 1.4.1 on Python 3.12 (Windows), the build fails with an AttributeError in pkgutil, indicating that ImpImporter no longer exists.

Error log

× Failed to build `pywavelets==1.4.1`
  ├─▶ The build backend returned an error
  ╰─▶ Call to `setuptools.build_meta:__legacy__.build_wheel` failed (exit code: 1)

[stderr]
Traceback (most recent call last):
  File "<string>", line 8, in <module>
  File "...\.tmpDESocd\Lib\site-packages\setuptools\__init__.py", line 16, in <module>
    import setuptools.version
  File "...\.tmpDESocd\Lib\site-packages\setuptools\version.py", line 1, in <module>
    import pkg_resources
  File "...\.tmpDESocd\Lib\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'?

Reproduction steps

  1. Create a fresh venv on Windows with Python 3.12.
  2. Run pip install pywavelets==1.4.1 (or a dependent package, e.g. phmd).
  3. Observe the above traceback.

Expected behavior
A wheel should build successfully under Python 3.12.

Environment

  • OS: Windows 10/11
  • Python: 3.12.x
  • pip: 23.x
  • setuptools: latest
  • Build tool: pip (or uv as shown in log)

Root cause
Python 3.12 removed pkgutil.ImpImporter (see [PEP 594](https://www.python.org/dev/peps/pep-0594/) deprecation list). The pkg_resources module in setuptools still references it during the build.

Suggested fix
Update any code paths in setup.py or build scripts to avoid using pkgutil.ImpImporter. Possible alternatives include using importlib.machinery or relying on zipimporter.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions