terra
terra copied to clipboard
Installation Problem on Amazon Linux 2
Hello,
I am looking to install terra on Amazon Linux 2, a Redhat-based distro. The best way I could find to install GDAL and PROJ on Redhat is installing from source, such as the following:
sudo yum install gcc-c++.x86_64 cpp.x86_64 sqlite-devel.x86_64 libtiff.x86_64 cmake3.x86_64 -y
cd /tmp
wget https://download.osgeo.org/proj/proj-6.1.1.tar.gz
tar -xvf proj-6.1.1.tar.gz
cd proj-6.1.1
./configure
sudo make
sudo make install
cd /tmp
wget https://github.com/OSGeo/gdal/releases/download/v3.2.1/gdal-3.2.1.tar.gz
tar -xvf gdal-3.2.1.tar.gz
cd gdal-3.2.1
./configure --with-proj=/usr/local --with-python
sudo make
sudo make install
But when I go to install terra I get the following:
Installing package into ‘/home/ec2-user/R/x86_64-koji-linux-gnu-library/4.0’
(as ‘lib’ is unspecified)
* installing *source* package ‘terra’ ...
** using staged installation
configure: CC: gcc -m64
configure: CXX: g++ -m64 -std=gnu++11
checking for gdal-config... /usr/local/bin/gdal-config
checking gdal-config usability... yes
configure: GDAL: 3.2.1
checking GDAL version >= 2.0.1... yes
checking for gcc... gcc -m64
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 gcc -m64 accepts -g... yes
checking for gcc -m64 option to accept ISO C89... none needed
checking how to run the C preprocessor... gcc -m64 -E
checking for grep that handles long lines and -e... /usr/bin/grep
checking for egrep... /usr/bin/grep -E
checking for ANSI C header files... yes
checking for sys/types.h... yes
checking for sys/stat.h... yes
checking for stdlib.h... yes
checking for string.h... yes
checking for memory.h... yes
checking for strings.h... yes
checking for inttypes.h... yes
checking for stdint.h... yes
checking for unistd.h... yes
checking gdal.h usability... yes
checking gdal.h presence... yes
checking for gdal.h... yes
checking GDAL: linking with --libs only... yes
checking GDAL: /usr/local/share/gdal/pcs.csv readable... yes
checking GDAL: checking whether PROJ is available for linking:... yes
checking GDAL: checking whether PROJ is available fur running:... ./gdal_proj: error while loading shared libraries: libgdal.so.28: cannot open shared object file: No such file or directory
no
configure: error: OGRCoordinateTransformation() does not return a coord.trans: PROJ not available?
ERROR: configuration failed for package 'terra'
* removing '/usr/lib64/R/library/terra'
The downloaded source packages are in
'/tmp/RtmplRJO0R/downloaded_packages'
Updating HTML index of packages in '.Library'
Making 'packages.html' ... done
I have seen other issues saying that similar errors usually indicate that there are multiple GDAL or PROJs installed, and admittedly my instance's OS is a mess from all the failed install attempts. I've done my best to clear other packages and still get this error. Just wanted to get your advice on a Redhat install if you have any.
Thank you!
Have you had a look at https://gist.github.com/abelcallejo/e75eb93d73db6f163b076d0232fc7d7e ?
Thank you for the advice! That is the guide I followed to install PROJ and GDAL from source. I used that guide to install GDAL and PROJ on my EC2 running Amazon Linux 2, also on a clean docker container running the amazonlinux image. The installations were successful on both systems, but had the above error when trying to run install.packages("terra").
I also tried to point to the proj installation using commands such as install.packages("terra", configure.args='with-proj-lib=/usr/local/lib'), taking inspiration from sf install issues like this one with no luck. Admittedly I do not have a great understanding of what those configure.args do.
There's a Dockerfile here that tries to do sth similar (but using cmake, which is what modern GDAL and PROJ versions are switching to); it might be that you have to add the ldconfig step after installing PROJ, the error message indicates GDAL installation was done without linking to PROJ. I have very little experience with Redhat linux varieties.
Closing as there has been no news for a while.
Thank you @rhijmans, I ended up using Docker to install terra via Ubuntu. Happy to give more details if anyone runs into similar issues.