rstudio / packrat

Packrat is a dependency management system for R
http://rstudio.github.io/packrat/
401 stars 89 forks source link

Adding repo from ropensci #592

Open jasonjb82 opened 4 years ago

jasonjb82 commented 4 years ago

I am trying to take a snapshot of my project that includes the following package

install.packages("rnaturalearthhires", repos = "http://packages.ropensci.org", type = "source")

Unfortunately, when I run packrat:status(), I get the following error

Error: Unable to retrieve package records for the following packages:
- "rnaturalearthhires

Do you know how I could add this repo so I can add this package to my snapshot?

kevinushey commented 4 years ago

You need to add it to the repos R option; e.g.

options(repos = c(getOption("repos"), ROpenSci = "http://packages.ropensci.org"))

After doing this you'll likely need to call packrat::snapshot() to update the lockfile as well.

jasonjb82 commented 4 years ago

Thanks for this, Kevin.

I tried adding the repo which now shows me this when I type getOption("repos")

                          CRAN                       ROpenSci 
   "https://cran.rstudio.com/" "http://packages.ropensci.org"

However, when I call packrat::snapshot() again, it still gives me the same error

kevinushey commented 4 years ago

Are you working on macOS? The CRAN binary repository is currently broken and that is affecting Packrat as well.

jasonjb82 commented 4 years ago

No, I use a Windows 10 machine. Just wondering how exactly this is affecting me adding this repo and creating a new snapshot.

kevinushey commented 4 years ago

The problem is that the installed package does not indicate it is from a package repository:

> desc <- read.dcf(
+   system.file("DESCRIPTION", package = "rnaturalearthhires"),
+   all = TRUE
+ )
> desc$Repository
NULL

You can install the development version of Packrat if you need to work around this issue:

remotes::install_github("rstudio/packrat")

And note that you'll still need to set the repos option to list both of your package repositories.

jasonjb82 commented 4 years ago

Thanks @kevinushey, I'll try this.