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

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

Closed
1 task done
TriAttack238 opened this issue Jun 18, 2024 · 4 comments
Closed
1 task done
Labels
🐛 bug Something isn't working

Comments

@TriAttack238
Copy link

  • 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.

@TriAttack238 TriAttack238 added the 🐛 bug Something isn't working label Jun 18, 2024
@TriAttack238
Copy link
Author

Also, if I could have some guidance on how to uninstall PDM after installing with the powershell command, that would be greatly appreciated.

@frostming
Copy link
Collaborator

Can you report it to https://github.com/pypa/installer ?

Also, if I could have some guidance on how to uninstall PDM after installing with the powershell command, that would be greatly appreciated.

The installation script can be downloaded and executed separately, and it has additional options.

You can also do it by:

(Invoke-WebRequest -Uri https://pdm-project.org/install-pdm.py -UseBasicParsing).Content | py - --remove

@frostming frostming closed this as not planned Won't fix, can't repro, duplicate, stale Jun 19, 2024
@frostming
Copy link
Collaborator

frostming commented Jun 19, 2024

It turn out it has already been fixed on the main branch but pending a new release: pypa/installer#218

The issue will also be automatically resolved by upgrading to the latest 3.13rc version: python/cpython#116608

So we don't need to do anything for this.

@TriAttack238
Copy link
Author

That's good then, I just need to wait.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
🐛 bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants