ismailsunni/dockeRs

Can't Install `sf` on MRO on Fedora

ismailsunni opened this issue · 4 comments

Similar issue as in the FastR, here the error that I got:

> install.packages('sf')
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100 7975k  100 7975k    0     0  83569      0  0:01:37  0:01:37 --:--:--  175k
* installing *source* package ‘sf’ ...
** package ‘sf’ successfully unpacked and MD5 sums checked
configure: CC: gcc -std=gnu99
configure: CXX: g++ -std=gnu++11
checking for gdal-config... /usr/bin/gdal-config
checking gdal-config usability... yes
configure: GDAL: 2.3.2
checking GDAL version >= 2.0.0... yes
checking for gcc... gcc -std=gnu99
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 -std=gnu99 accepts -g... yes
checking for gcc -std=gnu99 option to accept ISO C89... none needed
checking how to run the C preprocessor... gcc -std=gnu99 -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/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:... yes
configure: pkg-config proj exists, will use it
checking proj_api.h usability... no
checking proj_api.h presence... no
checking for proj_api.h... no
configure: error: proj_api.h not found in standard or given locations.
ERROR: configuration failed for package ‘sf’

I tried to install GNU R in the same docker image and then tried to install sf. It works fine.

To replicate, go to the docker container:

# To open new R session
docker run  -it --rm ismailsunni/mro-3.5.3-fedora-geospatial R

or

# Run shell in the docker container
docker run -it --rm ismailsunni/mro-3.5.3-fedora-geospatial /bin/bash
# Open MRO session
R

The second way is probably more usefull if you want to investigate the docker container.

Then install sf

install.packages('sf')

It will return an error like in #39 (comment)

nuest commented

MRO uses an MRAN snapshot:

Microsoft R Open 3.5.3
The enhanced R distribution from Microsoft
Microsoft packages Copyright (C) 2019 Microsoft Corporation

Using the Intel MKL for parallel mathematical computing (using 4 cores).

Default CRAN mirror snapshot taken on 2019-04-15.
See: https://mran.microsoft.com/.

When I tried to install rgdal I got this hint:

configure: pkg-config proj exists, will use it
configure: PROJ version: 6.2.0
configure: Support for PROJ >= 6.0.0 not yet available, deprecated API defined
configure: proj CPP flags: -DACCEPT_USE_OF_DEPRECATED_PROJ_API_H  
checking PROJ header API:... proj_api.h
checking proj_api.h presence and usability... yes
checking PROJ version agreement... yes
checking PROJ version >= 4.8.0... yes
checking PROJ.4: proj.db found and readable... yes
checking PROJ.4: conus found and readable... yes
configure: Package CPP flags:  -I/usr/include/gdal -DACCEPT_USE_OF_DEPRECATED_PROJ_API_H
configure: Package LIBS:  -L/usr/lib64 -lgdal -lproj

Looking at the list of available proj versions for Fedora 32:

[root@b7b74d7af406 docker]# dnf --showduplicates list proj
Installed Packages
proj.x86_64                                                                             6.2.0-1.fc32                                                                             @rawhide
Available Packages
proj.i686                                                                               6.2.0-1.fc32                                                                             rawhide 
proj.x86_64                                                                             6.2.0-1.fc32                                                                             rawhide 

I think it would be good to use an older version of Fedora that matches the release date of MRO 3.5.3 and the CRAN mirror, so you have an older version of proj available, which should be better supported by the versions of rgdal and sf.

Looking at https://en.wikipedia.org/wiki/Fedora_version_history Fedora 30 might be a good candidate:

$ docker run -it --rm fedora:30
Unable to find image 'fedora:30' locally
30: Pulling from library/fedora
b0fe058ffda2: Pull complete 
Digest: sha256:a31809d5e9d991a291605e932077aaf5f2beff64dee85b34d911228196af406e
Status: Downloaded newer image for fedora:30
[root@9340e3bf3f3f /]# dnf --showduplicates list proj
Fedora Modular 30 - x86_64                                                                                                                               2.4 MB/s | 2.7 MB     00:01    
Fedora Modular 30 - x86_64 - Updates                                                                                                                     1.5 MB/s | 4.0 MB     00:02    
Fedora 30 - x86_64 - Updates                                                                                                                             7.8 MB/s |  23 MB     00:02    
Fedora 30 - x86_64                                                                                                                                        13 MB/s |  70 MB     00:05    
Last metadata expiration check: 0:00:01 ago on Thu Jan  9 09:01:58 2020.
Available Packages
proj.i686                                                                               5.2.0-1.fc30                                                                              fedora 
proj.x86_64                                                                             5.2.0-1.fc30                                                                              fedora 
proj.i686                                                                               5.2.0-2.fc30                                                                              updates
proj.x86_64                                                                             5.2.0-2.fc30                                                                              updates

Hi @nuest
Thanks for the hint, I rebuild using Fedora 30, it works now.