Installation of rgdal in R fails

Hello, first thanks to the developers of this great distro! I have been using Calculate for about 12 months and I am trying to build another machine with the new version 17 (LXQt)

I am trying to install rgdal (a dependency of gstat) in R on a clean installation (updated). I have sci-libs/gdal and sci-libs/proj installed. Here are the last few lines of output from the R console:

x86_64-pc-linux-gnu-g++ -I/usr/lib64/R/include -DNDEBUG -I/usr/include/gdal  -I"/home/wjc721/R/x86_64-pc-linux-gnu-library/3.2/sp/include"   -fpic  -O2 -march=x86-64 -pipe  -c OGR_write.cpp -o OGR_write.o

x86_64-pc-linux-gnu-g++ -I/usr/lib64/R/include -DNDEBUG -I/usr/include/gdal  -I"/home/wjc721/R/x86_64-pc-linux-gnu-library/3.2/sp/include"   -fpic  -O2 -march=x86-64 -pipe  -c gdal-bindings.cpp -o gdal-bindings.o

x86_64-pc-linux-gnu-gcc -std=gnu99 -I/usr/lib64/R/include -DNDEBUG -I/usr/include/gdal  -I"/home/wjc721/R/x86_64-pc-linux-gnu-library/3.2/sp/include"   -fpic  -O2 -march=x86-64 -pipe  -c init.c -o init.o

x86_64-pc-linux-gnu-gcc -std=gnu99 -I/usr/lib64/R/include -DNDEBUG -I/usr/include/gdal  -I"/home/wjc721/R/x86_64-pc-linux-gnu-library/3.2/sp/include"   -fpic  -O2 -march=x86-64 -pipe  -c inverser.c -o inverser.o
inverser.c:3:22: fatal error: projects.h: No such file or directory
 #include <projects.h>
                      ^
compilation terminated.

The installation of rgdal has a few threads on Stackoverflow, but the solutions are for Linux distributions other than Gentoo or Calculate. They suggest installation of packages (in Debian) such as libgdal1h, libgdal1-dev, libproj-dev and gdal-bin, none of which exist in Gentoo or Calculate.

I upgraded R from the default version 3.2.2 to 3.3.2 and gdal from 2.0.2-r3 to 2.0.3. This did not help, the error is the same.

Any help would be very much appreciated! This was all working fine on the previous version of Calculate :frowning:

Thanks, Bill

Hi Bill,

I guess you installed rgdal from the overlay as well? What version of sci-libs/proj did you install?

Try to contact R_Overlay mantainer (heroxbd@gentoo.org). Maybe he can help.

The installation of rgdal went well here with an older version (rgdal-1.2.3). I had to put the tar.gz in distfiles because the download link in the ebuild is broken (download from https://cran.r-project.org/src/contrib/Archive/rgdal)

Andreas and Mikhail, thanks very much for your help!

I should have mentioned above that I was trying to use install.packages() in the R console to install the R packages, I was not using the R_Overlay. I have not used any overlays in my use of Calculate so I am a newbie here.

As layman is already installed in Calculate I installed the overlay:

layman -f -a R_Overlay
... >10000 packages
sent 1,794,758 bytes  received 53,852,223 bytes  2,182,234.55 bytes/sec
total size is 77,765,864  speedup is 1.40
 * Successfully added overlay(s) R_Overlay.

I then tried to use it but it does not seem to install rgdal:

 # emerge -abk sci-CRAN/rgdal

...

These are the packages that would be merged, in order:

Calculating dependencies... done!
[binary  N     ] sci-libs/proj-4.8.0  USE="-java -static-libs" 
[binary  N     ] sci-libs/geos-3.6.1  USE="-doc -python -ruby -static-libs" PYTHON_TARGETS="python2_7" 
[binary  N     ] dev-libs/json-c-0.12  USE="-doc -static-libs" ABI_X86="32 (64) (-x32)" 
[ebuild  N    ~] virtual/lattice-0 
[ebuild  N    ~] sci-CRAN/sp-1.2.4  USE="-byte-compile -r_suggests_deldir -r_suggests_gstat -r_suggests_maptools -r_suggests_rcolorbrewer -r_suggests_rgdal -r_suggests_rgeos"                                                                                                                        
[binary  N     ] sci-libs/libgeotiff-1.4.0  USE="-debug -doc -static-libs" 
[binary  N     ] sci-libs/gdal-2.0.2-r3  USE="aux_xml geos gif jpeg jpeg2k pdf png threads -armadillo -curl -debug -doc -fits -gml -hdf5 -java -mdb -mysql -netcdf -odbc -ogdi -opencl -perl -postgres -python -spatialite -sqlite -xls" PYTHON_TARGETS="python2_7 python3_4" 
[ebuild  N    ~] sci-CRAN/rgdal-1.2.5  USE="-byte-compile" 

The following keyword changes are necessary to proceed:
 (see "package.accept_keywords" in the portage(5) man page for more details)
 # required by sci-CRAN/sp-1.2.4::R_Overlay
 # required by sci-CRAN/rgdal-1.2.5::R_Overlay
 # required by sci-CRAN/rgdal (argument)
=virtual/lattice-0 ~amd64
 # required by sci-CRAN/rgdal (argument)
=sci-CRAN/rgdal-1.2.5 ~amd64
 # required by sci-CRAN/rgdal-1.2.5::R_Overlay
 # required by sci-CRAN/rgdal (argument)
=sci-CRAN/sp-1.2.4 ~amd64

Would you like to add these changes to your config files? [Yes/No] Yes

Autounmask changes successfully written.

 * IMPORTANT: config file '/etc/portage/package.keywords/custom' needs updating.
 * See the CONFIGURATION FILES and CONFIGURATION FILES UPDATE TOOLS
 * sections of the emerge man page to learn how to update config files.

#

It did not install rgdal, and trying to load the library in R confirmed that it was not installed.

I then tried:

 # etc-update
Scanning Configuration files...
The following is the list of files which need updating, each
configuration file is followed by a list of possible replacement files.
1) /etc/portage/package.keywords/custom (1)
Please select a file to edit by entering the corresponding number.
              (don't use -3, -5, -7 or -9 if you're unsure what to do)
              (-1 to exit) (-3 to auto merge all files)
                           (-5 to auto-merge AND not use 'mv -i')
                           (-7 to discard all updates)
                           (-9 to discard all updates AND not use 'rm -i'): -3
