安装包“sf”时出现问题R(大苏尔)
我尝试安装 sf 包,因为它是我想要使用的包 tidycensus 的依赖项。 我正在使用配备 Big Sur 的 Mac。根据 r-spatial 的 Github,我尝试按照安装说明此处< /a> 但没有骰子。我的 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/
gdal
、proj
和 geos
都位于 /opt/homebrew/opt/
I tried to install the sf
package because it is a dependency for tidycensus
, which is the package I'd like to use.
I am using a Mac with Big Sur. Per the Github for r-spatial, I tried following the installation instructions here but no dice. My 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
I tried
library(devtools)
install_github("r-spatial/sf",configure.args="--with-proj-lib=/opt/homebrew/opt/proj/lib")
The error:
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’
Now, something that may be screwing me up (but which I don't know how to fix) is that gdal-config is both in /opt/homebrew/Caskroom/miniforge/base/bin/
and also in /opt/homebrew/opt/gdal/bin/
gdal
, proj
, and geos
all live in /opt/homebrew/opt/
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
感谢@IRTFM,解决方案是从 CRAN 下载二进制文件,然后使用 R CMD INSTALL。然后我可以通过
install.packages()
安装tigris
和tidycensus
The solution, thanks to @IRTFM, was to download the binary from CRAN, then use
R CMD INSTALL
. Then I could installtigris
andtidycensus
viainstall.packages()