Positron doesn't start the R version a rig project needs

Open
#17,634 2 comments 0 reactions 0 assignees View on GitHub

Maintainers usually reply within 1 day

Nobody has claimed this yet.

Assessment

Difficulty
4/5
Estimated time
3-5 days
Newbie friendliness
54/100
Issue type
Feature
Clarity
Clearly specified
Activity status
Active
Tech stack
r, typescript

Research direction

Start by tracing R runtime selection and project detection in Positron, including how workspace last-used runtimes are chosen and how Python .venv selection is handled. Check the session picker and Welcome page runtime labels, then look for tests covering runtime discovery and project detection. Done means a synced rig project selects its matching real R installation, identifies the runtime as a rig project, and recognizes rproj.toml as an R project.

Written by the indexing model from the issue text.

Description

area: runtimes lang: r
Summary

When a folder is a synced rig project, Positron doesn't use the project's R version when it chooses which R to start. It picks R the way it would for any folder: the R last used in the workspace, then the pinned default, then the current R. If that R is a different minor version from the one the project was built for, rig turns off the project library. The user ends up in their normal user library, and nothing in Positron explains why.

Background

rig proj sync creates a .rvenv folder in the project:

  • .rvenv/bin/R is a shell wrapper. It sets some environment variables and then runs a fixed system R, for example /Library/Frameworks/R.framework/Versions/4.6/Resources/bin/R.
  • .rvenv/rvenv.cfg records the R minor version the project was built for (r-minor).
  • .rvenv/lib is the project library.

There is no separate R installation inside .rvenv. The project library is turned on by the project .Renviron and the rvenv shim package, so any R started in the folder runs it. If the running R's minor version doesn't match r-minor, the shim keeps the project library off and prints "Project needs R X.Y, this is R X.Z."

Steps to reproduce
  1. Install R 4.5 and R 4.6, for example with rig.
  2. Open a folder in Positron and start R 4.5, so 4.5 becomes the R used in that workspace.
  3. In that folder, create a rig project for R 4.6 and run rig proj sync.
  4. Reopen the folder in Positron.

Expected: Positron starts R 4.6, and .libPaths()[1] is .rvenv/lib.

Actual: Positron starts R 4.5 (start reason affiliatedRuntime), and the project library is not active. The session picker has no entry that shows it belongs to the rig project, so users don't see that R 4.6 is the one to choose.

Suggested fix
  • When the workspace has .rvenv/rvenv.cfg, use the R the project was built for. Read the absolute R path from the last line of .rvenv/bin/R, or match r-minor from rvenv.cfg against the R versions Positron found.
  • Let this beat the workspace's last-used R when the two disagree, much like a project .venv is chosen for Python.
  • Label that runtime in the session picker and Welcome page with a reason such as "rig project".
  • Add rproj.toml to the files that make a folder count as an R project, so R starts right away in these folders.

Using .rvenv/bin/R as a custom binary doesn't work: the wrapper has no R_HOME_DIR line, so discovery rejects it. Ark also starts R from R_HOME, not through the wrapper. That's another reason to pick the real R installation, not the wrapper.

Workaround

Start the matching R version from the session picker in the project folder. After that it's the R Positron uses there, and the project library turns on.

Versions

Positron 2026.11.1 build 4, rig 0.11.1, macOS arm64.

Dominant language
TypeScript
Stars
4.4k
Forks
207
Avg merge
1d 16h
Merged PRs (30d)
308

Getting set up

Open in Codespaces

Starts the project's dev container in your browser, under your own GitHub account.

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from posit-dev/positron

All issues in posit-dev/positron

Similar issues

More TypeScript issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.