glmnet
Web: https://glmnet.stanford.edu/.
4.1-3
The ‘install.packages("glmnet")' command under R 4.1.3 gave the following error,
elnet_exp.cpp:141:59: required from here
glmnetpp/include/glmnetpp_bits/elnet_point/gaussian_base.hpp:90:39: error: 'self' was not declared in this scope
[=](auto k) { self().template update<update_type::partial>(k, ab, dem); },
Bash
We now proceed manually,
Rscript -e 'download.packages("glmnet",".")'
tar tvfz glmnet_4.1-3.tar.gz
and then modify src/glmnetpp/include/glmnetpp_bits/elnet_point/gaussian_base.hpp
line 90123 as follows,
[=](auto k) {this -> self().template update<update_type::partial>(k, ab, dem); }
and similarly line 55.
Our final step is then
R CMD INSTALL glmnet
4.1-4
login node
It requires C++14, so we proceed with
echo "CXX14 = g++ -std=gnu++14 -fPIC" > ~/.R/Makevars
module load gcc/7
Rscript -e 'install.packages("glmnet")'
4.1-7
Released on 23/3/2023, it requires C++17 so the Makevars as above becomes
CXX17 = g++ -std=gnu++17 -fPIC
4.1-8
Besides ~/.R/Makevars, the following is necessary
module switch gcc/7
icelake
Latest information
After software update on 27/4/2022, the R 4.2.0 installed from login nodes also works nicely with glmnet installed there.
R/4.1.0-icelake
The Matrix package is also required to recompile.
module load R/4.1.0-icelake
wget https://cran.r-project.org/src/contrib/Matrix_1.4-1.tar.gz
wget https://cran.r-project.org/src/contrib/glmnet_4.1-4.tar.gz
R CMD INSTALL Matrix_1.4-1.tar.gz
R CMD INSTALL glmnet_4.1-4.tar.gz
R CMD INSTALL Matrix_1.4-1.tar.gz -l .
so that the Matrix package is installed first to get going with glmnet but then made available locally to avoid conflict with the login nodes.
library(Matrix,lib.loc=".")
library(glmnet)
The Matrix package is then reinstalled from the usual login node.
-
This will be changed at the next release of glmnet. ↩
-
See https://www.geeksforgeeks.org/this-pointer-in-c/ for information on the
this
operator. ↩