rstudio / rstudio/packrat

"Error in !packrat::opts$symlink.system.packages() : invalid argument type"

Open
#524 12 comments 0 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 recently upgraded R from 3.5.1 to 3.5.2 with Homebrew, which means that existing package installs were no longer available.

I have an installation script for my project, which looks like this:

➜ cat requirements.R
#!/usr/bin/env Rscript
install.packages("packrat")
library(packrat)
packrat::restore()

When I run it:

➜ Rscript requirements.R
Installing package into ‘/Users/werner/Documents/Projects/test/data-analyze/rscript/packrat/lib/x86_64-apple-darwin17.7.0/3.5.2’
(as ‘lib’ is unspecified)
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100  123k  100  123k    0     0   225k      0 --:--:-- --:--:-- --:--:--  224k
* installing *source* package ‘packrat’ ...
** package ‘packrat’ successfully unpacked and MD5 sums checked
** R
** inst
** byte-compile and prepare package for lazy loading
** help
*** installing help indices
** building package indices
** testing if installed package can be loaded
* DONE (packrat)

The downloaded source packages are in
    ‘/private/var/folders/1s/9jbdrzg17wvcnr76p_ntdnbw0000gn/T/RtmprkwTTu/downloaded_packages’

The following packages were not installed by packrat and will be ignored:
            _
    packrat   0.4.9-2

If you would like to overwrite them, call restore again with
overwrite.dirty = TRUE.
Installing BH (1.66.0-1) ...
    OK (built source)
...
Installing ggmap (2.6.1) ...
Failed to extract archive:
- '/Users/werner/Documents/Projects/test/data-analyze/rscript/packrat/src/ggmap/ggmap_2.6.1.tar.gz' => '/var/folders/1s/9jbdrzg17wvcnr76p_ntdnbw0000gn/T//RtmprkwTTu'
Reason: incomplete block on file

Error in if (!file.exists(file.path(pkg_path, "DESCRIPTION"))) { :
  argument is of length zero
Calls: <Anonymous> ... installPkg -> <Anonymous> -> install_local_path -> lapply -> FUN
In addition: Warning message:
In packrat::restore() :
  The most recent snapshot was generated using R version 3.5.1
Execution halted

So, for some reason it halted. Now when I try to run it again, I get:

➜ Rscript requirements.R
Error in !packrat::opts$symlink.system.packages() : invalid argument type
Calls: source ... setPackratModeOn -> afterPackratModeOn -> symlinkSystemPackages
Execution halted

I would think that there's a bug somewhere that leads to the current project being broken due to an incomplete installation.

I am not sure what I'm supposed to do here … what are the steps necessary to revert properly?

Some debugging info:

➜ /usr/bin/env Rscript --version
R scripting front-end version 3.5.2 (2018-12-20)

➜ R

R version 3.5.2 (2018-12-20) -- "Eggshell Igloo"
Copyright (C) 2018 The R Foundation for Statistical Computing
Platform: x86_64-apple-darwin17.7.0 (64-bit)

R is free software and comes with ABSOLUTELY NO WARRANTY.
You are welcome to redistribute it under certain conditions.
Type 'license()' or 'licence()' for distribution details.

  Natural language support but running in an English locale

R is a collaborative project with many contributors.
Type 'contributors()' for more information and
'citation()' on how to cite R or R packages in publications.

Type 'demo()' for some demos, 'help()' for on-line help, or
'help.start()' for an HTML browser interface to help.
Type 'q()' to quit R.

Error in !packrat::opts$symlink.system.packages() : invalid argument type
[Previously saved workspace restored]

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 reproducing the failure with the shown requirements.R script and trace packrat::restore() through setPackratModeOn, afterPackratModeOn, and symlinkSystemPackages, focusing on opts$symlink.system.packages(). Check how the interrupted ggmap installation affects the project state; done means the project can be restored or cleanly reset without the invalid-argument error.

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
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.