Goal: Installing some R packages requires understanding what libraries are available on the System.
...
Table of Contents | ||
---|---|---|
|
...
Start a new Session and Start R
Code Block |
---|
[salexan5@mblog2 ~]$ module load gcc/13.2.0 r/4.4.0
[salexan5@mblog2 ~]$ R
R version 4.4.0 (2024-04-24) -- "Puppy Cup"
... |
...
Try Installing R XML
Package
Code Block |
---|
> install.packages("XML")
...
checking for xml2-config... /apps/u/spack/gcc/13.2.0/libxml2/2.10.3-5toq4pi/bin/xml2-config
...
Located parser file -I/apps/u/spack/gcc/13.2.0/libxml2/2.10.3-5toq4pi/include/libxml2 -I/apps/u/spack/gcc/13.2.0/libiconv/1.17-3dj22ny/include/parser.h
Checking for 1.8: -I/apps/u/spack/gcc/13.2.0/libxml2/2.10.3-5toq4pi/include/libxml2 -I/apps/u/spack/gcc/13.2.0/libiconv/1.17-3dj22ny/include
Using libxml2.*
checking for gzopen in -lz... yes
checking for xmlParseFile in -lxml2... yes
You are trying to use a version 2.* edition of libxml but an incompatible library. The header files and library seem to be
mismatched. If you have specified LIBXML_INCDIR, make certain to also specify an appropriate LIBXML_LIBDIR if the
libxml2 library is not in the default directories.
ERROR: configuration failed for package ‘XML’
* removing ‘/cluster/medbow/home/salexan5/R/x86_64-pc-linux-gnu-library/4.4/XML’
... |
Note |
---|
What does the error message mean? |
...
How to Resolve XML Package Issue
Info |
---|
We can see from the CRAM package XML description that from the System Requirements we require: |
Info | ||
---|---|---|
We can see that the
Install location: |
Info |
---|
Sometimes the cause of the error isn’t obvious. Try Googling to look for suggestions: Can not install XML package |
Code Block |
---|
# Withi R:
> Sys.setenv(XML_CONFIG="/apps/u/spack/gcc/13.2.0/libxml2/2.10.3-5toq4pi/bin/xml2-config")
> install.packages('XML', configure.args=c('--with-libxml2=/apps/u/spack/gcc/13.2.0/libxml2/2.10.3-5toq4pi/bin/xml2-config LIBXML_LIBDIR=-L/apps/u/spack/gcc/13.2.0/libxml2/2.10.3-5toq4pi/lib/ LIBXML_INCDIR=/apps/u/spack/gcc/13.2.0/libxml2/2.10.3-5toq4pi/include/libxml2/'))
Installing package into ‘/cluster/medbow/home/salexan5/R/x86_64-pc-linux-gnu-library/4.4’
...
* DONE (XML) |
...
Install the R sf
Package
Info |
---|
Reading the CRAN sf definition page, take note of the system requirements: System Requirements: GDAL (>= 2.0.1), GEOS (>= 3.4.0), PROJ (>= 4.8.0), sqlite3 What do we already have loaded? |
Code Block |
---|
[salexan5@mblog2 ~]$ ml
Currently Loaded Modules:
...
35) sqlite/3.43.2 76) scrnsaverproto/1.2.2
... |
Info | ||
---|---|---|
We also need to manually load:
|
...
Install the R sf
Package: Attempt 1
Code Block |
---|
> install.packages("sf")
...
also installing the dependencies ‘proxy’, ‘MASS’, ‘e1071’, ‘class’, ‘KernSmooth’, ‘wk’, ‘classInt’, ‘DBI’, ‘Rcpp’, ‘s2’, ‘units’
...
--------------------------------------------------------------------------------
Configuration failed because libudunits2.so was not found. Try installing:
* deb: libudunits2-dev (Debian, Ubuntu, ...)
* rpm: udunits2-devel (Fedora, EPEL, ...)
* brew: udunits (OSX)
If udunits2 is already installed in a non-standard location, use:
--configure-args='--with-udunits2-lib=/usr/local/lib'
if the library was not found, and/or:
--configure-args='--with-udunits2-include=/usr/include/udunits2'
if the header was not found, replacing paths with appropriate values.
You can alternatively set UDUNITS2_INCLUDE and UDUNITS2_LIBS manually.
--------------------------------------------------------------------------------
ERROR: configuration failed for package ‘units’
... |
...
Do we have a udunits
module?
Code Block |
---|
[powersw@mblog2 ~]$ module spider udunits
-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
udunits: udunits/2.2.28
-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
You will need to load all module(s) on any one of the lines below before the "udunits/2.2.28" module is available to load.
arcc/1.0 gcc/13.2.0
Help:
Automated units conversion |
Code Block |
---|
[powersw@mblog2 ~]$ module load udunits/2.2.28
# Within R
> install.packages("sf")
...
* DONE (sf) |
Info | ||
---|---|---|
Recommendation: When ever you want to use this R package, additionally load:
|
...
...
...
previous section |
next section |
Demonstrate the XML package requiring libxml
to be loaded.
...