Skip to content

ImportError: cannot import name 'read_binary' from 'importlib.resources'  #2953

@TriAttack238

Description

@TriAttack238
  • I have searched the issue tracker and believe that this is not a duplicate.

Make sure you run commands with -v flag before pasting the output.

Steps to reproduce

  1. Install pipx using py -m pip install --user pipx
  2. Type 'pipx install pdm`
  3. After installation, type pdm --version

Actual behavior

  File "<frozen runpy>", line 198, in _run_module_as_main
  File "<frozen runpy>", line 88, in _run_code
  File "C:\Users\seank\.local\bin\pdm.exe\__main__.py", line 4, in <module>
    from pdm.core import main
  File "C:\Users\seank\pipx\venvs\pdm\Lib\site-packages\pdm\core.py", line 32, in <module>
    from pdm.installers import InstallManager, Synchronizer
  File "C:\Users\seank\pipx\venvs\pdm\Lib\site-packages\pdm\installers\__init__.py", line 2, in <module>
    from pdm.installers.manager import InstallManager
  File "C:\Users\seank\pipx\venvs\pdm\Lib\site-packages\pdm\installers\manager.py", line 8, in <module>
    from pdm.installers.installers import install_wheel
  File "C:\Users\seank\pipx\venvs\pdm\Lib\site-packages\pdm\installers\installers.py", line 10, in <module>
    from installer import install as _install
  File "C:\Users\seank\pipx\venvs\pdm\Lib\site-packages\installer\__init__.py", line 6, in <module>
    from installer._core import install  # noqa
    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\seank\pipx\venvs\pdm\Lib\site-packages\installer\_core.py", line 7, in <module>
    from installer.destinations import WheelDestination
  File "C:\Users\seank\pipx\venvs\pdm\Lib\site-packages\installer\destinations.py", line 19, in <module>
    from installer.scripts import Script
  File "C:\Users\seank\pipx\venvs\pdm\Lib\site-packages\installer\scripts.py", line 6, in <module>
    from importlib.resources import read_binary
ImportError: cannot import name 'read_binary' from 'importlib.resources' (C:\Users\seank\AppData\Local\Programs\Python\Python313\Lib\importlib\resources\__init__.py)

Expected behavior

Version is supposed to be displayed

Environment Information

Python 3.13.0a5
Windows 11

# Paste the output of `pdm info && pdm info --env` below:
See Actual Behavior

As far as I understand, the reason why the program is failing is because importlib.resources.read_binary was actually deprecriated and replaced in Python 3.11. For some reason, this bug also occurs after installing pdm through the recommended powershell command.

Metadata

Metadata

Assignees

No one assigned

    Labels

    🐛 bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions