Sf: cannot install sf package

Created on 14 May 2020  Β·  10Comments  Β·  Source: r-spatial/sf

checking for gdal-config... no
no
configure: error: gdal-config not found or not executable.
ERROR: configuration failed for package 'sf'

----------------------

When I try to install the 'sf' package. This problem shows. Is there any way to install in on the Linux server?

Below are my R environment.

---------------

sessionInfo()
R version 3.6.1 (2019-07-05)
Platform: x86_64-pc-linux-gnu (64-bit)
Running under: Red Hat Enterprise Linux Server 7.7 (Maipo)

Matrix products: default
BLAS: /geode2/home/u100/wnchang/Carbonate/R3.6.1/lib64/R/lib/libRblas.so
LAPACK: /geode2/home/u100/wnchang/Carbonate/R3.6.1/lib64/R/lib/libRlapack.so

locale:
[1] C

attached base packages:
[1] stats graphics grDevices utils datasets methods base

other attached packages:
[1] units_0.6-6 devtools_2.3.0 usethis_1.6.1

loaded via a namespace (and not attached):
[1] Rcpp_1.0.4.6 magrittr_1.5 pkgload_1.0.2 R6_2.4.1
[5] rlang_0.4.6 fansi_0.4.1 tcltk_3.6.1 tools_3.6.1
[9] pkgbuild_1.0.8 sessioninfo_1.1.1 cli_2.0.2 withr_2.2.0
[13] ellipsis_0.3.0 remotes_2.1.1 assertthat_0.2.1 digest_0.6.25
[17] rprojroot_1.3-2 crayon_1.3.4 processx_3.4.2 callr_3.4.3
[21] fs_1.4.1 ps_1.3.3 curl_4.3 testthat_2.3.2
[25] memoise_1.1.0 glue_1.4.1 compiler_3.6.1 desc_1.2.0
[29] backports_1.1.7 prettyunits_1.1.1

----------------

Most helpful comment

Note that both Python and PROJ are past end of life. Python should be 3, and PROJ must be at least 6 to build with GDAL 3 properly. On Fedora/Centos/Redhat, it is much better to install current PROJ (with stock sqlite3, curl and tiff development RPMs) and GEOS from source, then install GDAL from source using the stock RPMs you need for drivers you use. Check what GDAL says when you run configure, and iterate through until the right drivers are present.

All 10 comments

Hi,

Did you try to install gdal on your system ?
Looks like you need to build it from the source code:

https://gist.github.com/simondobner/f859b2db15ad65090c3c316d3c224f45

Hope it helps

Thanks for replying @dickoa
I already fixed the 'gdal-config' issue by loading the gdal, geos, and proj module.

----------

Currently Loaded Modulefiles:
1) gcc/6.3.0 2) intel/19.0.5 3) python/2.7.16 4) perl/5.24.1 5) quota/1.2 6) git/2.13.0 7) core 8) gdal/3.0.1 9) geos/3.5.1 10) proj4/4.8.0

-------------------------------------------------------------------------------------

However, I still face error when I try to install sf package.
The error are shown below.

--------------------------------------------------------------------------------------

`
install.packages('sf')
Installing package into '/geode2/home/u100/wnchang/Carbonate/R/x86_64-pc-linux-gnu-library/3.6'
(as 'lib' is unspecified)
--- Please select a CRAN mirror for use in this session ---
trying URL 'https://cran.case.edu/src/contrib/sf_0.9-3.tar.gz'

Content type 'application/x-gzip' length 8483731 bytes (8.1 MB)

downloaded 8.1 MB

  • installing source package 'sf' ...
    * package 'sf' successfully unpacked and MD5 sums checked
    *
    using staged installation
    configure: CC: gcc
    configure: CXX: g++ -std=gnu++11
    checking for gdal-config... /N/soft/rhel7/gdal/3.0.1/bin/gdal-config
    checking gdal-config usability... yes
    configure: GDAL: 3.0.1
    checking GDAL version >= 2.0.1... yes
    checking for gcc... 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 gcc accepts -g... yes
    checking for gcc option to accept ISO C89... none needed
    checking how to run the C preprocessor... gcc -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: /N/soft/rhel7/gdal/3.0.1/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: GDAL: 3.0.1
    checking proj.h usability... no
    checking proj.h presence... no
    checking for proj.h... no
    checking proj_api.h usability... yes
    checking proj_api.h presence... yes
    checking for proj_api.h... yes
    checking for pj_init_plus in -lproj... no
    configure: error: libproj not found in standard or given locations.
    ERROR: configuration failed for package 'sf'
  • removing '/geode2/home/u100/wnchang/Carbonate/R/x86_64-pc-linux-gnu-library/3.6/sf'
    The downloaded source packages are in
    '/tmp/RtmpJRn0Kh/downloaded_packages'
    Warning message:
    In install.packages("sf") :
    installation of package 'sf' had non-zero exit status
    `

