Skip to content

FileNotFoundError: [Errno 2] No such file or directory #3345

Description

@Shui-meridian

Describe the bug

Hi,
When I try to use the command "pdm update".

I received a error :

FileNotFoundError: [Errno 2] No such file or directory: ~\\AppData\\Local\\pdm\\pdm\\Cache\\wheels\\........

And I try to use the "pdm chache clear" to fix it, and it didn't work.

And I found, there is no dictionary named "pdm" under "Local".

To reproduce

pdm update

Expected Behavior

use "pdm update"

Environment Information

PDM version:
  2.21.0
Python Interpreter:
****\python.exe (3.10)
Project Root:
****
Local Packages:
(empty)

{
  "implementation_name": "cpython",
  "implementation_version": "3.12.8",
  "os_name": "nt",
  "platform_machine": "AMD64",
  "platform_release": "11",
  "platform_system": "Windows",
  "platform_version": "10.0.26100",
  "python_full_version": "3.10.11",
  "platform_python_implementation": "CPython",
  "python_version": "3.10",
  "sys_platform": "win32"
}

Verbose Command Output

  ✖ Update *** 1.6.0 -> 1.6.0 failed
pdm.termui: Error occurs updating ***: 
Traceback (most recent call last):
  File "C:\Program Files\WindowsApps\PythonSoftwareFoundation.Python.3.12_3.12.2288.0_x64__qbz5n2kfra8p0\Lib\concurrent\futures\thread.py", line 59, in run
    result = self.fn(*self.args, **self.kwargs)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "~\pipx\venvs\pdm\Lib\site-packages\pdm\installers\synchronizers.py", line 50, in update_candidate
    self.manager.overwrite(dist, can)
  File "~\pipx\venvs\pdm\Lib\site-packages\pdm\installers\manager.py", line 62, in overwrite
    installed = self.install(candidate)
                ^^^^^^^^^^^^^^^^^^^^^^^
  File "~\pipx\venvs\pdm\Lib\site-packages\pdm\installers\manager.py", line 32, in install
    dist_info = install_wheel(
                ^^^^^^^^^^^^^^
  File "~\pipx\venvs\pdm\Lib\site-packages\pdm\installers\installers.py", line 193, in install_wheel
    with WheelFile.open(wheel) as source:
         ^^^^^^^^^^^^^^^^^^^^^
  File "C:\Program Files\WindowsApps\PythonSoftwareFoundation.Python.3.12_3.12.2288.0_x64__qbz5n2kfra8p0\Lib\contextlib.py", line 137, in __enter__
    return next(self.gen)
           ^^^^^^^^^^^^^^
  File "~\pipx\venvs\pdm\Lib\site-packages\installer\sources.py", line 162, in open
    with zipfile.ZipFile(path) as f:
         ^^^^^^^^^^^^^^^^^^^^^
  File "C:\Program Files\WindowsApps\PythonSoftwareFoundation.Python.3.12_3.12.2288.0_x64__qbz5n2kfra8p0\Lib\zipfile\__init__.py", line 1331, in __init__
    self.fp = io.open(file, filemode)
              ^^^^^^^^^^^^^^^^^^^^^^^
FileNotFoundError: [Errno 2] No such file or directory: '~\\AppData\\Local\\pdm\\pdm\\Cache\\wheels\\83\\b5\\d1\\*******.whl'
  Retry failed jobs(2/2)
pdm.termui: Overwriting distribution ***
  ✖ Update *** 1.6.0 -> 1.6.0 failed
pdm.termui: Error occurs updating ***: 
Traceback (most recent call last):
  File "C:\Program Files\WindowsApps\PythonSoftwareFoundation.Python.3.12_3.12.2288.0_x64__qbz5n2kfra8p0\Lib\concurrent\futures\thread.py", line 59, in run
    result = self.fn(*self.args, **self.kwargs)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "~\pipx\venvs\pdm\Lib\site-packages\pdm\installers\synchronizers.py", line 50, in update_candidate
    self.manager.overwrite(dist, can)
  File "~\pipx\venvs\pdm\Lib\site-packages\pdm\installers\manager.py", line 62, in overwrite
    installed = self.install(candidate)
                ^^^^^^^^^^^^^^^^^^^^^^^
  File "~\pipx\venvs\pdm\Lib\site-packages\pdm\installers\manager.py", line 32, in install
    dist_info = install_wheel(
                ^^^^^^^^^^^^^^
  File "~\pipx\venvs\pdm\Lib\site-packages\pdm\installers\installers.py", line 193, in install_wheel
    with WheelFile.open(wheel) as source:
         ^^^^^^^^^^^^^^^^^^^^^
  File "C:\Program Files\WindowsApps\PythonSoftwareFoundation.Python.3.12_3.12.2288.0_x64__qbz5n2kfra8p0\Lib\contextlib.py", line 137, in __enter__
    return next(self.gen)
           ^^^^^^^^^^^^^^
  File "~\pipx\venvs\pdm\Lib\site-packages\installer\sources.py", line 162, in open
    with zipfile.ZipFile(path) as f:
         ^^^^^^^^^^^^^^^^^^^^^
  File "C:\Program Files\WindowsApps\PythonSoftwareFoundation.Python.3.12_3.12.2288.0_x64__qbz5n2kfra8p0\Lib\zipfile\__init__.py", line 1331, in __init__
    self.fp = io.open(file, filemode)
              ^^^^^^^^^^^^^^^^^^^^^^^
FileNotFoundError: [Errno 2] No such file or directory: '~\\AppData\\Local\\pdm\\pdm\\Cache\\wheels\\83\\b5\\d1\\******.whl'
  ✖ Some package operations failed.
Traceback (most recent call last):
  File "<frozen runpy>", line 198, in _run_module_as_main
  File "<frozen runpy>", line 88, in _run_code
  File "~\.local\bin\pdm.exe\__main__.py", line 7, in <module>
  File "~\pipx\venvs\pdm\Lib\site-packages\pdm\core.py", line 392, in main
    return core.main(args or sys.argv[1:])
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "~\pipx\venvs\pdm\Lib\site-packages\pdm\core.py", line 270, in main
    raise cast(Exception, err).with_traceback(traceback) from None
  File "~\pipx\venvs\pdm\Lib\site-packages\pdm\core.py", line 265, in main
    self.handle(project, options)
  File "~\pipx\venvs\pdm\Lib\site-packages\pdm\core.py", line 195, in handle
    command.handle(project, options)
  File "~\pipx\venvs\pdm\Lib\site-packages\pdm\cli\commands\update.py", line 75, in handle
    self.do_update(
  File "~\pipx\venvs\pdm\Lib\site-packages\pdm\cli\commands\update.py", line 200, in do_update
    do_sync(
  File "~\pipx\venvs\pdm\Lib\site-packages\pdm\cli\actions.py", line 301, in do_sync
    synchronizer.synchronize()
  File "~\pipx\venvs\pdm\Lib\site-packages\pdm\installers\synchronizers.py", line 226, in synchronize
    raise InstallationError("Some package operations failed.")
pdm.exceptions.InstallationError: Some package operations failed.

Additional Context

No response

Are you willing to submit a PR to fix this bug?

  • Yes, I would like to submit a PR.

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