trinker/pacman

p_load_gh fails but devtools::install.github works

xhdong-umd opened this issue · 5 comments

I need to install the github version of a package. p_load_gh failed with it but devtools works without a problem.

> pacman::p_load_gh("ctmm-initiative/ctmm")
Error: $ operator is invalid for atomic vectors
In addition: Warning message:
In FUN(X[[i]], ...) :
  DESCRIPTION file of package 'ctmm' is missing or broken
> devtools::install_github("ctmm-initiative/ctmm")
Downloading GitHub repo ctmm-initiative/ctmm@master
from URL https://api.github.com/repos/ctmm-initiative/ctmm/zipball/master
Installing ctmm

In theory p_load_gh just wrap around devtools so this should not happen. I found sometimes pacman called devtools with the dependencies TRUE option. In my experience calling devtools::install_github("ctmm-initiative/ctmm", dependencies = TRUE) will attempt to install dependency packages from source which will cause unnecessary problems. Though this seemed to be unrelated with the error above.

pacman::p_load_gh("ctmm-initiative/ctmm") worked on my machine. Can you provide the output of

sessionInfo() or devtools::session_info() and the output of Sys.info()?

Interesting, I restarted R session and there was no more problem. Thanks @Dasonk !

I wouldn't expect there should be a problem after you successfully installed ctmm via install_github. I'd still like to know your specific info though to see if this is something we need to look into. I'm currently running version 0.4.4 and the latest release on CRAN is 0.4.1 so that might be the issue. But if you're running 0.4.4 and had that issue I'd love to know the rest of what I requested so I can dig into the issue a bit more.

You might be able to replicate the issue by deleting the ctmm package and then trying to install it again using p_load_gh

I found if I remove the package first, then run p_load_gh, there is this error. However if I restart the R session before p_load_gh there is no problem. It's reasonable to always restart R session in package remove/installation. Though devtools worked without needing of restart R. I think there is more checking in p_load_gh which had some problem when R session is not restarted.

OK, before I restart the R session, even session_info have this error

> remove.packages("ctmm")
Removing package from ‘/Users/xhdong/Lib/RLib’
(as ‘lib’ is unspecified)
> pacman::p_load_gh("ctmm-initiative/ctmm@a24eeab591c7b00a28406a9972a26878507a43a1")
Error: $ operator is invalid for atomic vectors
In addition: Warning message:
In FUN(X[[i]], ...) :
  DESCRIPTION file of package 'ctmm' is missing or broken
> sessionInfo()
Error: $ operator is invalid for atomic vectors
In addition: Warning message:
In FUN(X[[i]], ...) :
  DESCRIPTION file of package 'ctmm' is missing or broken

This is my session info after restarting R session

> sessionInfo()
R version 3.3.2 (2016-10-31)
Platform: x86_64-apple-darwin13.4.0 (64-bit)
Running under: macOS Sierra 10.12.2

locale:
[1] en_US.UTF-8/en_US.UTF-8/en_US.UTF-8/C/en_US.UTF-8/en_US.UTF-8

attached base packages:
[1] stats     graphics  grDevices utils     datasets  methods   base     

loaded via a namespace (and not attached):
[1] tools_3.3.2
> Sys.info()
                                                                                          sysname 
                                                                                         "Darwin" 
                                                                                          release 
                                                                                         "16.3.0" 
                                                                                          version 
"Darwin Kernel Version 16.3.0: Thu Nov 17 20:23:58 PST 2016; root:xnu-3789.31.2~1/RELEASE_X86_64" 
                                                                                         nodename 
                                                                                 "LIBRLTSP221108" 
                                                                                          machine 
                                                                                         "x86_64" 
                                                                                            login 
                                                                                         "xhdong" 
                                                                                             user 
                                                                                         "xhdong" 
                                                                                   effective_user 
                                                                                         "xhdong"

Can you post the sessionInfo after loading pacman? I'm mainly interested in what version of pacman you're running.

The sessionInfo() giving the same error message after trying to do the p_install_gh seems to indicate that some sort of buffer wasn't cleared and the error was generated twice (which makes sense to me - if you knew our codebase you'd understand).

But can you load pacman and then tell me what version you're running (via the output from sessionInfo())? Thanks.