安装 rgdal 时遇到问题
Trouble installing rgdal
我想为 "R version 3.2.3 (2015-12-10)"
安装 rgdal
。
我下载并安装了
- GDAL 1.11 完成
- PROJ框架v4.9.2-2
- GEOS 框架 v3.5.0-1
来自 KyngChaos
然后在 RStudio 中我输入 install.packages("rgdal")
这给了我这个:
> ....
>
> configure: CC: clang configure: CXX: clang++ configure: rgdal:
> 1.1-1 checking for /usr/bin/svnversion... yes configure: svn revision:
> 572 checking for gdal-config...
> no no configure: error: gdal-config
> not found or not executable. ERROR: configuration failed for package
> ‘rgdal’
> * removing ‘/Library/Frameworks/R.framework/Versions/3.2/Resources/library/rgdal’
> Warning in install.packages : installation of package ‘rgdal’ had
> non-zero exit status
> sessionInfo()
R version 3.2.3 (2015-12-10)
Platform: x86_64-apple-darwin13.4.0 (64-bit)
Running under: OS X 10.10.5 (Yosemite)
locale:
[1] de_AT.UTF-8/de_AT.UTF-8/de_AT.UTF-8/C/de_AT.UTF-8/de_AT.UTF-8
attached base packages:
[1] stats graphics grDevices utils datasets methods base
loaded via a namespace (and not attached):
[1] tools_3.2.3
我也在终端里试过了
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'
和
sudo R CMD INSTALL –configure-args=’–with-proj-include=/usr/local/lib’ rgdal_1.1-1.tar
运气不好!
终于解决了
这是我的做法!
OS X 10.10.5
R 3.2.3
GDAL 1.1
- 从 here
下载并安装 GDAL 完整框架
- 告诉你的 OS X 在你的 shell 中输入
gdal-config
文件的位置
echo 'export PATH=/Library/Frameworks/GDAL.framework/Programs:$PATH' >> ~/.bash_profile
然后 source ~/.bash_profile
- 通过输入 bash
gdalinfo --version
检查您的 GDAL 是否工作正常。那应该返回类似 GDAL 1.11.3, released 2015/09/16
的内容。
- 对于大多数人来说,启动 R 并输入
install.packages("rgdal")
是可行的(如果您已完成第 1-3 步)。但是,对我来说情况并非如此。所以,如果您仍然遇到问题,请继续执行 5。
- 转到 GDAL 网站并下载
.tar
文件。
- 在 shell 中,试试这个:
sudo R CMD INSTALL –configure-args=’–with-proj-include=/usr/local/lib’ rgdal_1.1-1.tar
。那仍然给我一个错误:configure: error: proj_api.h not found in standard or given locations.
ERROR: configuration failed for package ‘rgdal’
- 因此,您再次需要告诉在哪里可以找到那个。尝试:
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'
应该可以。尝试启动 R
并在 R 控制台中键入 library(rgdal)
。
注意:rgoes
我遇到了类似的问题。 This 帮助了我。
尝试:
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'
用于指向 config
文件。就在这里/Library/Frameworks/GEOS.framework/unix/bin/geos-config
基于@Stophface 先前回答的快速说明可能对某人有用:
上面的步骤我都做了,但是在Terminal安装rgdal还是报configure: error: proj_api.h not found in standard or given locations
的错误。然而(并不知道确切原因),我设法使用几乎相同的规格从 R.app 安装它:
> 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'))
再次感谢您的回答!
我通过 conda 在我的 Mac (OS X 10.10.5) 上安装了它。安装很简单。如果您是 conda 的新手,请查看此 http://conda.pydata.org/docs/r-with-conda.html
conda install gdal
gdalinfo --version
# GDAL 2.1.0, released 2016/04/25
R 包安装:
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)
我在 macOS Sierra (10.12) 上遇到了同样的错误 运行 R 3.4.0。所以我使用自制软件安装 gdal,然后 rgdal
按照常规在 R
中安装
在终端
brew update
brew install gdal
在 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)
我想为 "R version 3.2.3 (2015-12-10)"
安装 rgdal
。
我下载并安装了
- GDAL 1.11 完成
- PROJ框架v4.9.2-2
- GEOS 框架 v3.5.0-1
来自 KyngChaos
然后在 RStudio 中我输入 install.packages("rgdal")
这给了我这个:
> ....
>
> configure: CC: clang configure: CXX: clang++ configure: rgdal:
> 1.1-1 checking for /usr/bin/svnversion... yes configure: svn revision:
> 572 checking for gdal-config...
> no no configure: error: gdal-config
> not found or not executable. ERROR: configuration failed for package
> ‘rgdal’
> * removing ‘/Library/Frameworks/R.framework/Versions/3.2/Resources/library/rgdal’
> Warning in install.packages : installation of package ‘rgdal’ had
> non-zero exit status
> sessionInfo()
R version 3.2.3 (2015-12-10)
Platform: x86_64-apple-darwin13.4.0 (64-bit)
Running under: OS X 10.10.5 (Yosemite)
locale:
[1] de_AT.UTF-8/de_AT.UTF-8/de_AT.UTF-8/C/de_AT.UTF-8/de_AT.UTF-8
attached base packages:
[1] stats graphics grDevices utils datasets methods base
loaded via a namespace (and not attached):
[1] tools_3.2.3
我也在终端里试过了
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'
和
sudo R CMD INSTALL –configure-args=’–with-proj-include=/usr/local/lib’ rgdal_1.1-1.tar
运气不好!
终于解决了
这是我的做法! OS X 10.10.5 R 3.2.3 GDAL 1.1
- 从 here 下载并安装 GDAL 完整框架
- 告诉你的 OS X 在你的 shell 中输入
gdal-config
文件的位置echo 'export PATH=/Library/Frameworks/GDAL.framework/Programs:$PATH' >> ~/.bash_profile
然后source ~/.bash_profile
- 通过输入 bash
gdalinfo --version
检查您的 GDAL 是否工作正常。那应该返回类似GDAL 1.11.3, released 2015/09/16
的内容。 - 对于大多数人来说,启动 R 并输入
install.packages("rgdal")
是可行的(如果您已完成第 1-3 步)。但是,对我来说情况并非如此。所以,如果您仍然遇到问题,请继续执行 5。 - 转到 GDAL 网站并下载
.tar
文件。 - 在 shell 中,试试这个:
sudo R CMD INSTALL –configure-args=’–with-proj-include=/usr/local/lib’ rgdal_1.1-1.tar
。那仍然给我一个错误:configure: error: proj_api.h not found in standard or given locations. ERROR: configuration failed for package ‘rgdal’
- 因此,您再次需要告诉在哪里可以找到那个。尝试:
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'
应该可以。尝试启动 R
并在 R 控制台中键入 library(rgdal)
。
注意:rgoes
我遇到了类似的问题。 This 帮助了我。
尝试:
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'
用于指向 config
文件。就在这里/Library/Frameworks/GEOS.framework/unix/bin/geos-config
基于@Stophface 先前回答的快速说明可能对某人有用:
上面的步骤我都做了,但是在Terminal安装rgdal还是报configure: error: proj_api.h not found in standard or given locations
的错误。然而(并不知道确切原因),我设法使用几乎相同的规格从 R.app 安装它:
> 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'))
再次感谢您的回答!
我通过 conda 在我的 Mac (OS X 10.10.5) 上安装了它。安装很简单。如果您是 conda 的新手,请查看此 http://conda.pydata.org/docs/r-with-conda.html
conda install gdal
gdalinfo --version
# GDAL 2.1.0, released 2016/04/25
R 包安装:
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)
我在 macOS Sierra (10.12) 上遇到了同样的错误 运行 R 3.4.0。所以我使用自制软件安装 gdal,然后 rgdal
按照常规在 R
在终端
brew update
brew install gdal
在 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)