pdm icon indicating copy to clipboard operation
pdm copied to clipboard

TypeError when downgrading package during pdm sync

Open Hnasar opened this issue 2 years ago • 1 comments

  • [☑️ ] 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. In windows with python 3.8
  2. pdm install with pyproject.toml that depends on pyqtgraph==0.12.4
  3. modify the pyproject.toml and change to pyqtgraph==0.12.1
  4. pdm install

Actual behavior

...
Update pyside2 5.15.2.1 -> 5.14.2.3 successful
  Retry failed jobs
Update pyqtgraph 0.12.4 -> 0.12.1 failed
Error occurs: 
Traceback (most recent call last):
  File "c:\users\containeradministrator\scoop\apps\python38\current\lib\concurrent\futures\thread.py", line 57, in run
    result = self.fn(*self.args, **self.kwargs)
  File "C:\builds\software\my-app\venv\lib\site-packages\pdm\installers\synchronizers.py", line 204, in update_candidate
    self.manager.uninstall(dist)
  File "C:\builds\software\my-app\venv\lib\site-packages\pdm\installers\manager.py", line 47, in uninstall
    remove_path = self.get_paths_to_remove(dist)
  File "C:\builds\software\my-app\venv\lib\site-packages\pdm\installers\manager.py", line 43, in get_paths_to_remove
    return StashedRemovePaths.from_dist(dist, environment=self.environment)
  File "C:\builds\software\my-app\venv\lib\site-packages\pdm\installers\uninstallers.py", line 155, in from_dist
    elif dist.files:
  File "c:\users\containeradministrator\scoop\apps\python38\current\lib\importlib\metadata.py", line 262, in files
    return file_lines and list(starmap(make_file, csv.reader(file_lines)))
TypeError: make_file() takes from 1 to 3 positional arguments but 6 were given
ERRORS:
update pyqtgraph failed:
Traceback (most recent call last):
  File "c:\users\containeradministrator\scoop\apps\python38\current\lib\concurrent\futures\thread.py", line 57, in run
    result = self.fn(*self.args, **self.kwargs)
  File "C:\builds\software\my-app\venv\lib\site-packages\pdm\installers\synchronizers.py", line 204, in update_candidate
    self.manager.uninstall(dist)
  File "C:\builds\software\my-app\venv\lib\site-packages\pdm\installers\manager.py", line 47, in uninstall
    remove_path = self.get_paths_to_remove(dist)
  File "C:\builds\software\my-app\venv\lib\site-packages\pdm\installers\manager.py", line 43, in get_paths_to_remove
    return StashedRemovePaths.from_dist(dist, environment=self.environment)
  File "C:\builds\software\my-app\venv\lib\site-packages\pdm\installers\uninstallers.py", line 155, in from_dist
    elif dist.files:
  File "c:\users\containeradministrator\scoop\apps\python38\current\lib\importlib\metadata.py", line 262, in files
    return file_lines and list(starmap(make_file, csv.reader(file_lines)))
TypeError: make_file() takes from 1 to 3 positional arguments but 6 were given
Traceback (most recent call last):
  File "c:\users\containeradministrator\scoop\apps\python38\current\lib\runpy.py", line 194, in _run_module_as_main
    return _run_code(code, main_globals, None,
  File "c:\users\containeradministrator\scoop\apps\python38\current\lib\runpy.py", line 87, in _run_code
    exec(code, run_globals)
  File "C:\builds\software\my-app\venv\Scripts\pdm.exe\__main__.py", line 7, in <module>
  File "C:\builds\software\my-app\venv\lib\site-packages\pdm\core.py", line 233, in main
    return Core().main(args)
  File "C:\builds\software\my-app\venv\lib\site-packages\pdm\core.py", line 168, in main
    raise cast(Exception, err).with_traceback(traceback)
  File "C:\builds\software\my-app\venv\lib\site-packages\pdm\core.py", line 163, in main
    f(options.project, options)
  File "C:\builds\software\my-app\venv\lib\site-packages\pdm\cli\commands\sync.py", line 26, in handle
    actions.do_sync(
  File "C:\builds\software\my-app\venv\lib\site-packages\pdm\cli\actions.py", line 190, in do_sync
    handler.synchronize()
  File "C:\builds\software\my-app\venv\lib\site-packages\pdm\installers\synchronizers.py", line 352, in synchronize
    raise InstallationError("Some package operations are not complete yet")
pdm.exceptions.InstallationError: Some package operations are not complete yet

Expected behavior

No type error. Update pyqtgraph 0.12.4 -> 0.12.1 successful

Environment Information

$ pdm info
PDM version:        1.13.6
Python Interpreter: C:\builds\software\my-app\venv\Scripts\python.exe (3.8)
Project Root:       C:/builds/software/my-app
Project Packages:   None
$ pdm info --env
{
  "implementation_name": "cpython",
  "implementation_version": "3.8.10",
  "os_name": "nt",
  "platform_machine": "AMD64",
  "platform_release": "10",
  "platform_system": "Windows",
  "platform_version": "10.0.17763",
  "python_full_version": "3.8.10",
  "platform_python_implementation": "CPython",
  "python_version": "3.8",
  "sys_platform": "win32"
}

Extra Information

Source code:

  • https://github.com/pdm-project/pdm/blob/1.13.6/pdm/installers/uninstallers.py#L155
  • https://github.com/python/cpython/blob/3.8/Lib/importlib/metadata.py#L262

Wheels:

  • https://pypi.org/project/pyqtgraph/0.12.1/#files
  • https://pypi.org/project/pyqtgraph/0.12.4/#files

By the way, thank you very much for making PDM! I am very impressed. 非常感谢您!

Hnasar avatar Mar 31 '22 19:03 Hnasar

This is an upstream bug, which is reported https://github.com/pypa/installer/issues/117 and a fix has been proposed: https://github.com/pypa/installer/pull/118

frostming avatar Apr 01 '22 08:04 frostming