3

I'm trying to install my own github package for the first time in a little while:

install.packages("devtools")
library(devtools)
install_github("SimonDedman/gbm.auto")

But am getting:

Error in loadNamespace(i, c(lib.loc, .libPaths()), versionCheck = vI[[i]]): there is no package called ‘foreign’.
ERROR: lazy loading failed for package ‘gbm.auto’

For reference:

.Library : "/usr/lib/R/library"
.libPaths() : "/home/simon/R/x86_64-pc-linux-gnu-library/3.4" "/usr/local/lib/R/site-library" "/usr/lib/R/site-library" "/usr/lib/R/library"

I've read various posts relating to this problem as pertains to installing devtools itself, Rcpp (twice), ggplot2, and devtools dependent packages, but only the 2nd Rcpp one looks vaguely relevant, hence my posting .Library & .libPaths. Even then, I'm on Linux (Xubuntu 17.10 FWIW) and am not doing any fancy RInside magic.

Using the first block of code has always worked in the past; I presume as a user I shouldn't have to manually specify install locations unless I've somehow inadvertently setup R/Rstudio to install devtools packages to a location where they can't interact with default CRAN packages?

So my next guess is that something's changed in how R manages packages/githubs/dependencies etc? Such that as the package developer I need to change something. My NAMESPACE has imports (dismo, mapplots, rgeos) and importFroms (beepr,beep, gbm,plot.gbm, gbm,predict.gbm, maptools,writeSpatialShape, raster,crop, rgdal,readOGR, shapefiles,read.shapefile) only; DESCRIPTION's only Depends is R (>= 3.3.1).

Currently this issue has failed with 'survival', which I then manually installed, and 'foreign' as pasted above. I'm not sure where these are called from, presumably a Depends (or similar) in one of the Import packages. In any case I'm reluctant to manually install everything rather than actually fixing the underlying problem. Any ideas/assistance much appreciated. Cheers!

Edit: session_info() results, having removed survival :

Session info --------------------------------
setting  value                         
version  R version 3.4.3 (2017-11-30)  
system   x86_64, linux-gnu             
ui       RStudio (1.1.419)             
language en_GB:en                      
collate  en_GB.UTF-8                   
tz       America/Los_Angeles           
date     2018-01-31     

Packages -------------------------------------------- 
package   * version date       source          
base      * 3.4.3   2017-12-01 local           
compiler    3.4.3   2017-12-01 local        
curl        3.1     2017-12-12 CRAN (R 3.4.3)  
datasets  * 3.4.3   2017-12-01 local           
devtools  * 1.13.4  2017-11-09 CRAN (R 3.4.2)  
digest      0.6.15  2018-01-28 CRAN (R 3.4.2)
git2r       0.18.0  2017-01-01 CRAN (R 3.4.0) 
graphics  * 3.4.3   2017-12-01 local           
grDevices * 3.4.3   2017-12-01 local           
httr   1.3.1   2017-08-20 CRAN (R 3.4.3)  
memoise     1.1.0   2017-04-21 CRAN (R 3.4.0)  
methods   * 3.4.3   2017-12-01 local           
R6          2.2.2   2017-06-17 CRAN (R 3.4.1)  
stats     * 3.4.3   2017-12-01 local           
tools       3.4.3   2017-12-01 local           
utils  * 3.4.3   2017-12-01 local           
withr       2.1.1   2017-12-19 CRAN (R 3.4.3)
dez93_2000
  • 1,730
  • 2
  • 23
  • 34
  • 1
    Observation: Both `survival` and `foreign` are recommended R packages. – Ralf Stubner Jan 29 '18 at 14:05
  • Good spot. Arguably makes the issue more concerning: one would think R would be LESS likely to have issues with such important/core & well maintained packages... – dez93_2000 Jan 29 '18 at 15:52
  • 1
    I tried to install `gbm.auto` in a fresh Docker container without the "recommended" packages. It worked after installing all the required system libraries. In particular `survival` and `foreign` where installed as dependencies of `gbm`and `maptools`. Can you post `session_info()` from a session where installation failed? – Ralf Stubner Jan 29 '18 at 17:57
  • Thanks Ralf. Info added above. Still strikes me as odd that dependencies (survival, foreign) of dependent packages (gbm, maptools) would break the install, as this seems to be outside of the control of the topmost package developer (me), and must be a result of recent changes in R/RStudio since this is a new issue and I don't think either gbm nor maptools have changed recently... – dez93_2000 Jan 31 '18 at 15:47
  • 1
    I am out of ideas. The `session_info` from the docker container where I installed `gbm.auto` is here: https://gist.github.com/rstub/ef59fb2545cae12d4e3ecd2cfeffdd8a. I do not see any difference that could explain your observations. – Ralf Stubner Feb 02 '18 at 16:03
  • As I see it there's no difference: if you manually installed survival & foreign it works - I've just done the same. The point is that this was never a problem before and since my package (gbm.auto) doesn't call those packages directly, it seems like a problem that is outside my control. Notwithstanding savvy users intuitively would obey the machine and install manually, new users (my 'market') may not. Ostensibly I could absorb all subordinate 'depends' to top level but that seems a hacky fix, and 'wrong'. Thanks for looking into this for me! – dez93_2000 Feb 02 '18 at 17:43
  • 1
    But I did not install these packages manually. I (1) started a `rocker/r-ver:3.4.3` container, (2) installed dev packages `libgdal-dev` and `libssl-dev`, (3) installed `devtools` from CRAN and (4) installed `gbm.auto` from GH. – Ralf Stubner Feb 02 '18 at 18:06
  • Ah, apologies, I misinterpreted your "installing all the required system libraries" as to include survival & foreign. Huh, very odd then. I wonder if this is a linux thing, and/or a peculiarity in my setup. I'll try a fresh Rstudio install and see if that fixes it. – dez93_2000 Feb 06 '18 at 12:33

0 Answers0