Skip to content

Enable reticulate by default #8564

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

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open

Enable reticulate by default #8564

wants to merge 1 commit into from

Conversation

dfalbel
Copy link
Contributor

@dfalbel dfalbel commented Jul 17, 2025

Addresses #8563

Full test suite passing: https://github.com/posit-dev/positron/actions/runs/16452982927
Added some docs in posit-dev/positron-website#123

Release Notes

New Features

Bug Fixes

  • N/A

QA Notes

@:reticulate

Copy link

github-actions bot commented Jul 17, 2025

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

readme  valid tags

@dfalbel dfalbel force-pushed the reticualte-default branch 3 times, most recently from fdd067d to d57094a Compare July 22, 2025 16:35
@dfalbel dfalbel force-pushed the reticualte-default branch from d57094a to 0d440a7 Compare July 22, 2025 18:52
@dfalbel dfalbel marked this pull request as ready for review July 23, 2025 12:13
@dfalbel dfalbel requested a review from juliasilge July 23, 2025 12:13
@juliasilge
Copy link
Contributor

My understanding is that the expected behavior is that the reticulate features do not kick in unless you have the reticulate R package installed, but that is not what I see here:

Screenshot 2025-07-23 at 11 38 35 AM

Can we update the behavior so we check if reticulate is installed before showing this in the UI?

@dfalbel
Copy link
Contributor Author

dfalbel commented Jul 23, 2025

I may have wrongly affirmed that this was the case, but looking at the code now we do actually check if an R interpreter is available (so we don't show reticulate for Python only users), but not if the reticulate package is installed.

// Hook that will register the reticulate runtime if an R
// runtime is found.
this._registrationHook = positron.runtime.onDidRegisterRuntime((metadata) => {
if (!this._metadata && metadata.languageId === 'r') {
this.registerReticulateRuntime();
}
});

The reasoning for this is that we don't actually know which R interpreter is going to be used until the session is actually being created. For instance, at registration time (when the extension is loaded), there might be no R interpreter really running, and we probably do not want to start one for that. We may be able to listen to 'session created' events and only
register the runtime at that point (if reticulate is installed), but this makes restoring reticulate sessions (eg on browser refresh) very tricky.

We do check if reticulate is installed when creating the reticulate session though, and if not, we offer for installation:

if (!await rSession.callMethod?.('is_installed', 'reticulate', '1.39')) {
// Offer to install reticulate
const install_reticulate = await positron.window.showSimpleModalDialogPrompt(
vscode.l10n.t('Missing reticulate'),
vscode.l10n.t('Reticulate >= 1.39 is required. Do you want to install reticulate?'),
'Yes',
'No'
);
if (install_reticulate) {
try {
await rSession.callMethod?.('install_packages', 'reticulate');
} catch (err: any) {
throw new InitializationError(vscode.l10n.t('Failed to install/update the reticulate package: {0}', err));
}
}
// Make a new check for reticulate
if (!await rSession.callMethod?.('is_installed', 'reticulate', '1.39')) {
throw new InitializationError(vscode.l10n.t('Reticulate >= 1.39 is required'));
}
}

What do you think?

@juliasilge
Copy link
Contributor

Ah, I see what you mean about possible multiple R interpreters. 🤔

I checked with a few folks and we do think this is getting featured too prominently now, though, for too many users for whom this isn't relevant. Also, if someone is only an R user, then it starts to look like reticulate is the only Python you can see in Positron (not what we're going for).

Two possible options moving forward could be:

  • Only have this UI kick in if reticulate is installed (maybe it's good enough to check the first R interpreter, given that most R users have one version of R? Or check them all?)
  • Keep this behind an opt-in setting

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants