Trouble installing rgdal

后端 未结 4 1534
无人共我
无人共我 2020-12-08 03:18

I want to install rgdal for \"R version 3.2.3 (2015-12-10)\". I downloaded and installed

  • GDAL 1.11 Complete
  • PROJ framework
相关标签:
4条回答
  • 2020-12-08 03:29

    I had the same error Running R 3.4.0 on macOS Sierra (10.12). So I used homebrew to install gdal, then rgdal installed as per usual in R

    in Terminal

    brew update
    brew install gdal
    

    in R

    install.packages("rgdal")
    

    devtools::session_info()
    Session info ----------------------------------------------------------------------------------------------------------------------------------------------
     setting  value                       
     version  R version 3.4.0 (2017-04-21)
     system   x86_64, darwin15.6.0        
     ui       RStudio (1.0.143)           
     language (EN)                        
     collate  en_AU.UTF-8                 
     tz       Australia/Melbourne         
     date     2017-04-24                  
    
    Packages --------------------------------------------------------------------------------------------------------------------------------------------------
     package  * version date       source        
     devtools   1.12.0  2016-12-05 CRAN (R 3.4.0)
     digest     0.6.12  2017-01-27 CRAN (R 3.4.0)
     lattice    0.20-35 2017-03-25 CRAN (R 3.4.0)
     memoise    1.1.0   2017-04-21 CRAN (R 3.4.0)
     rgdal    * 1.2-6   2017-04-06 CRAN (R 3.4.0)
     sp       * 1.2-4   2016-12-22 CRAN (R 3.4.0)
     withr      1.0.2   2016-06-20 CRAN (R 3.4.0)
    
    0 讨论(0)
  • 2020-12-08 03:34

    I installed it via conda on my Mac (OS X 10.10.5). The installation was simple. If you're new to conda, check this http://conda.pydata.org/docs/r-with-conda.html

    conda install gdal
    gdalinfo --version
    # GDAL 2.1.0, released 2016/04/25
    

    R Package installation:

    install.packages('rgdal', type = "source", configure.args=c(
        '--with-gdal-config=/Library/Frameworks/GDAL.framework/Programs/gdal-config',
        '--with-proj-include=/Library/Frameworks/PROJ.framework/Headers',
        '--with-proj-lib=/Library/Frameworks/PROJ.framework/unix/lib'))
    
    install.packages('rgeos', type = "source", configure.args=c(
        '--with-gdal-config=/Library/Frameworks/GDAL.framework/Programs/gdal-config',
        '--with-proj-include=/Library/Frameworks/PROJ.framework/Headers',
        '--with-proj-lib=/Library/Frameworks/PROJ.framework/unix/lib'))
    
    install.packages('maptools', dependencies=TRUE)
    
    0 讨论(0)
  • 2020-12-08 03:38

    Quick note building on previous answer by @Stophface that might be useful to someone:

    I did all steps listed above, but the rgdal installation in Terminal still gave me the error of configure: error: proj_api.h not found in standard or given locations. Yet (and without knowing exactly why), I managed to install it from R.app using pretty much the same specifications:

    > install.packages('rgdal', type = "source", configure.args=c(
         '--with-gdal-config=/Library/Frameworks/GDAL.framework/Programs/gdal-config',
         '--with-proj-include=/Library/Frameworks/PROJ.framework/Headers',
         '--with-proj-lib=/Library/Frameworks/PROJ.framework/unix/lib'))
    

    And thanks again for your answer!

    0 讨论(0)
  • 2020-12-08 03:43

    Finally solved it.

    Here is how I've done it! OS X 10.10.5 R 3.2.3 GDAL 1.1

    1. Download and install the GDAL Complete Framework from here
    2. Tell your OS X where to find the gdal-config file by typing this in you shell echo 'export PATH=/Library/Frameworks/GDAL.framework/Programs:$PATH' >> ~/.bash_profile and then source ~/.bash_profile
    3. Check if your GDAL is working fine by typing in the bash gdalinfo --version. That should come back with something like GDAL 1.11.3, released 2015/09/16.
    4. For most people, starting R and typing install.packages("rgdal") works (if you've done step 1-3). However, that was not the case for me. So, proceed with 5 if you're still having troubles.
    5. Go to the GDAL website and download the .tar file.
    6. In the shell, try this: sudo R CMD INSTALL –configure-args=’–with-proj-include=/usr/local/lib’ rgdal_1.1-1.tar. That still gave me an error: configure: error: proj_api.h not found in standard or given locations. ERROR: configuration failed for package ‘rgdal’
    7. So, you again need to tell where to find that one. Try:
    R CMD INSTALL rgdal_1.1-1.tar --configure-args='--with-gdal-config=/Library/Frameworks/GDAL.framework/Programs/gdal-config
     --with-proj-include=/Library/Frameworks/PROJ.framework/Headers
     --with-proj-lib=/Library/Frameworks/PROJ.framework/unix/lib'
    

    That should work. Try by starting R and type library(rgdal) in the R console.

    Note: With rgoes I experienced similar problems. This helped me. Try:

    R CMD INSTALL rgeos_0.3-15.tar --configure-args='--with-geos-config=/Library/Frameworks/GEOS.framework/unix/bin/geos-config
    --with-proj-include=/Library/Frameworks/PROJ.framework/Headers
    --with-proj-lib=/Library/Frameworks/PROJ.framework/unix/lib'
    

    For pointing to the config file. It's here /Library/Frameworks/GEOS.framework/unix/bin/geos-config

    0 讨论(0)
提交回复
热议问题