positron icon indicating copy to clipboard operation
positron copied to clipboard

Option to stop initiating the reticulate environment as default Python interpreter until called by R

Open kv9898 opened this issue 1 year ago • 2 comments

System details:

Windows 11

Positron and OS details:

Positron Version: 2024.09.0 (system setup) build 103 Code - OSS Version: 1.93.0 Commit: 8274fe26a1582fa0dd0096d6631b500f591416c4 Date: 2024-09-30T02:46:12.087Z 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.22631

Interpreter details:

R 4.4.1 Python 3.11.9

Describe the issue:

Currently, once a reticulate environment is used for one project, subsequent Positron sessions automatically initiates the reticulate environment before it is being called by R.

Steps to reproduce the issue:

  1. Open a folder.
  2. Run reticulate::py_eval("print('hi')").
  3. Note that reticulate environment has been initiated.
  4. Switch to another folder.
  5. Switch back to the previous folder.
  6. Python (reticulate) is chosen as the default Python interpreter and initiated without being called by R.

Expected or desired behavior:

In my workflow, I wish to manually specify which python environment to use for my reticulate session through my R code. I hope there is a global option to opt out of this auto-starting feature of reticulate, while giving the user a project-based option to set a default reticulate environment to be automatically activated when booting, as suggested in https://github.com/posit-dev/positron/issues/2317.

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

No

kv9898 avatar Oct 02 '24 12:10 kv9898

This is an interesting use case! Thank you for filing it. I'll flag this for further triage.

timtmok avatar Oct 02 '24 16:10 timtmok

Implementation note: I think this would be pretty easy to do by creating a new runtime startup behavior category for runtimes that should not ever start automatically (i.e. should not saved as the affiliated interpreter)

https://github.com/posit-dev/positron/blob/20a2eacb0ea8ee1ff7d1942c5b45afb381b2139f/src/vs/workbench/services/languageRuntime/common/languageRuntimeService.ts#L507-L524

jmcphers avatar Oct 02 '24 19:10 jmcphers

Verified Fixed

Positron Version(s) : 2024.11.0-60
OS Version          : OSX

Test scenario(s)

Verified that reticulate will not auto start even if its the last interpreter used before shutdown.

Link(s) to TestRail test cases run or created:

testlabauto avatar Oct 17 '24 18:10 testlabauto