I tried to install udunits2 (because I need the sf package) in Linux by using:
install.packages("/panfs/roc/groups/5/.../udunits2_0.13.tar.gz", repos=NULL, type ="source")
But I´m getting this error message:
(as ‘lib’ is unspecified)
* installing *source* package ‘udunits2’ ...
** package ‘udunits2’ successfully unpacked and MD5 sums checked
** using staged installation
checking for gcc... /panfs/roc/msisoft/gcc/8.1.0/bin/gcc
checking whether the C compiler works... yes
checking for C compiler default output file name... a.out
checking for suffix of executables...
checking whether we are cross compiling... no
checking for suffix of object files... o
checking whether we are using the GNU C compiler... yes
checking whether /panfs/roc/msisoft/gcc/8.1.0/bin/gcc accepts -g... yes
checking for /panfs/roc/msisoft/gcc/8.1.0/bin/gcc option to accept ISO C89... none needed
checking for XML_ParserCreate in -lexpat... yes
...
checking for stdint.h... yes
checking for unistd.h... yes
checking udunits2.h usability... no
checking udunits2.h presence... no
checking for udunits2.h... no
checking for ut_read_xml in -ludunits2... no
-----Error: libudunits2.a not found-----
If the udunits2 library is installed in a non-standard location,
use --configure-args='--with-udunits2-lib=/usr/local/lib' for example,
or --configure-args='--with-udunits2-include=/usr/include/udunits2'
replacing paths with appropriate values for your installation.
You can alternatively use the UDUNITS2_INCLUDE and UDUNITS2_LIB
environment variables.
If udunits2 is not installed, please install it.
It is required for this package.
ERROR: configuration failed for package ‘udunits2’
* removing ‘/panfs/roc/groups/5/.../R/x86_64-pc-linux-gnu-library/3.6/udunits2’
Warning message:
In install.packages("/panfs/roc/groups/5/.../udunits2_0.13.tar.gz", :
installation of package ‘/panfs/roc/groups/5/.../udunits2_0.13.tar.gz’ had non-zero exit status
>
Then I tried installing:libudunits2-dev, libgdal-dev, libgeos-dev and libproj-dev. But any of them are available for R version 3.6.0.
Does anyone have a suggestion? I´ve tried so many things without success. Many thanks in advance!
I got again the same issue, so I'm posting the answer that just worked for me when using Linux (PuTTy). In the sf package website, they have the following specifications for Linux:
Linux
For Unix-alikes, GDAL (>= 2.0.1), GEOS (>= 3.4.0) and Proj.4 (>= 4.8.0) are required.
However, I needed some other additional specifications (udunits
and openssl
) to make it work (perfectly) in Linux (PuTTy):
module load R/4.4.0-openblas-rocky8
module load udunits/2.2.27.6_gcc11.3.0-rocky8
module load proj/7.2.1-rocky8
module load geos/3.7.1-rocky8
module load gdal/2.3.2-rocky8
module load openssl/3.1.1
R
install.packages("sf")
library("sf")
I don't understand, however, why these additional specifications are needed. And also, why the GDAL
, GEOS
, and Proj
are of different numbers than the specifications stated in the sf website. I guess it is because the website is not updated.
Any explanation about these 2 questions are more than welcome!