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

Cryptic error when failing to upgrade pdm in a tox-managed venv #57

Open
ncoghlan opened this issue Sep 5, 2024 · 0 comments
Open

Cryptic error when failing to upgrade pdm in a tox-managed venv #57

ncoghlan opened this issue Sep 5, 2024 · 0 comments

Comments

@ncoghlan
Copy link

ncoghlan commented Sep 5, 2024

I just ran into a problem where pdm, tox, and tox-pdm unexpectedly stopped playing nice on a Windows machine:

S:\path\to\project> tox -e py3.12
py3.12: install_deps> pdm sync --no-self --group dev
Synchronizing working set with resolved packages: 0 to add, 1 to update, 0 to remove

  x Update pdm 2.17.3 -> 2.18.1 failed
  x Update pdm 2.17.3 -> 2.18.1 failed

... snip traceback details ...

PermissionError: [WinError 32] The process cannot access the file because it is being used by another process:
'S:\\path\\to\\project\\.tox\\py3.12\\Scripts\\pdm.exe'

  x Some package operations failed. 1/1 0:00:00
INFO: Inside an active virtualenv S:\path\to\project\.tox\py3.12, reusing it.
Set env var PDM_IGNORE_ACTIVE_VENV to ignore it.
STATUS: Resolving packages from lockfile...
See C:\Users\Alyssa\AppData\Local\pdm\pdm\Logs\pdm-install-4rac_qnn.log for detailed debug log.
[InstallationError]: Some package operations failed.
WARNING: Add '-v' to see the detailed traceback

The PDM lock file had been updated elsewhere and then pulled over to this Windows machine. The fix was to destroy and recreate the tox environment rather than trying to updated it in place:

S:\path\to\project> tox -re py3.12
... output for test run working as expected ...

This isn't the same as the nox VIRTUAL_ENV handling issue reported in pdm-project/pdm#2297, but I did end up there while trying to make sense of the failure.

Perhaps tox-pdm could detect when the venv itself contains pdm and it is attempting to upgrade it on Windows?

(alternatively, there may be a genuine bug here, and tox-pdm should be running [sys.executable, "-m", "pdm"] rather than running pdm directly?)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant