rstudio / rstudio/packrat

Error in `snapshot()` with packages installed from external source

Open
#153 29 comments 5 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
R
Stars
409
Forks
89
PR merge metrics
No merged PRs in 30d

Description

I have been trying to use packages from my company internal CRAN-like repository in my packrat project. I can install fine, but when I do packrat::snapshot() I get the error

Error: Unable to retrieve package records for the following packages: ...

The problem is that inferPackageRecords sets source = "unknown" for these external packages. Going through the code of getPackageRecords (which is throwing the error), it seems that these packages are picked up by the call to getPackageRecordsExternalSource but then they are dropped because they have unknown source.

To expand further, the error disappears if I explicitly hack the DESCRIPTION file adding Repository:CRAN for example, or if I call getPackageRecords with fallback.ok = TRUE (although there doesn't seem to be a way to do that from snapshot). In both cases the source is (incorrectly) set to "CRAN" and no error is thrown.

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by tracing inferPackageRecords, getPackageRecords, and getPackageRecordsExternalSource during packrat::snapshot() with a package from an external CRAN-like repository. Compare the behavior with a DESCRIPTION file containing Repository: CRAN and with fallback.ok = TRUE. Done should mean snapshot() handles the external package without a DESCRIPTION hack or incorrectly labeling it as CRAN.

Written by the indexing model from the issue text.

Assessment

Tech stack
r
Domain
tooling
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.