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

pdm venv create succeeds/fails alternately #2631

Closed
mjmare opened this issue Feb 13, 2024 · 2 comments · Fixed by #2632
Closed

pdm venv create succeeds/fails alternately #2631

mjmare opened this issue Feb 13, 2024 · 2 comments · Fixed by #2632
Assignees
Labels
🐛 bug Something isn't working

Comments

@mjmare
Copy link

mjmare commented Feb 13, 2024

I want to create a script that create a new venv, possibly removing an existing venv if necessary. I thought the --force option would help with this.
As you may see below the command pdm venv create -n pdmtest --force will create the venv the first time, fail to do so the second time, succeed the third time etc etc.

❯ pdm venv list
Virtualenvs created with this project:

❯ pdm venv create -n pdmtest --force
Virtualenv /Users/mjm/Library/Application Support/pdm/venvs/PDMTest-VrAcEGgJ-pdmtest is created successfully
❯ pdm venv list
Virtualenvs created with this project:

*  pdmtest: /Users/mjm/Library/Application Support/pdm/venvs/PDMTest-VrAcEGgJ-pdmtest
❯ pdm venv create -n pdmtest --force
Cleaning existing target directory /Users/mjm/Library/Application Support/pdm/venvs/PDMTest-VrAcEGgJ-pdmtest
[VirtualenvCreateError]: Command '['/usr/local/Cellar/pdm/2.12.3/libexec/bin/python', '-m', 'virtualenv', '/Users/mjm/Library/Application 
Support/pdm/venvs/PDMTest-VrAcEGgJ-pdmtest', '-p', '/Users/mjm/Library/Application Support/pdm/venvs/PDMTest-VrAcEGgJ-pdmtest/bin/python', 
'--prompt=pdmtest-3.12', '--no-pip', '--no-setuptools', '--no-wheel']' returned non-zero exit status 1.
❯ pdm venv list
Virtualenvs created with this project:

❯ pdm venv create -n pdmtest --force
Virtualenv /Users/mjm/Library/Application Support/pdm/venvs/PDMTest-VrAcEGgJ-pdmtest is created successfully

@mjmare mjmare added the 🐛 bug Something isn't working label Feb 13, 2024
@mjmare
Copy link
Author

mjmare commented Feb 13, 2024

I have discovered that I can work around this problem by doing:

pdm venv purge -f
pdm venv create -n pdmtest

@frostming frostming self-assigned this Feb 14, 2024
frostming added a commit that referenced this issue Feb 14, 2024
frostming added a commit that referenced this issue Feb 14, 2024
…by: Frost Ming <[email protected]>

* fix: pdm venv create succeeds/fails alternately
Fixes #2631

Signed-off-by: Frost Ming <[email protected]>
@mjmare
Copy link
Author

mjmare commented Feb 14, 2024

Thanks!

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

Successfully merging a pull request may close this issue.

2 participants