Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

Code Block
languager
module load gdal/3.6.1 r/4.2.2

source /gpfs/sharedfs1/admin/hpc2.0/apps/gdal/3.6.1/spack/share/spack/setup-env.sh

spack load gdal

R-INLA R package

The R-INLA R package also depends on GDAL.

The R-INLA package can be install locally under a user’s account with the following steps:

#1

If a conda base environment activated, the environment would need to deactivated to install R-INLA without conflicting with conda:

Code Block
(base) [netidhere@node ~]$ conda deactivate

#2

Perform the following module loads:

...

RCurl with sftp functionality

Code Block
module load gsllibiconv/2.7 cuda/11.6 udunits freetype/2.12.11.17 udunits gdal/3.86.40 r/4.4.0

#3

After gdal is loaded, R can be called to install a local version of INLA

R-INLA needs the remotes command from either devtools or standalone to be able to install successfully as R-INLA is not in the CRAN repository.

If devtools is not locally installed, devtools would need to be installed first before R-INLA can be installed:

Code Block
2.2

source /gpfs/sharedfs1/admin/hpc2.0/apps/gdal/3.6.0/spack/share/spack/setup-env.sh

spack load gdal

module load libcurl/8.6.0

R

> .libPaths("~/rlibs")

> install.packages("devtoolsRCurl", lib = "~/rlibs", type = "source", repo = "https://cloud.r-project.org/")

Devtools can take a long time to install due to being a very large package.

If devtools crashes and fails to install dependencies, the remotes R package can be directly installed instead of devtools with the following command:

install.packages("remotes", lib = "~/rlibs", type = "source", repo = "https://cloud.r-project.org/")

#4

Install SF R package:

Code Block
> .libPaths("~/rlibs")
> install.packages("sf", lib = "~/rlibs", type = "source", configure.args = c("--with-sqlite3-lib=/gpfs/sharedfs1/admin/hpc2.0/apps/sqlite/3.45.2/lib", "--with-proj-lib=/gpfs/sharedfs1/admin/hpc2.0/apps/proj/9.4.0/lib64"), repo = "https://cloud.r-project.org/")

The libraries for sqlite3 and proj can change depending if gdal updates and gdal is built with newer versions.

Before each install, you might need to quit out of R and reload R with a fresh environment.

#5

R-INLA:

Code Block
[netidhere@node ~]$ R

> .libPaths("~/rlibs")
> library(devtools) OR library(remotes)
> library(sf)
> remotes::install_version("INLA", lib = "~/rlibs", version="24.02.09",repos=c(getOption("repos"),INLA="https://inla.r-inla-download.org/R/stable"), dep=TRUE)

A specific version of R-INLA can be installed, in the above example the stable 24.02.09 version of INLA will be installed and the library will install under a local library directory called ~/rlibs.

When R prompts to updated existing packages when installing R-INLA, say option 3 to not update packages.

If a specific version is not needed, then the following command can be entered to install the stable version of R-INLA:

Code Block
remotes::install_version("INLA", lib = "~/rlibs",repos=c(getOption("repos"),INLA="https://inla.r-inla-download.org/R/stable"), dep=TRUE)

The install should be successful once the install finishes.

#4

To upgrade the current INLA version, the following command can be entered within R after loading the INLA R package:

Code Block
> library(INLA)
> inla.upgrade()
INLA :
 Version 18.07.12 installed in /home/netidhere/rlibs
 Version 24.02.09 available at https://inla.r-inla-download.org/R/stable
Update? (Yes/no/cancel) y

At the time of this update, version 24.02.09 is the latest supported stable version.

Once INLA gets installed (specific version or upgraded), conda can be reactivated and INLA should load and run successfully in R

#5

Code Block
> library(INLA)
Loading required package: Matrix
Loading required package: sp
This is INLA_24.02.09 built 2024-02-09 03:35:28 UTC.
 - See www.r-inla.org/contact-us for how to get help.
 - List available models/likelihoods/etc with inla.list.models()
 - Use inla.doc(<NAME>) to access documentation
>

#6

If INLA runs into glibc errors, the following command can be a workaround:

Code Block
The followup steps will be:

1. inla.upgrade(testing=T) to get the most recent testing version.
2. Close R using quit() and select no. This forces an update with R
3. Re-load R, load the INLA R package, then install a binary version with the command:
inla.binary.install()
Select CentOS 7 when prompted or Fedora

RCurl with sftp functionality

Code Block
module load libiconv/1.17 udunits gdal/3.6.0 r/4.2.2

source /gpfs/sharedfs1/admin/hpc2.0/apps/gdal/3.6.0/spack/share/spack/setup-env.sh

spack load gdal

module load libcurl/8.6.0

R

> .libPaths("~/rlibs")

