rstudio / rstudio/packrat

Dependencies on external packages cause error during snapshot

Open
#536 1 comment 3 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'm using packrat 0.5.0 and R 3.5.0.
It seems like installing a package to the packrat library which depends on a package which has been declared "external" causes an error on the next snapshot.

Starting in an empty project directory:

packrat::init()
Initializing packrat project in directory:
- "~/packrat-test"
--- Please select a CRAN mirror for use in this session ---

Adding these packages to packrat:
            _      
    packrat   0.5.0

Fetching sources for packrat (0.5.0) ... OK (CRAN current)
Snapshot written to '/home/brendan/packrat-test/packrat/packrat.lock'
Installing packrat (0.5.0) ... 
	OK (built source)
Initialization complete!
Packrat mode on. Using library in directory:
- "~/packrat-test/packrat/lib"
> packrat::set_opts(external.packages="dplyr")
> install.packages("assertr")
Installing package into ‘/home/brendan/packrat-test/packrat/lib/x86_64-pc-linux-gnu/3.5.0’
(as ‘lib’ is unspecified)
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100 97897  100 97897    0     0   303k      0 --:--:-- --:--:-- --:--:--  302k

Attaching package: ‘dplyr’

The following objects are masked from ‘package:base’:

    intersect, setdiff, setequal, union

* installing *source* package ‘assertr’ ...
** package ‘assertr’ successfully unpacked and MD5 sums checked
** R
** inst
** byte-compile and prepare package for lazy loading
** help
*** installing help indices
** building package indices
** installing vignettes
** testing if installed package can be loaded
* DONE (assertr)

The downloaded source packages are in
	‘/tmp/Rtmp6ofZky/downloaded_packages’
> packrat::snapshot()
Error: Unable to retrieve package records for the following packages:
- 'dplyr', 'rlang'

I ran the debugger on snapshot(). There is a call to getPackageRecordsExternalSource() whose name suggests it should be taking care of finding the package records for external sources... but it is passed the packrat library directory (packrat/lib/<architecture>/<version>) instead of the external package library directory (packrat/lib-ext/<architecture>/<library>) as lib.loc, so of course it can't find them.

Does this work for anyone?

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

Reproduce the report with packrat 0.5.0, R 3.5.0, an empty project, external.packages="dplyr", and install.packages("assertr"). Start in snapshot() and inspect getPackageRecordsExternalSource(), comparing the packrat/lib// and packrat/lib-ext// paths. Done means packrat::snapshot() retrieves records for dplyr and rlang without the reported error.

Written by the indexing model from the issue text.

Assessment

Tech stack
r
Domain
tooling
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Clearly specified
Newbie friendliness
48/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.