Understanding Packages During Deployment

Posit Connect will re-create your Python or R package environment upon deploy to match the environment you deployed from.

When you deploy content to Posit Connect, the deployment process creates a content bundle, which includes your code and data files, as well as a list of the packages and the versions of Python and/or R your content uses. For R and sometimes for Python, the exact package versions and where they were installed from is also included.

In most cases, the package and language information in the bundle is captured automatically by the deployment process, but you will have to explicitly capture it if you are using Git-backed publishing or trying to use the rsconnect deploy manifest command.

When the content item is deployed, Posit Connect creates a standalone environment for your content to run. In this environment, Posit Connect examines the information in the bundle, matches the version of Python or R, and downloads and installs the packages that are documented.

Matching Language Versions

Posit Connect automatically matches the version of Python and/or R documented in the bundle to the versions available on Posit Connect.

By default, Posit Connect does not require exact language version matching, though this is configurable. Posit Connect uses the closest version of R and any Python version within the same major release. This can occasionally cause version mismatch problems. We recommend having the same versions of Python and R on Posit Connect that you are using to develop your content.

Since Posit Connect creates its own package environment, it must be able to find and install any private packages you’re using in your content.

Unless you are including the code from your package in the content bundle, they must be available in a location Posit Connect can also reach like GitHub or a Posit Package Manager repository.

In most cases, Posit Connect will install Python and R packages from the same location you installed them from when developing.

Overriding Manifest Repositories

A Posit Connect administrator can override the Python or R repositories that appear in the manifest for a content item. They may do this, for example, to ensure that all installs come from a sanctioned internal repository. If you’re seeing packages install from an unexpected location, this is probably why.

Why can’t I just directly upload my package environment to Posit Connect?

Python and R package installs work properly only with the right operating system and the right versions of Python or R. The only way for Posit Connect to ensure the package environment will function is to download and install the packages itself for the proper version of Python or R and the proper operating system.

What if my content relies on system packages?

Some Python and R packages rely on system libraries to operate. Some common examples include libraries for creating PDFs using R Markdown or Quarto, system libraries for working with geospatial data, and invoking Java using the rJava library.

Posit Connect cannot automatically download and install these system libraries.

If you are creating content that requires these system libraries, a system administrator will have to install them in the environment where Posit Connect runs.

How does the bundle know which packages I need?

If you are automatically creating the bundle, the creation process scans your code for package dependencies, determines which version of those packages is available in your package library, and documents those versions inside the bundle.

Standard ways of invoking packages in Python or R will be recognized.

Some valid package invocations Posit Connect will recognize in R:


In Python, a requirements.txt file communicates package requirements. When the requirements.txt file is not present, requirements are captured with a call to pip freeze. Standard import pkg statements should be used.

What if I want to self-manage the package environment on Posit Connect?

Automatic Python and R package installation can be disabled, but this is an advanced feature and requires knowledge of Python and R environment administration. It is also important to note that the same operating system requirements mentioned in the previous sections also apply when manually installing packages in your runtime environment.