Error: (converted from warning) package ‘glmnet’ is not available (for R version 3.5.3)

Viewed 2667

I have tried a number of things to get this to work and I haven't had any luck. I am using Debian 8 and I just did a fresh download of R i.e. got the highest version possible for the OS. I am downloading a github package that has glmnet as one of its packages and I am getting the following error:

Error: (converted from warning) package ‘glmnet’ is not available (for R version 3.5.3)

I know there are other posts similar to this one but I have tried them all and they still don't work. Do I really need to use e.g. Debian 9 to then get a higher version to be able to use glmnet or is there an easier workaround?

Update

I tried the recommendation from RyanFrost and it brought me further but now I am getting errors within the glmnet package. First time running the command I got an error regarding the package lattice. I ran install.packages("lattice") and re-ran the code below. Now I am stuck with these errors:

> install_version("glmnet", version = "3.0")
Downloading package from url: https://cloud.r-project.org/src/contrib/Archive/glmnet/glmnet_3.0.tar.gz
Installing package into ‘/usr/local/lib/R/site-library’
(as ‘lib’ is unspecified)
* installing *source* package ‘glmnet’ ...
** package ‘glmnet’ successfully unpacked and MD5 sums checked
** libs
gfortran   -fpic  -g -O2 -fstack-protector-strong  -c glmnet5dpclean.f -o glmnet5dpclean.o
gcc -std=gnu99 -I"/usr/share/R/include" -DNDEBUG      -fpic  -g -O2 -fstack-protector-strong -Wformat -Werror=format-security -D_FORTIFY_SOURCE=2 -g  -c glmnet_init.c -o glmnet_init.o
gcc -std=gnu99 -I"/usr/share/R/include" -DNDEBUG      -fpic  -g -O2 -fstack-protector-strong -Wformat -Werror=format-security -D_FORTIFY_SOURCE=2 -g  -c pb.c -o pb.o
pb.c: In function ‘setpb_’:
pb.c:21:3: warning: implicit declaration of function ‘R_GetCurrentEnv’ [-Wimplicit-function-declaration]
   eval(s, R_GetCurrentEnv());
   ^                                                                                                                                       
pb.c:21:11: warning: passing argument 2 of ‘Rf_eval’ makes pointer from integer without a cast                                             
   eval(s, R_GetCurrentEnv());                                                                                                             
           ^                                                                                                                               
In file included from pb.c:1:0:                                                                                                            
/usr/share/R/include/Rinternals.h:955:6: note: expected ‘SEXP’ but argument is of type ‘int’                                               
 SEXP Rf_eval(SEXP, SEXP);                                                                                                                 
      ^                                                                                                                                    
gcc -std=gnu99 -shared -L/usr/lib/R/lib -Wl,-z,relro -o glmnet.so glmnet5dpclean.o glmnet_init.o pb.o -lgfortran -lm -lquadmath -L/usr/lib/R/lib -lR                                                                                                                                  
installing to /usr/local/lib/R/site-library/glmnet/libs                                                                                    
** R
** data
** 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
Error: package or namespace load failed for ‘glmnet’ in dyn.load(file, DLLpath = DLLpath, ...):
 unable to load shared object '/usr/local/lib/R/site-library/glmnet/libs/glmnet.so':
  /usr/local/lib/R/site-library/glmnet/libs/glmnet.so: undefined symbol: R_GetCurrentEnv
Error: loading failed
Execution halted
ERROR: loading failed
* removing ‘/usr/local/lib/R/site-library/glmnet’
Error: Failed to install 'unknown package' from URL:
  (converted from warning) installation of package ‘/tmp/RtmpAoQtn8/remotes75e4327440a/glmnet’ had non-zero exit status
1 Answers

The glmnet package began requiring R version 3.6 after glmnet version 3.0 (3.0-1 onwards).

So, one thing to try would be to install version 3.0 (which only requires R 3.5+).

You can use devtools for this:

library(devtools)

install_version("glmnet", version = "3.0")
Related