R Packages and System Modules

Goal: Installing some R packages requires understanding what libraries are available on the System.



Start a new Session and Start R

[]$ module purge []$ module load gcc/13.2.0 r/4.4.0 []$ R R version 4.4.0 (2024-04-24) -- "Puppy Cup" ...

Try Installing R XML Package

> 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/<username>/R/x86_64-pc-linux-gnu-library/4.4/XML’ ...

What does the error message mean?


How to Resolve XML Package Issue

We can see from the CRAN package XML description that from the System Requirements we require: libxml2 (>= 2.6.3)

We can see that the libxml2 library is available and is being picked up.

[]$ ml Currently Loaded Modules: ... 15) libxml2/2.10.3 56) nghttp2/1.57.0 ...

Install location: /apps/u/spack/gcc/13.2.0/libxml2/2.10.3-5toq4pi


Install the R sf Package


Install the R sf Package: Fails


Do we have a udunits module?