Resolving Rcpp_precious_remove error


If you have recently tried restoring or updating packages for a project that includes relatively old packages, uses an renv or packrat lockfile, or that is on RStudio Connect, you may see this error:

  error: function 'Rcpp_precious_remove' not provided by package 'Rcpp'

This error is caused by an interaction between a recent release of the Rcpp package and RStudio Package Manager’s process for building Linux binaries. 

There are currently two options for how to resolve this issue:

  1. Upgrade Rcpp to a version >= 1.0.7.
  2. Reinstall all packages from an appropriate repository.

More details on why you might choose each of these options are after the context and background.

Background and Context

Rcpp is an important part of the R package ecosystem. Many popular R packages that include C++ code use Rcpp via a LinkingTo relationship, which does not include a version constraint.

In July, 2021, a new version of Rcpp was released. This was a completely normal update that  added some new functions to the package. One of these new functions is named Rcpp_precious_remove.

RStudio Package Manager builds R packages against the latest version of Rcpp available in the current repository. This means that new package binaries -- even of old packages -- may be built against Rcpp 1.0.7 and expect Rcpp_precious_remove to be available at runtime. 

If the lockfile creation or deployment to RStudio Connect was done before July 2021, the version of Rcpp included will be something less than Rcpp 1.0.7, so the Rcpp_precious_remove not available error will occur.

Therefore, the possible solutions are to make Rcpp 1.0.7 available in the environment or to use packages that weren’t built against Rcpp 1.0.7.

Detailed Instructions

Option 1: Upgrade Rcpp

Rcpp 1.0.7 should be backwards compatible with older versions of Rcpp and packages built against those versions of Rcpp. Upgrading to Rcpp 1.0.7 should generally be safe, and is the simplest resolution to this issue.

If you are upgrading or migrating an entire RStudio Connect instance, it may not be possible to fix each piece of content individually, and you may not want to use this option.


  1. Restore your development environment. 
    1. If you are in an renv project, run renv::restore().
    2. If you are in an RStudio Connect project, you can download the app bundle including manifest.json and use renv:::renv_lockfile_from_manifest(), followed by an renv::restore().
  2. Install Rcpp 1.0.7 by running install.packages("Rcpp").
  3. Freeze the environment by running renv::snapshot() or deploying to RStudio Connect as you normally would. 

Option 2: Reinstall all packages from an appropriate Repository

First, you will need to determine what repository to use. 

Repository Option a: Use a binary snapshot older than July 7, 2021

RStudio Package Manager builds binary packages against the latest version of Rcpp available in the repository. 

Within a /latest repository URL, CRAN packages are constantly updated and rebuilt to be compatible with each other. In a frozen snapshot repository URL, the packages are never rebuilt, so choosing a dated repository from before the Rcpp update on July 7, 2021 can resolve this issue.

If you need to match a different version of Rcpp, you can find when it was released, by searching for Rcpp under the Packages tab. If, for example, you must stay with Rcpp 1.0.5, you should choose a snapshotted repository from before the release of Rcpp 1.0.6 on January 15, 2021.

Whatever date you are choosing, you can get the binary repository URL by clicking the date on the calendar on the Setup tab.

If you are restoring packages on RStudio Connect, you will need to restore the entire package cache for the server. This means that you will not be able to install any packages newer than the date of the snapshot. This may mean you cannot use a snapshot repository and must use a source repository.

Repository Option b: Use package sources

As this issue arises due to a mismatch between Rcpp versions at compile time and runtime, you can eliminate the issue by installing packages from sources. The main disadvantage of this approach is that this can be much slower than using pre-compiled binaries.

If you are in an renv environment, you can disable automatic binary fetching from RStudio Package Manager by setting options(renv.config.rspm.enabled = FALSE).

You also can also use a repository URL where binaries are not available, like

Reinstall all packages

Whichever repository option you choose, you will then need to make use of that repository to reinstall all the relevant packages. 


If you’re in a local environment (not renv or RStudio Connect), you can just change the repository using options("repos" = c(CRAN = "<REPOSITORY URL>"))and then install any packages that might need updating with the install.packages command.


If you’re in an renv environment, you will put the repository URL into the lockfile using renv::modify(). You’ll then need to restart your R session and run an renv::restore(rebuild = TRUE).

The rebuild option will force renv to download and install the packages from scratch, as opposed to using the binaries that are already in the cache.

RStudio Connect

If your content has already been deployed to RStudio Connect and is failing with the Rcpp_precious_remove error, you will need to rebuild your entire package cache. You can set the repository in the RStudio Connect config file with the RPackageRepository option.

You will then need to rebuild your packrat cache using the migrate CLI for RStudio Connect. Note that you can run the rebuild command while RStudio Connect is online, but each piece of content will be inaccessible until its cache is rebuilt.