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

Python Project using existing venv won't start interpreter #5730

Open
jonvanausdeln opened this issue Dec 13, 2024 · 3 comments
Open

Python Project using existing venv won't start interpreter #5730

jonvanausdeln opened this issue Dec 13, 2024 · 3 comments
Assignees
Labels
area: core Issues related to Core category. area: runtimes Issues related to Language Runtimes regression

Comments

@jonvanausdeln
Copy link
Contributor

jonvanausdeln commented Dec 13, 2024

System details:

Positron and OS details:

Positron Version: 2025.01.0 (system setup) build 71
Code - OSS Version: 1.93.0
Commit: bb6af9753b5342227aa1d4406897951048fba044
Date: 2024-12-12T02:43:50.411Z
Electron: 30.4.0
Chromium: 124.0.6367.243
Node.js: 20.15.1
V8: 12.4.254.20-electron.0
OS: Windows_NT x64 10.0.26100

Interpreter details:

Python 3.10.10 (but version doesn't matter)

Describe the issue:

The interpreter doesn't start in a new project when selecting an existing venv. nor when opening an existing project with a venv.

This is seen in our automated New Project with ipykernel installed test. causing it to fail.

Steps to reproduce the issue:

  1. Create a new Python project selecting to create a new venv
  2. Let the new project load, and console interpreter session start.. installing ipykernel as needed.
  3. Close the folder
  4. Re-open the project

Note that the interpreter doesn't start up. However you can manually start the interpreter. It used to auto start the interpreter. This is causing our test to fail.

Expected or desired behavior:

Console interpreter starts up automatically

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

QA NOTES

Two tests skipped will need to be turned back on when resolved. See #5731

@jonvanausdeln jonvanausdeln added the area: project wizard Issues related to New Project Wizard category. label Dec 13, 2024
@sharon-wang
Copy link
Member

Reminds me of: #5286

Some console output from a failed run:

  ERR Creating session for language runtime 991fdf617151cbb9d45a4e4c00c795a9 (language: Python name: Python 3.10.12 (Global) version: 3.10.12) failed. Reason: Error: Interpreter /bin/python3.10 (path: /bin/python3.10) not found in available Python interpreters: 
DEBUG Error starting runtime session: Error: Interpreter /bin/python3.10 (path: /bin/python3.10) not found in available Python interpreters: 
  ERR Interpreter /bin/python3.10 (path: /bin/python3.10) not found in available Python interpreters: : Error: Interpreter /bin/python3.10 (path: /bin/python3.10) not found in available Python interpreters: 
	at new PythonRuntimeSession (/home/runner/work/positron/positron/extensions/positron-python/out/client/positron/session.js:72:19)
	at PythonRuntimeManager.createSession (/home/runner/work/positron/positron/extensions/positron-python/out/client/positron/manager.js:144:16)
	at async ExtHostLanguageRuntime.$createLanguageRuntimeSession (/home/runner/work/positron/positron/out/vs/workbench/api/common/positron/extHostLanguageRuntime.js:82:33)
  • odd that no interpreters were listed at all
  • this feels like a timing issue where we check for the interpreter we want to start before we've completed runtime discovery

@sharon-wang
Copy link
Member

This could have the same root cause as #5718?

@jonvanausdeln
Copy link
Contributor Author

jonvanausdeln commented Dec 13, 2024

This also repros locally. This is from the debug console

orkbench.desktop.main.js:130851   ERR spawn c:\Program Files\Positron\resources\app\extensions\positron-python\python-env-tools\bin\pet.exe ENOENT: Error: spawn c:\Program Files\Positron\resources\app\extensions\positron-python\python-env-tools\bin\pet.exe ENOENT
	at ChildProcess._handle.onexit (node:internal/child_process:286:19)
	at onErrorNT (node:internal/child_process:484:16)
	at process.processTicksAndRejections (node:internal/process/task_queues:82:21)
workbench.desktop.main.js:62543 [Extension Host] Activating Posit Publisher extension (at console.<anonymous> (c:\Program Files\Positron\resources\app\out\vs\workbench\api\node\extensionHostProcess.js:64217:26))
workbench.desktop.main.js:130821 DEBUG [Runtime startup] Session restore; workspace: e57d4ef7d1d70fbdf802adb5c80e617c, workbench state: 2, startupKind: 4
workbench.desktop.main.js:130851   ERR [Extension Host] Attempt 1 failed. Retrying...
workbench.desktop.main.js:62543 [Extension Host] Attempt 1 failed. Retrying... (at console.<anonymous> (c:\Program Files\Positron\resources\app\out\vs\workbench\api\node\extensionHostProcess.js:64217:26))
log @ workbench.desktop.main.js:62543
workbench.desktop.main.js:130821 DEBUG [Runtime startup] Phase changed to 'reconnecting'
workbench.desktop.main.js:130821 DEBUG Reconnecting to sessions: Python 3.10.10 (Venv: .venv)
workbench.desktop.main.js:130851   ERR Could not restore workspace sessions: TypeError: Cannot read properties of undefined (reading 'value') (data: [object Object])
workbench.desktop.main.js:130821 DEBUG [Runtime startup] Phase changed to 'starting'
workbench.desktop.main.js:130821 DEBUG [Runtime startup] Activating extension ms-python.python for language ID python
workbench.desktop.main.js:130821 DEBUG User data changed
workbench.desktop.main.js:130831  INFO Language runtime 4c6cc093f21785a233f377910c3ae8cb (language: Python name: Python 3.10.10 (Venv: .venv) version: 3.10.10) automatically starting. Source: Affiliated python runtime for workspace
workbench.desktop.main.js:130821 DEBUG [Runtime startup] Activating extension ms-python.python for language ID python
workbench.desktop.main.js:130821 DEBUG [Runtime startup] Activating extension positron.positron-r for language ID r
workbench.desktop.main.js:130821 DEBUG [Runtime startup] Activating extension positron.positron-reticulate for language ID reticulate
workbench.desktop.main.js:130821 DEBUG Error starting runtime session: TypeError: Cannot read properties of undefined (reading 'value')
workbench.desktop.main.js:130851   ERR Cannot read properties of undefined (reading 'value'): TypeError: Cannot read properties of undefined (reading 'value')
	at c:\Program Files\Positron\resources\app\out\vs\workbench\api\node\extensionHostProcess.js:92728:103
	at Array.find (<anonymous>)
	at $9Fc.q (c:\Program Files\Positron\resources\app\out\vs\workbench\api\node\extensionHostProcess.js:92728:41)
	at $9Fc.$isHostForLanguageRuntime (c:\Program Files\Positron\resources\app\out\vs\workbench\api\node\extensionHostProcess.js:92628:47)
	at $csc.S (c:\Program Files\Positron\resources\app\out\vs\workbench\api\node\extensionHostProcess.js:66569:27)
	at $csc.Q (c:\Program Files\Positron\resources\app\out\vs\workbench\api\node\extensionHostProcess.js:66554:45)
	at $csc.M (c:\Program Files\Positron\resources\app\out\vs\workbench\api\node\extensionHostProcess.js:66495:32)
	at $csc.L (c:\Program Files\Positron\resources\app\out\vs\workbench\api\node\extensionHostProcess.js:66422:26)
	at UniqueContainer.value (c:\Program Files\Positron\resources\app\out\vs\workbench\api\node\extensionHostProcess.js:66285:51)
	at $qe.B (c:\Program Files\Positron\resources\app\out\vs\workbench\api\node\extensionHostProcess.js:10579:26)
	at $qe.fire (c:\Program Files\Positron\resources\app\out\vs\workbench\api\node\extensionHostProcess.js:10608:22)
	at $xi.fire (c:\Program Files\Positron\resources\app\out\vs\workbench\api\node\extensionHostProcess.js:33220:28)
	at UniqueContainer.value (c:\Program Files\Positron\resources\app\out\vs\workbench\api\node\extensionHostProcess.js:110465:32)
	at $qe.B (c:\Program Files\Positron\resources\app\out\vs\workbench\api\node\extensionHostProcess.js:10579:26)
	at $qe.fire (c:\Program Files\Positron\resources\app\out\vs\workbench\api\node\extensionHostProcess.js:10608:22)
	at $xi.fire (c:\Program Files\Positron\resources\app\out\vs\workbench\api\node\extensionHostProcess.js:33220:28)
	at MessagePortMain.<anonymous> (c:\Program Files\Positron\resources\app\out\vs\workbench\api\node\extensionHostProcess.js:110361:57)
	at MessagePortMain.emit (node:events:519:28)

jonvanausdeln added a commit that referenced this issue Dec 14, 2024
Due to #5730 need to skip the ipykernel new project tests.

### QA Notes
Clean CI runs
<!--
  Add additional information for QA on how to validate the change,
  paying special attention to the level of risk, adjacent areas that
  could be affected by the change, and any important contextual
  information not present in the linked issues.
-->
@juliasilge juliasilge added this to the 2025.01.0 Pre-Release milestone Dec 16, 2024
@juliasilge juliasilge added area: core Issues related to Core category. area: runtimes Issues related to Language Runtimes and removed area: project wizard Issues related to New Project Wizard category. labels Dec 16, 2024
@seeM seeM self-assigned this Dec 18, 2024
seeM added a commit that referenced this issue Dec 19, 2024
Attempts to address #5730. My hunch is that `getInterpreters()` doesn't
wait for the Python extension to complete its discovery process, so it's
possible to get there before our runtime's interpreter is discovered.

The whole point of restoring a workspace-affiliated runtime is to skip
discovery. It looks like `getInterpreterDetails()` is a better fit,
since (I think) it "resolves" an interpreter path to a
`PythonEnvironment` independent of discovery.

### QA Notes

E2E tests C609619 and C609617 should pass in CI:

* Passing E2E run:
https://github.com/posit-dev/positron/actions/runs/12387951151/job/34578222238
* 10x run of both failing tests:
https://d38p2avprg8il3.cloudfront.net/playwright-report-12389107722-6803/index.html.
There was a single failure, but that looks like an unrelated issue.

Python and Reticulate runtimes should continue to function as expected.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area: core Issues related to Core category. area: runtimes Issues related to Language Runtimes regression
Projects
None yet
Development

No branches or pull requests

4 participants