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

FileExistsError, version 1.7.1 (new installer) #565

Closed
1 task done
pawamoy opened this issue Jul 29, 2021 · 5 comments
Closed
1 task done

FileExistsError, version 1.7.1 (new installer) #565

pawamoy opened this issue Jul 29, 2021 · 5 comments
Labels
🐛 bug Something isn't working

Comments

@pawamoy
Copy link
Contributor

pawamoy commented Jul 29, 2021

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

Steps to reproduce

pdm install

Actual behavior

  Retry failed jobs
  ✖ Install pytkdocs 0.11.1 failed

ERRORS:

add pytkdocs failed:
Traceback (most recent call last):
  File "/home/user/.basher-packages/pyenv/pyenv/versions/3.8.11/lib/python3.8/concurrent/futures/thread.py", line 57, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/home/user/.local/pipx/venvs/pdm/lib/python3.8/site-packages/pdm/installers/synchronizers.py", line 157, in install_candidate
    installer.install(can)
  File "/home/user/.local/pipx/venvs/pdm/lib/python3.8/site-packages/pdm/installers/installers.py", line 66, in install
    self.install_wheel(built)
  File "/home/user/.local/pipx/venvs/pdm/lib/python3.8/site-packages/pdm/installers/installers.py", line 79, in install_wheel
    install(
  File "/home/user/.local/pipx/venvs/pdm/lib/python3.8/site-packages/installer/_core.py", line 91, in install
    record = destination.write_script(
  File "/home/user/.local/pipx/venvs/pdm/lib/python3.8/site-packages/installer/destinations.py", line 173, in write_script
    entry = self.write_to_fs(Scheme("scripts"), script_name, stream)
  File "/home/user/.local/pipx/venvs/pdm/lib/python3.8/site-packages/installer/destinations.py", line 124, in write_to_fs
    raise FileExistsError(message)
FileExistsError: File already exists: /home/user/data/dev/project/__pypackages__/3.8/bin/pytkdocs

See /tmp/pdm-install-ezohzk_b.log for detailed debug log.
[InstallationError]: Some package operations are not complete yet
Add '-v' to see the detailed traceback

pytkdocs 0.11.1 was built with Poetry with the following contents in pyproject.toml:

include = [
    "README.md",
    "pyproject.toml"
]

...which was known to cause problem with parallel installations (race conditions trying to remove/copy README.md and pyproject.toml from the root of site-packages). I since then removed this include from my Poetry projects, but old versions still suffer from it. This might also be the cause of this issue, though the tracebacks show FileExistsError on the scripts, not README/pyproject, so I'm not sure.

Other packages built the same way are triggering the same exceptions (git-changelog 0.4.2, failprint 0.6.2).

If you believe this issue should be opened in @pradyunsg's installer instead, I'll gladly move it there!

Expected behavior

It works with version 1.7.0.

Environment Information

$ pdm info
PDM version:        1.7.1                                                                            
Python Interpreter: /home/user/.basher-packages/pyenv/pyenv/versions/3.8.11/bin/python (3.8)
Project Root:       /home/user/data/dev/project
Project Packages:   /home/user/data/dev/project/__pypackages__/3.8

$ pdm info --env
{
  "implementation_name": "cpython",
  "implementation_version": "3.8.11",
  "os_name": "posix",
  "platform_machine": "x86_64",
  "platform_release": "3.10.0-862.6.3.el7.x86_64",
  "platform_system": "Linux",
  "platform_version": "#1 SMP Fri Jun 15 17:57:37 EDT 2018",
  "python_full_version": "3.8.11",
  "platform_python_implementation": "CPython",
  "python_version": "3.8",
  "sys_platform": "linux"
}
@pawamoy pawamoy added the 🐛 bug Something isn't working label Jul 29, 2021
@frostming
Copy link
Collaborator

A minimal and reproducible example would be a great help, can you make it?

@pawamoy
Copy link
Contributor Author

pawamoy commented Jul 29, 2021

Sure, give me a sec 🙂

@pawamoy
Copy link
Contributor Author

pawamoy commented Jul 29, 2021

mkdir -p repro565/src/yo
cd repro565
echo 'print("yo")' > src/yo/__init__.py

echo '
[build-system]
requires = ["pdm-pep517"]
build-backend = "pdm.pep517.api"

[project]
name = "yo"
version = {use_scm = true}
description = "Hey."
readme = "README.md"
requires-python = ">=3.6.8"
dynamic = ["version"]
dependencies = [
    "failprint~=0.6.2",
    "git-changelog~=0.4.2",
]

[tool.pdm]
includes = ["src"]
' > pyproject.toml

touch README.md

pdm lock  # ok
pdm install  # fails when installing the second problematic package

@frostming
Copy link
Collaborator

Thanks for the information. It helps enlight the whole situation.

The first installation failed due to README.md racing, and the retry failed due to the scripts existing.

@pawamoy
Copy link
Contributor Author

pawamoy commented Jul 29, 2021

Thank you again for such quick fixes, you're fantastic ❤️

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