Interpreter Selection

Note

This information applies to the Public Beta release of Positron. The rules governing interpreter selection, and the user experience around selecting an interpreter, are under active development. This guide is intended to help you understand the current behavior.

First run

When Positron starts for the first time in a new workspace, it will start Python and/or R depending on your workspace characteristics and whether there is evidence of RStudio being used recently.

Typically when starting Python or R without other clues about which version to start, Positron will start the most recent version of the interpreter (e.g. if you have R 4.2 and R 4.3 installed, it’ll start R 4.3).

RStudio detection

Positron tries to start R for R users and Python for Python users by checking to see whether RStudio is installed and has been recently used. The latter check is done by looking in ~/.local/share/rstudio for files written less than a month ago, so if you don’t want Positron to consider you to be an RStudio user, you can remove this folder or rename it temporarily.

Subsequent runs

When Positron starts in a workspace that has been used before, it will start the same interpreter (or interpreters, if more than one) that were running the last time that you used that workspace.

In the case of R, there is an additional subtlety: When Positron records which R version was most recently used in a workspace, it also notes whether that R version is the system’s current or default R version. In subsequent sessions, Positron will launch the system’s current R version, even if that has a different version number from the last-used R version. We believe this behaviour is the least surprising for most users. If you want to use a specific, non-current R version in a workspace, select it explicitly once (more on that below) and it will be launched in future sessions.

If Positron starts an interpreter you don’t need, just shut it down (using the Power button in Console or the upper right) and it will stop starting automatically in that workspace.

Implicit startup

In addition to starting up an interpreter when the workspace is first opened, Positron will also automatically start an interpreter when it looks like one is needed. For example, Python will start:

  • When you open a .py file
  • When you execute Python code

Start, stop, and switch interpreters

Obviously, Positron might not always guess the right language for your workspace, or it might not use the right version of the interpreter. You can manually stop and start interpreters at any time in the top-right interpreter chooser (we call this the Top Bar Interpreter Dropdown internally). You can have both Python and R interpreters active at the same time, but you may only have a single Python and a single R interpreter active at once.

Choose a new interpreter

To change your interpreter – for example, to select a different Python environment – click on the horizontal ellipsis ... next to the interpreter.

Interpreter dropdown

A list of other interpreter versions are shown; click the one you want. If you are an R user, see the R discovery guide for more information on available installations.

Warning

Changing interpreters causes the old interpreter to be shut down and the new one to be started. This means that any state in the old interpreter will be lost, including any variables you’ve defined. Make sure you’ve saved your work before switching versions.