Lab 6: Integrating Workbench and Connect with Package Manager
By the end of this lab, you will be able to:
- Configure Workbench to use Package Manager for R and Python
- Verify that Workbench is using Package Manager for package installations
- Configure Connect to use Package Manager for R and Python
This lab puts into practice the concepts covered in Integrating Package Manager with Workbench and Connect. If you have not read it yet, review it first so the steps below make sense.
Configure Workbench to Use Package Manager for R and Python
Once Package Manager is appropriately configured, ensure that Workbench uses it for both R and Python rather than CRAN and PyPI. This provides the greatest level of control over which packages enter the environment and allows users to benefit from pre-compiled Linux binary packages in R.
Configuring for R
To configure Workbench for R, go to the user interface of your Package Manager instance (use the tab), then:
- Make sure that the “CRAN” repository is selected from the repositories you can install from, click on the “hamburger” menu in the top right, and click on “Setup”
- Under “Operating System”, choose “Linux”, and Under “Linux Distribution” select “Ubuntu 24.04 (Noble)”, and choose “No” under “Snapshots”
- Under “Environment”, click on “Posit Workbench”, and follow the instructions to configure Workbench to use Package Manager for R. This will involve editing the
/etc/rstudio/repos.conffile in your terminal. (note that additional instructions, which are listed in the Setup instructions, are needed to configure Positron) - Restart Workbench to apply the changes, and check the status of the service to make sure Workbench is running and ready.
Configuring for Python
To configure Workbench for Python, update the value of the session-python-index-url setting in rserver.conf. Workbench injects this value into every session as both the PIP_INDEX_URL and UV_INDEX_URL environment variables, so this single setting points both pip and uv at your Package Manager instance. This is the Workbench-native approach and is preferable to editing /etc/pip.conf or /etc/uv/uv.toml directly. The documentation is available in the Python Package Installation guide.
Edit /etc/rstudio/rserver.conf to replace the value of session-python-index-url with the URL of the PyPI repository hosted on your Package Manager instance, then restart Workbench:
/etc/rstudio/rserver.conf
session-python-index-url=https://<your-package-manager-url>/pypi/latest/simpleTesting your Workbench configuration for R
To test these changes, open a new RStudio session running in Workbench (start a new session so it picks up the new setting), and run the following commands:
Go to the user interface of Workbench (click on the “Workbench” tab), log in using (
positas the username and the password), and launch an RStudio sessionAt the R console, install a package (for instance
remotes). Check the install logs to confirm that the package was installed from your Package Manager instance and using the binary version of the package. You should see something like this in the install logs:R Console
.... trying URL 'https://<your-package-manager-url>/ppm/cran/__linux__/noble/latest/src/contrib/remotes_2.5.0.tar.gz' .... * installing *binary* package ‘remotes’ ... * package ‘remotes’ successfully unpacked and SHA256 sums checked * DONE (remotes) ....
Testing your Workbench configuration for Python
To test the Python configuration, open the terminal inside a new RStudio session running in Workbench, and run the following commands:
Terminal
mkdir ~/python-repo-test
cd ~/python-repo-test
uv init
uv venv
source .venv/bin/activate
# Install a package with verbose output so that you can review the PyPI repo being used.
uv pip install duckdb -vThe logs should show that you are using your own instance of Package Manager.
Configure Connect to Use Package Manager for R and Python
Connect for R
To configure Connect for R, go to the user interface of your Package Manager instance (use the tab at the top of the Instruqt interface), then:
- Make sure that the “CRAN” repository is selected among the repositories you can install from, click on the “hamburger” icon menu in the top right corner, and click on “Setup”
- Choose Linux as the operating system, Ubuntu 24.04 (Noble) as the distribution, and choose “No” under “Snapshots”
- Under “Environment”, click on “Posit Connect”, and follow the instructions to configure Connect to use Package Manager for R. This will involve editing the
/etc/rstudio-connect/rstudio-connect.gcfgfile in your terminal to replace the entry forCRANwith the URL of the CRAN repository hosted on your Package Manager instance. - Restart Connect to apply the changes
Connect for Python
Connect 2026.05 introduced the PythonPackageRepository setting, which is used to configure Python repositories for both uv and pip. Instructions for this change are in the Connect Python Package Management guide.
You can follow the same steps as above for R, but instead of selecting the “CRAN” repository, select the “PyPI” repository and follow the instructions to configure Connect to use Package Manager for Python.
Edit the /etc/rstudio-connect/rstudio-connect.gcfg file to include the following:
/etc/rstudio-connect/rstudio-connect.gcfg
[PythonPackageRepository "PyPI"]
URL = https://<your-package-manager-url>/pypi/latest/simpleMake sure to restart Connect after applying the change.
Testing Connect for R
To test that Connect deployments use Package Manager for R, you are going to deploy a Quarto document hosted on GitHub:
- Go to the user interface of Connect (click on the “Connect” tab), log in using (
positas the username and the password), input an email address when asked (Connect is not configured here to send email, so the address you use will not receive any notifications) - Click on the “Publish” button, and select “Import from Git”
- In the “Git Repository URL” field, enter the following URL:
https://github.com/fmichonneau/lorenz-atlas - Choose the
mainbranch - Leave
[root directory]as the directory containing themanifest.jsonfile, and enter a title for the content. - Click on the “Deploy Content” button to deploy the content.
You can validate that the deployment is using Package Manager by checking the logs for the package installation. You should see that the packages are being installed from your Package Manager instance and using the binary versions of the packages
It takes about 2 minutes for the deployment to complete.
Testing Connect for Python
To test that Connect deployments use Package Manager for Python, you are going to deploy a Python-based content hosted on GitHub:
- Go to the user interface of Connect (click on the “Connect” tab), log in using (
positas the username and the password), click on the “Publish” button, and select “Import from Git” - In the “Git Repository URL” field, enter the following URL:
https://github.com/fmichonneau/lissajous-shiny-python - Choose the
mainbranch - Leave
[root directory]as the directory containing themanifest.jsonfile, and enter a title for the content. - Click on the “Deploy Content” button to deploy the content.
The deployment logs should show that the packages are being installed from your Package Manager instance.
- Package Manager only delivers value once Workbench and Connect are pointed at it; by default R installs from CRAN and Python from PyPI, bypassing every control you configured.
- Redirecting both products to Package Manager gives you governance (blocklist rules, curated sources, and vulnerability scanning all take effect) and performance (pre-built Linux binaries instead of slow source compilation).
- Configuration is separate for each product and each language: R in Workbench R uses an OS-specific binary URL (
r-cran-reposinrepos.conf), Python in Workbench usessession-python-index-urlinrserver.conf(which configures bothpipanduv), to configure R repositories in Connect, you can override its CRAN repository inrstudio-connect.gcfg(include internal repositories such asgit), and for Python Connect uses a[PythonPackageRepository "PyPI"]section inrstudio-connect.gcfg. - Confirm each integration by installing a package with verbose output and checking that it resolves through your Package Manager instance rather than CRAN or PyPI.