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

Workbench: Positron new Project cannot use Python versions not on the path? #5341

Closed
jthomasmock opened this issue Nov 12, 2024 · 4 comments
Closed
Assignees
Labels
area: project wizard Issues related to New Project Wizard category. area: workbench Issues related to Workbench category. lang: python

Comments

@jthomasmock
Copy link
Contributor

jthomasmock commented Nov 12, 2024

System details:

Positron and OS details:

Positron Version: 2024.11.0 build 140
Code - OSS Version: 1.93.0
Commit: e0d844b
Date: 2024-10-31T14:13:54.986Z
Browser: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/130.0.0.0 Safari/537.36

Interpreter details:

Python 3.12.4

Describe the issue:

On a Workbench server that doesn't have Python on the PATH, try to create a new Project with a version of Python in /opt/python but not on PATH. Note that the versions in /opt/python are not discovered

Image

Steps to reproduce the issue:

Expected or desired behavior:

Were there any error messages in the UI, Output panel, or Developer Tools console?

@jmcphers jmcphers added area: workbench Issues related to Workbench category. lang: python labels Nov 13, 2024
@sharon-wang sharon-wang added the area: project wizard Issues related to New Project Wizard category. label Nov 15, 2024
@sharon-wang
Copy link
Member

This is related to #4270. The Project Wizard only includes Pyenv and Global interpreters in this dropdown. I think Python versions not on the PATH have runtime source Unknown, which is not included in this dropdown.

/**
* PythonRuntimeFilter enum.
*/
export enum PythonRuntimeFilter {
Global = 'Global',
Pyenv = 'Pyenv'
}

We probably want to create a new command in the Python extension that checks if a given interpreter path is for a global Python installation, and display the interpreter in the Project Wizard interpreter dropdown based on the result. We currently make the runtime filtering decision in the Project Wizard, which currently only recognizes Pyenv and Global runtime sources as "Global" python installations.

@petetronic petetronic added this to the 2025.01.0 Pre-Release milestone Nov 18, 2024
@jthomasmock
Copy link
Contributor Author

jthomasmock commented Nov 22, 2024

On one of our internal instances, I do now see Python 3.12.4 on PATH as Global and it's on the New Project flow 🎉

There still appears to be some lag between overall discovery and this version being made available on the New Project flow, eg if I quickly start a session and try to create a New Project, the Python on PATH may be temporarily excluded.

@sharon-wang sharon-wang self-assigned this Nov 25, 2024
sharon-wang added a commit that referenced this issue Nov 26, 2024
### Addresses
- #5341
- #4270

### Implementation
- add new command `python.isGlobalPython` to the Python extension
- Given a python interpreter path, return whether it is a global python
interpreter
- remove `RuntimeFilter`, `PythonRuntimeFilter` and `runtimeSource`
filtering logic from the Project Wizard, which would require an update
to the appropriate enum every time we want to recognize a specific
`runtimeSource` as a permitted "Global Python"
- rework `_getFilteredInterpreters()` to return all interpreters, only
global interpreters, or undefined depending on the current state of the
project wizard
- add/update log messages in the Project Wizard state handling methods

### QA Notes

On Windows, `MicrosoftStore`-installed Python versions should now show
in the Project Wizard interpreter dropdown when creating a new Venv.

On other operating systems, Global, Pyenv, Unknown and any other
"Global" Python installations should show in the Project Wizard
interpreter dropdown when creating a new Venv.
@sharon-wang
Copy link
Member

sharon-wang commented Nov 26, 2024

QA Notes

Unknown runtimeSource interpreters should now show in the Project Wizard interpreter dropdown.

@jonvanausdeln
Copy link
Contributor

I'm not seeing this anymore in 2024.12.0-96

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Dec 17, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
area: project wizard Issues related to New Project Wizard category. area: workbench Issues related to Workbench category. lang: python
Projects
None yet
Development

No branches or pull requests

5 participants