Package Installation
Workbench | Preview
R packages
CRAN repositories
By default, Positron Pro sessions use Posit Public Package Manager’s (P3M) CRAN repository. Package Manager delivers Posit-built binary CRAN packages. Binary packages are recommended when available for your Linux distribution, as they are faster to install than source packages and usually don’t require additional build dependencies. Visit Posit Public Package Mananger for more information.
Multiple CRAN repositories
To specify a list of CRAN repos for Positron Pro sessions to use, you need to:
- Ensure
XDG_CONFIG_DIRS
is set for Positron Pro sessions - Define a
/etc/rstudio/repos.conf
with the desired repos - Set
positron.r.defaultRepositories
in Positron Pro settings toauto
The sections below cover each of these steps in detail.
1. Define XDG_CONFIG_DIRS
Positron Pro uses XDG_CONFIG_DIRS
to search for $XDG_CONFIG_DIRS/rstudio/repos.conf
to apply the list of CRAN repos you’ve specified. Our example of /etc/rstudio/repos.conf
requires /etc
to be included in XDG_CONFIG_DIRS
, though any desired base directory could be used to match your system’s configuration.
You can set XDG_CONFIG_DIRS
in the Positron Pro session environment however you like, but it must be set before the session starts. Alternatively, Workbench can be configured to set it for Positron Pro sessions automatically by adding an entry in /etc/rstudio/launcher-env
. For example:
/etc/rstudio/launcher-env
JobType: session
Workbench: positron
Environment: XDG_CONFIG_DIRS=/etc
This would override any XDG_CONFIG_DIRS
value that may already be set by the system. See the launcher-env configuration section for more details on configuring the launcher-env
file.
Also, there is no default value considered for XDG_CONFIG_DIRS
. If XDG_CONFIG_DIRS
is not set or is an empty string, then Positron Pro will not search for a repos.conf
file.
2. Create $XDG_CONFIG_DIRS/rstudio/repos.conf
Create a file at $XDG_CONFIG_DIRS/rstudio/repos.conf
containing the primary CRAN
repo and named secondary repos. For example:
/etc/rstudio/repos.conf
CRAN=https://packagemanager.posit.co/cran/__linux__/rhel9/latest
Australia=https://cran.ms.unimelb.edu.au/
Austria=https://lib.ugent.be/CRAN/
If configured, this repos.conf
file can be shared with RStudio Pro sessions. See the Package installation for RStudio Pro Sessions section for more information.
3. Set positron.r.defaultRepositories
to auto
Inside the Positron Pro session, the positron.r.defaultRepositories
must be set to auto
(auto
is the default). Users specify its value in File > Preferences > Settings.
Other considerations
The repos.conf
file found by the positron.r.defaultRepositories
option in Positron can be overridden by an Rprofile.site
file or a user’s .Rprofile
file. If you’ve completed the above steps, but Positron’s R Console isn’t using your repos.conf
file as you expect, verify it isn’t being superseded by other R configuration options.
Python packages
For general information on how to configure pip
or uv
in sessions, see Package Installation in the Python section.