提问人:fishlakeslimno 提问时间:11/16/2023 更新时间:11/16/2023 访问量:11
尝试在 R 中安装旧版本的 sf() 时出错
Errors when trying to install an old version of sf() in R
问:
我最近买了一台新的工作笔记本电脑,并且正在重新配置 R 以适应我经常使用的包(用于遥测数据的 glatos 包)。
我已经下载并安装了 rgdal 和 rgeos 的存档版本(都是“最新”的 - 因为它们在上个月存档),并且我重新下载/安装了 RTools。
我错误地说“glatos”需要“gdalUtilities”。所以我尝试下载/安装它,但收到错误,说我需要“sf”的更新版本。(第一组错误)
我从 CRAN (1.0-11) 下载了“sf”的存档版本并尝试安装它。但随后收到以下错误(第二组错误)。我真的不确定如何处理这里的 sf() 错误以及如何让它成功安装。有人可以帮忙或给我建议吗?
install.packages("gdalUtilities")
also installing the dependencies ‘wk’, ‘s2’, ‘sf’
There are binary versions available but the source versions are later:
binary source needs_compilation
wk 0.4.1 0.9.0 TRUE
s2 1.0.4 1.1.4 TRUE
sf 0.9-8 1.0-14 TRUE
gdalUtilities 1.1.2 1.2.5 FALSE
trying URL 'https://cran.rstudio.com/bin/windows/contrib/3.6/wk_0.4.1.zip'
Content type 'application/zip' length 869220 bytes (848 KB)
downloaded 848 KB
trying URL 'https://cran.rstudio.com/bin/windows/contrib/3.6/s2_1.0.4.zip'
Content type 'application/zip' length 5943430 bytes (5.7 MB)
downloaded 5.7 MB
trying URL 'https://cran.rstudio.com/bin/windows/contrib/3.6/sf_0.9-8.zip'
Content type 'application/zip' length 41978728 bytes (40.0 MB)
downloaded 40.0 MB
package ‘wk’ successfully unpacked and MD5 sums checked
package ‘s2’ successfully unpacked and MD5 sums checked
package ‘sf’ successfully unpacked and MD5 sums checked
The downloaded binary packages are in
C:\Users\WORK\AppData\Local\Temp\RtmpsxydIn\downloaded_packages
installing the source package ‘gdalUtilities’
trying URL 'https://cran.rstudio.com/src/contrib/gdalUtilities_1.2.5.tar.gz'
Content type 'application/x-gzip' length 1542252 bytes (1.5 MB)
downloaded 1.5 MB
* installing *source* package 'gdalUtilities' ...
** package 'gdalUtilities' successfully unpacked and MD5 sums checked
** using staged installation
** R
** inst
** byte-compile and prepare package for lazy loading
Error in loadNamespace(j <- i[[1L]], c(lib.loc, .libPaths()), versionCheck = vI[[j]]) :
namespace 'sf' 0.9-8 is being loaded, but >= 1.0.11 is required
Calls: <Anonymous> ... namespaceImportFrom -> asNamespace -> loadNamespace
Execution halted
ERROR: lazy loading failed for package 'gdalUtilities'
* removing 'C:/Program Files/R/R-3.6.1/library/gdalUtilities'
Warning in install.packages :
installation of package ‘gdalUtilities’ had non-zero exit status
The downloaded source packages are in
‘C:\Users\WORK\AppData\Local\Temp\RtmpsxydIn\downloaded_packages’```
```install.packages("C:\\Users\\WORK\\Downloads\\sf_1.0-11.tar.gz", repos = NULL, type = "source")
* installing *source* package 'sf' ...
** package 'sf' successfully unpacked and MD5 sums checked
** using staged installation
**********************************************
WARNING: this package has a configure script
It probably needs manual configuration
**********************************************
** libs
*** arch - i386
rm -f sf.dll RcppExports.o bbox.o gdal.o gdal_geom.o gdal_read.o gdal_utils.o gdal_write.o geos.o hex.o mdim.o ops.o polygonize.o proj.o proj_info.o raster2sf.o sfc-sfg.o signed_area.o stars.o wkb.o zm_range.o
mkdir -p ../inst
"C:/PROGRA~1/R/R-36~1.1/bin/i386/Rscript.exe" --vanilla "../tools/winlibs.R" 3.4.1
cp -r "../windows/gdal3-3.4.1/share/gdal" ../inst/
cp -r "../windows/gdal3-3.4.1/share/proj" ../inst/
C:/Rtools/mingw_32/bin/g++ -I"C:/PROGRA~1/R/R-36~1.1/include" -DNDEBUG -I../windows/gdal3-3.4.1/include -DHAVE_PROJ_H -I"C:/Program Files/R/R-3.6.1/library/Rcpp/include" -O2 -Wall -mtune=generic -c RcppExports.cpp -o RcppExports.o
C:/Rtools/mingw_32/bin/g++ -I"C:/PROGRA~1/R/R-36~1.1/include" -DNDEBUG -I../windows/gdal3-3.4.1/include -DHAVE_PROJ_H -I"C:/Program Files/R/R-3.6.1/library/Rcpp/include" -O2 -Wall -mtune=generic -c bbox.cpp -o bbox.o
bbox.cpp:13:3: warning: identifier 'decltype' is a keyword in C++11 [-Wc++0x-compat]
for (decltype(n) i = 0; i < n; i++) {
^
bbox.cpp: In function 'Rcpp::NumericVector CPL_get_bbox(Rcpp::List, int)':
bbox.cpp:9:2: warning: 'auto' changes meaning in C++11; please remove it [-Wc++0x-compat]
auto n = sf.size();
^
bbox.cpp:9:7: error: 'n' does not name a type
auto n = sf.size();
^
bbox.cpp:13:17: error: 'n' was not declared in this scope
for (decltype(n) i = 0; i < n; i++) {
^
bbox.cpp:13:18: error: 'decltype' was not declared in this scope
for (decltype(n) i = 0; i < n; i++) {
^
bbox.cpp:13:27: error: 'i' was not declared in this scope
for (decltype(n) i = 0; i < n; i++) {
^
bbox.cpp:29:28: error: 'i' was not declared in this scope
for (decltype(n) i = 0; i < n; i++) {
^
bbox.cpp:31:5: warning: 'auto' changes meaning in C++11; please remove it [-Wc++0x-compat]
auto rows = m.nrow();
^
bbox.cpp:31:10: error: 'rows' does not name a type
auto rows = m.nrow();
^
bbox.cpp:33:9: error: 'rows' was not declared in this scope
if (rows > 0) { // non-empty:
^
bbox.cpp:39:33: error: 'j' was not declared in this scope
for (decltype(rows) j = 0; j < rows; j++) {
^
bbox.cpp:51:27: error: 'i' was not declared in this scope
for (decltype(n) i = 0; i < n; i++) {
^
make: *** [C:/PROGRA~1/R/R-36~1.1/etc/i386/Makeconf:215: bbox.o] Error 1
ERROR: compilation failed for package 'sf'
* removing 'C:/Program Files/R/R-3.6.1/library/sf'
* restoring previous 'C:/Program Files/R/R-3.6.1/library/sf'
Warning in install.packages :
installation of package ‘C:/Users/WORK/Downloads/sf_1.0-11.tar.gz’ had non-zero exit status```
答: 暂无答案
评论