繁体   English   中英

无法在 R(大苏尔)中安装 package“sf”

[英]Trouble installing package "sf" in R (Big Sur)

我尝试安装sf package 因为它是tidycensus的依赖项,这是我想使用的 package。 我正在使用带有 Big Sur 的 Mac。 根据 r-spatial 的 Github,我尝试按照此处的安装说明进行操作,但没有成功。 我的sessionInfo()

R version 4.1.0 (2021-05-18)
Platform: aarch64-apple-darwin20.4.0 (64-bit)
Running under: macOS Big Sur 11.6

Matrix products: default
BLAS:   /opt/homebrew/Cellar/openblas/0.3.20/lib/libopenblasp-r0.3.20.dylib
LAPACK: /opt/homebrew/Cellar/r/4.1.0/lib/R/lib/libRlapack.dylib

locale:
[1] en_US.UTF-8/en_US.UTF-8/en_US.UTF-8/C/en_US.UTF-8/en_US.UTF-8

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

loaded via a namespace (and not attached):
[1] compiler_4.1.0

我试过了

library(devtools)
install_github("r-spatial/sf",configure.args="--with-proj-lib=/opt/homebrew/opt/proj/lib")

错误:

Installing package into ‘/opt/homebrew/lib/R/4.1/site-library’
(as ‘lib’ is unspecified)
* installing *source* package ‘sf’ ...
** using staged installation
configure: CC: /opt/homebrew/opt/llvm/bin/clang
configure: CXX: /opt/homebrew/opt/llvm/bin/clang++ -std=gnu++11
checking for gdal-config... /opt/homebrew/Caskroom/miniforge/base/bin/gdal-config
checking gdal-config usability... yes
configure: GDAL: 3.4.1
checking GDAL version >= 2.0.1... yes
checking for gcc... /opt/homebrew/opt/llvm/bin/clang
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 /opt/homebrew/opt/llvm/bin/clang accepts -g... yes
checking for /opt/homebrew/opt/llvm/bin/clang option to accept ISO C89... none needed
checking how to run the C preprocessor... /opt/homebrew/opt/llvm/bin/clang -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... rm: conftest.dSYM: is a directory
rm: conftest.dSYM: is a directory
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: /opt/homebrew/Caskroom/miniforge/base/share/gdal/pcs.csv readable... no
checking GDAL: checking whether PROJ is available for linking:... yes
checking GDAL: checking whether PROJ is available fur running:... dyld: Library not loaded: @rpath/libgdal.30.dylib
  Referenced from: /private/var/folders/4b/2jtbyjzd1w5gsdm_g_jcpr2h0000gn/T/Rtmp2cQwgC/R.INSTALL5d284632664c/sf/./gdal_proj
  Reason: image not found
./configure: line 3625: 24751 Abort trap: 6           ./gdal_proj
no
configure: error: OGRCoordinateTransformation() does not return a coord.trans: PROJ not available?
ERROR: configuration failed for package ‘sf’
* removing ‘/opt/homebrew/lib/R/4.1/site-library/sf’

现在,可能让我搞砸的事情(但我不知道如何解决)是 gdal-config 既在/opt/homebrew/Caskroom/miniforge/base/bin/也在/opt/homebrew/opt/gdal/bin/ gdalprojgeos都位于/opt/homebrew/opt/

感谢@IRTFM,解决方案是从 CRAN 下载二进制文件,然后使用R CMD INSTALL 然后我可以通过install.packages()安装tigristidycensus

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM