positron icon indicating copy to clipboard operation
positron copied to clipboard

Activate conda environments prior to creating R kernel sessions

Open jmcphers opened this issue 3 months ago • 4 comments

This change:

  • Makes the Conda R setting visible, with an experimental tag.
  • Decorates discovered Conda R environments with Conda: env_name in the picker.
  • Runs conda activate inside the shell that runs Conda R kernels, using a new kernel supervisor feature. This feature is also intended to support other preflight commands in the future. e.g. module load (https://github.com/posit-dev/positron/issues/8075).
image

The bulk of this change lives in the kernel supervisor: https://github.com/posit-dev/kallichore/pull/55

Supersedes https://github.com/posit-dev/positron/pull/10471.

Release Notes

  • Experimental support for starting Conda R sessions in Positron via conda activate. Note that not all of Positron's R features have been tested with Conda R. (#4398)

New Features

  • N/A

Bug Fixes

  • N/A

QA Notes

This change brings in a new supervisor version that has more sophisticated startup handling to support the new features, so it is worth checking that old settings like "Run in Shell" continue to work.

jmcphers avatar Nov 25 '25 16:11 jmcphers

E2E Tests 🚀 This PR will run tests tagged with: @:critical

readme  valid tags

github-actions[bot] avatar Nov 25 '25 16:11 github-actions[bot]

I tried building this branch and testing it out but couldn't get it working, maybe something wrong with my environment (macOS)

image

wesm avatar Nov 25 '25 23:11 wesm

@wesm did you run npm install after pulling the branch? (the error looks like a supervisor version mismatch, which would happen if you didn't get the new version of the supervisor along with the rest of the code)

jmcphers avatar Nov 26 '25 00:11 jmcphers

I was able to build it successfully, but when I try to start an existing conda R env that I have, I see this:

Screenshot 2025-11-25 at 5 24 25 PM
R 4.4.2 (Conda: my-fantastic-r-env) failed to start up (exit code 1)

The kernel exited before a connection could be established

CommandNotFoundError: Your shell has not been properly configured to use 'conda activate'.
To initialize your shell, run

    $ conda init <SHELL_NAME>

Currently supported shells are:
  - bash
  - fish
  - tcsh
  - xonsh
  - zsh
  - powershell

See 'conda init --help' for more information and options.

IMPORTANT: You may need to close and restart your shell after running 'conda init'.

juliasilge avatar Nov 26 '25 00:11 juliasilge