Skip to content

Frequently Asked Questions

Why can’t I load my package? It is listed my config file and I ran rv sync

Section titled “Why can’t I load my package? It is listed my config file and I ran rv sync”

If you are getting an error like the following:

Terminal window
> library(dplyr)
Error in `library()`:
! there is no package called 'dplyr'
Show Traceback

It is likely because your .libPaths() is not set to the rv library path.

There are a few reasons this can occur:

  1. Your .Rprofile is not sourcing rv/scripts/activate.R

    • Run restart R or run source(".Rprofile"). After either, you should see a message containing the following:
      rv libpaths active!
      library paths:
      /Users/rv-user/projects/prism-pkg-pub/rv/library/4.4/arm64
      /Library/Frameworks/R.framework/Versions/4.4-arm64/Resources/library
    • Ensure rv/scripts/activate.R is present in your directory. If it is not, run rv activate and restart R.
    • Ensure source("rv/scripts/activate.R") is present in your .Rprofile. If it is not, add it as the first line
  2. You are launching a background job from a subdirectory that does not contain a .Rprofile

    This often occurs when rendering a quarto document. In this case, add a .Rprofile to the subdirectory that sources the project root’s .Rprofile.

    For example, if we want to render a quarto document from two subdirectories inside the project, we’d add a .Rprofile that contains source("../../.Rprofile")

    • Directorymy-project/
      • Directoryscripts/
        • Directoryreports
          • my-report.qmd
          • .Rprofile contains source("../../.Rprofile")
      • Directoryrv/scripts
        • activate.R
      • .Rprofile contains `source(“rv/scripts/activate.R”)
      • rproject.toml