> install.packages("RCurl

> library(RCurl)
>
> curlVersion()$protocols
 [1] "dict"    "file"    "ftp"     "ftps"    "gopher"  "gophers" "http"
 [8] "https"   "imap"    "imaps"   "mqtt"    "pop3"    "pop3s"   "rtsp"
[15] "scp"     "sftp"    "smb"     "smbs"    "smtp"    "smtps"   "telnet"
[22] "tftp"

SF R package

After building the gdal dependency tree from source, the SF R package has issues pulling from the paths set by the modules loaded on HPC for sqlite3 and proj.

To bypass the issue, certain configure flags need to be set within the R install.packages command that is used to install the SF package.

To install the SF R package under a local HPC directory the following modules would need to be loaded and the following R command to be used:

Code Block
module load udunits gdal/3.8.4 r/4.3.2

R
> .libPaths("~/rlibs")
> install.packages("sf", lib = "~/rlibs", type = "source", configure.args = c("--with-sqlite3-lib=/gpfs/sharedfs1/admin/hpc2.0/apps/sqlite/3.45.2/lib", "--with-proj-lib=/gpfs/sharedfs1/admin/hpc2.0/apps/proj/9.4.0/lib64"), repo = "https://cloud.r-project.org/")

The above install.packages command should be successful.

Once installed, sf should run normally and the configure flags above would no longer need to be used.

R-INLA R package

The R-INLA R package also depends on GDAL.

The R-INLA package can be install locally under a user’s account with the following steps:

#1

If a conda base environment activated, the environment would need to deactivated to install R-INLA without conflicting with conda:

Code Block
(base) [netidhere@node ~]$ conda deactivate

#2

Perform the following module loads:

Code Block
[netidhere@node ~]$ module load gsl/2.7 cuda/11.6 udunits freetype/2.12.1 gdal/3.8.4 r/4.4.0

#3

After gdal is loaded, R can be called to install a local version of INLA

R-INLA needs the remotes command from either devtools or standalone to be able to install successfully as R-INLA is not in the CRAN repository.

If devtools is not locally installed, devtools would need to be installed first before R-INLA can be installed:

Code Block
> .libPaths("~/rlibs")
> install.packages("devtools", lib = "~/rlibs", type = "source", repo = "https://cloud.r-project.org/")

Devtools can take a long time to install due to being a very large package.

If devtools crashes and fails to install dependencies, the remotes R package can be directly installed instead of devtools with the following command:

install.packages("remotes", lib = "~/rlibs", type = "source", repo = "https://cloud.r-project.org/")

#4

Install SF R package:

Code Block
> .libPaths("~/rlibs")
> install.packages("sf", lib = "~/rlibs", type = "source", configure.args = c("--with-sqlite3-lib=/gpfs/sharedfs1/admin/hpc2.0/apps/sqlite/3.45.2/lib", "--with-proj-lib=/gpfs/sharedfs1/admin/hpc2.0/apps/proj/9.4.0/lib64"), repo = "https://cloud.r-project.org/")

The libraries for sqlite3 and proj can change depending if gdal updates and gdal is built with newer versions.

Before each install, you might need to quit out of R and reload R with a fresh environment.

#5

R-INLA:

Code Block
[netidhere@node ~]$ R
> .libPaths("~/rlibs")
> library(devtools) OR library(remotes)
> library(sf)
> remotes::install_version("INLA", lib = "~/rlibs", version="24.02.09",repos=c(getOption("repos"),INLA="https://inla.r-inla-download.org/R/stable"), dep=TRUE)

A specific version of R-INLA can be installed, in the above example the stable 24.02.09 version of INLA will be installed and the library will install under a local library directory called ~/rlibs.

When R prompts to updated existing packages when installing R-INLA, say option 3 to not update packages.

If a specific version is not needed, then the following command can be entered to install the stable version of R-INLA:

Code Block
remotes::install_version("INLA", lib = "~/rlibs",repos=c(getOption("repos"), repo INLA= "https://cloudinla.r-inla-project.org/")

> library(RCurl)
>
> curlVersion()$protocols
 [1] "dict"    "file"    "ftp"     "ftps"    "gopher"  "gophers" "http"
 [8] "https"   "imap"    "imaps"   "mqtt"    "pop3"    "pop3s"   "rtsp"
[15] "scp"     "sftp"    "smb"     "smbs"    "smtp"    "smtps"   "telnet"
[22] "tftp"

SF R package

After building the gdal dependency tree from source, the SF R package has issues pulling from the paths set by the modules loaded on HPC for sqlite3 and proj.

To bypass the issue, certain configure flags need to be set within the R install.packages command that is used to install the SF package.

To install the SF R package under a local HPC directory the following modules would need to be loaded and the following R command to be used:

Code Block
module load udunits gdal/3.8.4 r/4.3.2

R
> .libPaths("~/rlibs")
> install.packages("sf", lib = "~/rlibs", type = "source", configure.args = c("--with-sqlite3-lib=/gpfs/sharedfs1/admin/hpc2.0/apps/sqlite/3.45.2/lib", "--with-proj-lib=/gpfs/sharedfs1/admin/hpc2.0/apps/proj/9.4.0/lib64"), repo = "https://cloud.r-project.org/")

The above install.packages command should be successful.

...

download.org/R/stable"), dep=TRUE)

The install should be successful once the install finishes.

#4

To upgrade the current INLA version, the following command can be entered within R after loading the INLA R package:

Code Block
> library(INLA)
> inla.upgrade()
INLA :
 Version 18.07.12 installed in /home/netidhere/rlibs
 Version 24.02.09 available at https://inla.r-inla-download.org/R/stable
Update? (Yes/no/cancel) y

At the time of this update, version 24.02.09 is the latest supported stable version.

Once INLA gets installed (specific version or upgraded), conda can be reactivated and INLA should load and run successfully in R

#5

Code Block
> library(INLA)
Loading required package: Matrix
Loading required package: sp
This is INLA_24.02.09 built 2024-02-09 03:35:28 UTC.
 - See www.r-inla.org/contact-us for how to get help.
 - List available models/likelihoods/etc with inla.list.models()
 - Use inla.doc(<NAME>) to access documentation
>

#6

If INLA runs into glibc errors, the following command can be a workaround:

Code Block
The followup steps will be:
1. inla.upgrade(testing=T) to get the most recent testing version.
2. Close R using quit() and select no. This forces an update with R
3. Re-load R, load the INLA R package, then install a binary version with the command:
inla.binary.install()
Select CentOS 7 when prompted or Fedora