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 2.3.0 asks for confirmation when given relative path to interpreter #1542

Closed
1 task done
lambda opened this issue Dec 2, 2022 · 2 comments · Fixed by j178/pdm#1
Closed
1 task done

PDM 2.3.0 asks for confirmation when given relative path to interpreter #1542

lambda opened this issue Dec 2, 2022 · 2 comments · Fixed by j178/pdm#1
Labels
🐛 bug Something isn't working

Comments

@lambda
Copy link

lambda commented Dec 2, 2022

  • 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. Create a virtualenv manually: python -m venv .venv
  2. Tell PDM to use this virtualenv with a relative path: pdm use --ignore-remembered .venv/bin/python

Actual behavior

PDM prompts, asking to select between the absolute and relative paths to the interpreter. This breaks CI jobs.

$ pdm -v use --ignore-remembered .venv/bin/python
Please enter the Python interpreter to use
0. /home/brcampbell/src/gitlab-ci/.venv/bin/python (3.11)
1. .venv/bin/python (3.11)
Please select (0): 

Expected behavior

PDM should use the interpreter given on the command line. It would be acceptable for it to use the absolute path; it just shouldn't prompt to distinguish two paths to the same interpreter.

Workaround

You can workaround this by using $(realpath .venv/bin/python) or $PWD/.venv/bin/python to pass in the absolute path to begin with.

Environment Information

# Paste the output of `pdm info && pdm info --env` below:
$ pdm info && pdm info --env
PDM version:
  2.3.0
Python Interpreter:
  /home/brcampbell/src/gitlab-ci/.venv/bin/python (3.11)
Project Root:
  /home/brcampbell/src/gitlab-ci
Project Packages:
  None
{
  "implementation_name": "cpython",
  "implementation_version": "3.11.0",
  "os_name": "posix",
  "platform_machine": "x86_64",
  "platform_release": "6.0.9-300.fc37.x86_64",
  "platform_system": "Linux",
  "platform_version": "#1 SMP PREEMPT_DYNAMIC Wed Nov 16 17:36:22 UTC 2022",
  "python_full_version": "3.11.0",
  "platform_python_implementation": "CPython",
  "python_version": "3.11",
  "sys_platform": "linux"
}
@lambda lambda added the 🐛 bug Something isn't working label Dec 2, 2022
@frostming
Copy link
Collaborator

This is probably caused by #1524, thanks for the report. As a workaround, you can add -f option to always pick the first item without prompting in any case.

@lambda
Copy link
Author

lambda commented Dec 5, 2022

Thanks for the quick resolution!

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