-----------------------------------------------------------------------------

It seems the new problem is 'libproj' not found.

This sounds like a problem with the module file, not sf specifically or proj4. You need to set up your module so the correct paths are searched.

Try this - after doing module load proj4/4.8.0 check to see your LD_LIBRARY_PATH includes something like .../proj.4/4.8.0/lib

Whoever created your module file probably didn't add LD_LIBRARY_PATH. Ours looks something like this:

#%Module -*- tcl -*-
##
## dot modulefile
##
proc ModulesHelp { } {
  global proj4version

  puts stderr "\tAdds Proj.4 to your environment variables,"
}

module-whatis "Adds Proj.4 to your environment variables"

set              proj4version    4.8.0
set              root              /apps/proj.4/$proj4version

prepend-path      PATH              $root/bin
prepend-path      MANPATH           $root/share/man/

prepend-path      LD_RUN_PATH       $root/lib
prepend-path      LD_LIBRARY_PATH   $root/lib
prepend-path      LIBRARY_PATH   $root/lib
prepend-path      C_INCLUDE_PATH   $root/include
prepend-path      CPATH   $root/include

Note that both Python and PROJ are past end of life. Python should be 3, and PROJ must be at least 6 to build with GDAL 3 properly. On Fedora/Centos/Redhat, it is much better to install current PROJ (with stock sqlite3, curl and tiff development RPMs) and GEOS from source, then install GDAL from source using the stock RPMs you need for drivers you use. Check what GDAL says when you run configure, and iterate through until the right drivers are present.

Hi,

When I try to install the 'sf' package in the Ubuntu 20.04 LTS, this error occurs:

* installing vignettes
*
testing if installed package can be loaded from temporary location
double free or corruption (out)

Aborted (core dumped)
ERROR: loading failed

  • removing β€˜/home/rhaphael/R/x86_64-pc-linux-gnu-library/4.0/sf’
  • restoring previous β€˜/home/rhaphael/R/x86_64-pc-linux-gnu-library/4.0/sf’
    Warning in install.packages :
    installation of package β€˜sf’ had non-zero exit status

The downloaded source packages are in
β€˜/tmp/RtmpBEgfqs/downloaded_packages’

Has this been sorted out?

Hi,

When I try to install the 'sf' package in the Ubuntu 20.04 LTS, this error occurs:

* installing vignettes
*
testing if installed package can be loaded from temporary location
double free or corruption (out)

@rhaphael how did you sort this out?
I'm getting an identical error under Linux Mint 19.1

I've tried removing PROJ/GDAL/... etc and reinstalling them (from PPA ubuntu-gis/unstable, as recommended in the sf README), and tried installling sf both from CRAN and Github, same problem every time.

> sessioninfo::session_info()
─ Session info ──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────
 setting  value                       
 version  R version 4.0.1 (2020-06-06)
 os       Linux Mint 19.1             
 system   x86_64, linux-gnu           
 ui       RStudio                     
 language en_GB                       
 collate  en_GB.UTF-8                 
 ctype    en_GB.UTF-8                 
 tz       Europe/Berlin               
 date     2020-07-13                  

I`m facing same issue as @fabian-s :+1:

> sessioninfo::platform_info()
 version  R version 4.0.2 (2020-06-22)
 os       Ubuntu 20.04.1 LTS          
 system   x86_64, linux-gnu           
 ui       RStudio                     
 language en_US:en                    
 collate  lt_LT.UTF-8                 
 ctype    en_US.UTF-8                 
 tz       Europe/Vilnius              
 date     2020-08-13   

any tips to solve the double free or corruption issue?

@edzer @dickoa
sorry to be a pest and to bump the issue like this, but since it seems that other people have the same problem as me, some guidance on this issue would be very appreciated, if any of you can spare the time.

Thanks a lot for the great package and all the work that goes into maintaining a huge project like this.

Then we first need complete error reports including:

  • your sessionInfo(),
  • how many GDAL/PROJ/GEOS versions you installed (from sources? using apt-get? both?), and where
  • the complete report shown when installing sf from source
  • whether you tried this to remove unwanted GDAL versions
Was this page helpful?
0 / 5 - 0 ratings

Related issues

thiagoveloso picture thiagoveloso  Β·  3Comments

duleise picture duleise  Β·  3Comments

jsta picture jsta  Β·  4Comments

adrfantini picture adrfantini  Β·  4Comments

dpprdan picture dpprdan  Β·  4Comments