Replacing /etc/portage/package.keywords/custom with /etc/portage/package.keywords/._cfg0000_custom
mv: overwrite '/etc/portage/package.keywords/custom'? y
Exiting: Nothing left to do; exiting. :)

and

 # dispatch-conf

then

 # emerge -abk sci-CRAN/rgdal

Local copy of remote index is up-to-date and will be used.

 * IMPORTANT: 1 news items need reading for repository 'gentoo'.
 * Use eselect news read to view new items.


These are the packages that would be merged, in order:

Calculating dependencies... done!
[binary  N     ] sci-libs/proj-4.8.0  USE="-java -static-libs" 
[binary  N     ] dev-libs/json-c-0.12  USE="-doc -static-libs" ABI_X86="32 (64) (-x32)" 
[binary  N     ] sci-libs/geos-3.6.1  USE="-doc -python -ruby -static-libs" PYTHON_TARGETS="python2_7" 
[ebuild  N    ~] virtual/lattice-0 
[ebuild  N    ~] sci-CRAN/sp-1.2.4  USE="-byte-compile -r_suggests_deldir -r_suggests_gstat -r_suggests_maptools -r_suggests_rcolorbrewer -r_suggests_rgdal -r_suggests_rgeos"                                                                                                                        
[binary  N     ] sci-libs/libgeotiff-1.4.0  USE="-debug -doc -static-libs" 
[binary  N     ] sci-libs/gdal-2.0.2-r3  USE="aux_xml geos gif jpeg jpeg2k pdf png threads -armadillo -curl -debug -doc -fits -gml -hdf5 -java -mdb -mysql -netcdf -odbc -ogdi -opencl -perl -postgres -python -spatialite -sqlite -xls" PYTHON_TARGETS="python2_7 python3_4" 
[ebuild  N    ~] sci-CRAN/rgdal-1.2.5  USE="-byte-compile" 

Would you like to merge these packages? [Yes/No] y
>>> Verifying ebuild manifests

!!! A file listed in the Manifest could not be found: /var/lib/layman/R_Overlay/sci-CRAN/sp/sp-1.2.2.ebuild

Version 1.2.2 is not there, but many others are!

 # ls -l /var/lib/layman/R_Overlay/sci-CRAN/sp/
total 56
-rw-r--r-- 1 root root 8662 Dec 26 16:10 Manifest
-rw-r--r-- 1 root root  523 Dec 26 16:10 metadata.xml
-rw-r--r-- 1 root root  638 Mar 26  2014 sp-1.0.14.ebuild
-rw-r--r-- 1 root root  663 May  8  2014 sp-1.0.15.ebuild
-rw-r--r-- 1 root root  663 Nov 10  2014 sp-1.0.16.ebuild
-rw-r--r-- 1 root root  663 Jan  9  2015 sp-1.0.17.ebuild
-rw-r--r-- 1 root root  660 Apr 25  2015 sp-1.1.0.ebuild
-rw-r--r-- 1 root root  660 Jun  6  2015 sp-1.1.1.ebuild
-rw-r--r-- 1 root root  636 Sep  9  2015 sp-1.2.0.ebuild
-rw-r--r-- 1 root root  660 Oct 19  2015 sp-1.2.1.ebuild
-rw-r--r-- 1 root root  776 Apr 15  2016 sp-1.2.3.ebuild
-rw-r--r-- 1 root root  776 Dec 26 16:10 sp-1.2.4.ebuild
#

So I am a bit lost! One thing that might help: is roverlay intended to work with R_Overlay?

Apologies if I am asking really dumb questions!

Thanks in advance for any help,
Bill

Hi Bill

You could backup the manifest file (you never know :slight_smile: ) and then delete the missing ebuild reference in the manifest

yogi77

Thanks for the suggestion Andreas. I tried to do this but I could not find an ebuild file which specifies sp-1.2.2.ebuild (!)

Anyway I have worked it out - I still cannot install rgdal but I have realised that I do not need it. In the past I have used ‘install.packages()’ in R, this time for some reason I was using ‘install.packages(, dependencies=TRUE)’. What I did not realise is that ‘dependencies=TRUE’ pulls in suggested packages as well as hard dependencies. If I use ‘install.packages(“sp”)’ (which is what I was trying to do in the first place) without ‘dependencies=TRUE’ this does not attempt to install rgdal. So I have all the R packages I need, let’s hope that I never actually need rgdal.

Cheers, Bill

UPDATE: I also asked this question on Stackoverflow and got an answer: install.packages(“rgdal”) works in the R console if the following versions of R, proj and gdal are installed in Calculate: dev-lang/R-3.3.2, sci-libs/gdal-2.0.3 and sci-libs/proj-4.9.2.

http://stackoverflow.com/questions/42756492/installation-of-rgdal-fails-in-gentoo-with-inverser-c-include-directive

Thanks all for your help,
Bill