Skip to content

Error with x::install_github when using packrat #428

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
jananiravi opened this issue Apr 16, 2019 · 11 comments
Closed

Error with x::install_github when using packrat #428

jananiravi opened this issue Apr 16, 2019 · 11 comments

Comments

@jananiravi
Copy link

Hello,
I have been trying to install the package cmapR from the cmapR repository. I encountered a few dependency issues that were eventually fixed. I have tried the package in a few different ways and finally arrived at a snippet that works (well, almost!). The issue has been discussed in some detail here (cmap/cmapR#6) w/ @tnat1031 (a cmapR maintainer).

Issue 1: different results across Rproj+packrat combinations

I seem to be getting different success rates w/ cmapR installations depending on how populated my Rproj+packrat combinations are. Is it likely that this is a factor?

Issue 2: error w/ installation when using install_github()

I tried installing the package in one of my unpopulated (no R scripts) Rproj+packrat repos & I see this recurring error. I tried using both devtools::install_github() as well as remotes::install_github, and I get the same error.

Downloading GitHub repo cmap/cmapR@master
Error in getrootdir(untar(src, list = TRUE)) : 
  length(file_list) > 0 is not TRUE

Temporary fix

Installing the package in the user library and loading the package in the problem Rproj+packrat environment using the External packages Packrat options.

Looking through the code lines that point to this error in install-github.R and checked traceback, local environments: none of them have helped with a fix so far. Any thoughts/suggestions/tips, in case it's a mixed devtools/remotes/packrat issue? Thanks in advance!

R, RStudio versions

platform       x86_64-apple-darwin15.6.0   
arch           x86_64                      
os             darwin15.6.0                
system         x86_64, darwin15.6.0        
status                                     
major          3                           
minor          5.1                         
year           2018                        
month          07                          
day            02                          
svn rev        74947                       
language       R                           
version.string R version 3.5.1 (2018-07-02)
nickname       Feather Spray   
@eturkes
Copy link

eturkes commented Apr 20, 2019

I think I have the same problem. I've gotten my package to install with a fresh Packrat environment but after a short period of usage I get the same kind of Error in getrootdir(untar(src, list = TRUE)) : length(file_list) > 0 is not TRUE.

Here is my full error:

Downloading GitHub repo eturkes/eturkesRutils@master
/usr/bin/tar: This does not look like a tar archive

gzip: stdin: unexpected end of file
/usr/bin/tar: Child returned status 1
/usr/bin/tar: Error is not recoverable: exiting now
/usr/bin/tar: This does not look like a tar archive

gzip: stdin: unexpected end of file
/usr/bin/tar: Child returned status 1
/usr/bin/tar: Error is not recoverable: exiting now
Error in getrootdir(untar(src, list = TRUE)) : 
  length(file_list) > 0 is not TRUE
In addition: Warning messages:
1: In utils::untar(tarfile, ...) :
  ‘/usr/bin/tar -xf '/tmp/RtmpUh5cSC/file13a24b501c40.tar.gz' -C '/tmp/RtmpUh5cSC/remotes13a261c38292'’ returned error code 2
2: In system(cmd, intern = TRUE) :
  running command '/usr/bin/tar -tf '/tmp/RtmpUh5cSC/file13a24b501c40.tar.gz'' had status 2

And R.version:

platform       x86_64-suse-linux-gnu       
arch           x86_64                      
os             linux-gnu                   
system         x86_64, linux-gnu           
status                                     
major          3                           
minor          5.3                         
year           2019                        
month          03                          
day            11                          
svn rev        76217                       
language       R                           
version.string R version 3.5.3 (2019-03-11)
nickname       Great Truth   

EDIT:
Just want to add that I get the same error with "rstudio/packrat" and "cmap/cmapR" as a test. If I use a nonexistent repo name I get the standard HTTP error 404, so the problem isn't that R is unable to reach the Github repo. Same issues when using remotes.

@hblanks
Copy link

hblanks commented Apr 26, 2019

A possibly related issue is tracked in remotes is #350 . No replies from a maintainer on that thread either, though.

@jimhester
Copy link
Member

jimhester commented May 3, 2019

What does Sys.getenv("TAR") return? The most likely explanation is it is pointing to something non-standard

@XiangZhangSC
Copy link

XiangZhangSC commented May 3, 2019

I have similar issue as describd by @eturkes. Sys.getenv("tar") returns ""
Sys.getenv("TAR") returns "/bin/tar"

@eturkes
Copy link

eturkes commented May 4, 2019

Interesting I get nearly the same results as @XiangZhangSC .

> Sys.getenv("tar")
[1] ""
> Sys.getenv("TAR")
[1] "/usr/bin/tar"

EDIT:
I get the same results regardless of whether I am in a Packrat project with a working install_github or not.

@jimhester
Copy link
Member

Sorry it should be capitalized, could you run

system2(Sys.getenv("TAR"), "--version")

@eturkes
Copy link

eturkes commented May 6, 2019

tar (GNU tar) 1.30
Copyright (C) 2017 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <https://gnu.org/licenses/gpl.html>.
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.

Written by John Gilmore and Jay Fenlason.

This is in a working Packrat installation. All my installations are "fresh" at the moment because my R version was just updated by my package manager. If I manage to create a "broken" installation, I'll let you know if how the tar version output matches up.

EDIT:
Got a broken install again! Get the same output as above when I run the command.

@franzbischoff
Copy link

franzbischoff commented May 23, 2019

Bugfix
If:

getOption("download.file.method")
[1] "curl"

Then:
options("download.file.method" = "libcurl")

(edited to correct getOption() spelling )

@eturkes
Copy link

eturkes commented May 23, 2019

Can confirm that @franzbischoff's solution works on a previously broken installation. Thank you so much!

One small correction though, getOptions should be getOption.

@svmiller
Copy link

svmiller commented Jun 6, 2019

Thank you so much for this because this had been frustrating me to no end.

@svmiller
Copy link

Linux user here (Linux Mint 19). For what it's worth, I tried writing this to my .Rprofile and it kept breaking Rstudio whenever I'd try to install or update any package (from CRAN or Github). I could install from the terminal/console just fine, however.

I wish I knew why this was the case but it might be a fix you do a la carte whenever you want to install an R package from Github in a given session.

@jimhester jimhester transferred this issue from r-lib/devtools Aug 30, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

7 participants