【问题标题】:Error while Installing SpatialPosition Package in Azure jupyter notebook在 Azure jupyter notebook 中安装 SpatialPosition 包时出错
【发布时间】:2020-05-08 11:00:34
【问题描述】:

当我尝试使用以下方法在 jupyter notebook 中为 R 安装“SpatialPostion”时:

install.packages("SpatialPosition_2.0.1.tar.gz",repos=NULL,type="source")
options(unzip='internal')
library(SpatialPosition)

也尝试使用 Zip 文件(由于某些安全问题,我无法访问 Cran 站点),我收到此错误:

Error in library(SpatialPosition): there is no package called ‘SpatialPosition’
Traceback:
1. library(SpatialPosition)
2. stop(txt, domain = NA)**

我尝试了这里给出的很多可能的组合,但仍然总是遇到同样的错误。希望我能从你们那里得到合适的解决方案,可以成功运行。谢谢

【问题讨论】:

  • 你试过安装remotes包然后remotes::install_github("Groupe-ElementR/SpatialPosition")吗?
  • 嘿 @mysteRious 它显示:“错误:无法从 GitHub 安装 'SpatialPosition':(从警告转换)安装包 'units' 的退出状态非零”

标签: r azure jupyter


【解决方案1】:

此安装过程(不会尝试获取或解压缩 gz)成功。如果您在新的 R 会话中尝试此操作,但仍然无法正常工作,请尝试使用早期版本的 R(这是在 3.6.3 上)。我可以确认该包可从 github 获得并且没有损坏:

> install.packages("remotes")
> library(remotes)
> remotes::install_github("Groupe-ElementR/SpatialPosition")
Downloading GitHub repo Groupe-ElementR/SpatialPosition@master
These packages have more recent versions available.
It is recommended to update all of them.
Which would you like to update?

1: All                                
2: CRAN packages only                 
3: None                               
4: Rcpp      (1.0.3 -> 1.0.4.6) [CRAN]
5: rlang     (0.4.5 -> 0.4.6  ) [CRAN]
6: withr     (2.1.2 -> 2.2.0  ) [CRAN]
7: pkgbuild  (1.0.6 -> 1.0.8  ) [CRAN]
8: backports (1.1.5 -> 1.1.6  ) [CRAN]
9: ps        (1.3.2 -> 1.3.3  ) [CRAN]

Enter one or more numbers, or an empty line to skip updates:

Installing 4 packages: sf, rgeos, raster, units
Installing packages into ‘C:/Users/User/Documents/R/win-library/3.6’ (as ‘lib’ is unspecified)
trying URL 'https://cran.rstudio.com/bin/windows/contrib/3.6/sf_0.9-3.zip'
Content type 'application/zip' length 42626142 bytes (40.7 MB)
downloaded 40.7 MB

trying URL 'https://cran.rstudio.com/bin/windows/contrib/3.6/rgeos_0.5-3.zip'
Content type 'application/zip' length 2030318 bytes (1.9 MB)
downloaded 1.9 MB

trying URL 'https://cran.rstudio.com/bin/windows/contrib/3.6/raster_3.1-5.zip'
Content type 'application/zip' length 3344411 bytes (3.2 MB)
downloaded 3.2 MB

trying URL 'https://cran.rstudio.com/bin/windows/contrib/3.6/units_0.6-6.zip'
Content type 'application/zip' length 1759033 bytes (1.7 MB)
downloaded 1.7 MB

package ‘sf’ successfully unpacked and MD5 sums checked
package ‘rgeos’ successfully unpacked and MD5 sums checked
package ‘raster’ successfully unpacked and MD5 sums checked
package ‘units’ successfully unpacked and MD5 sums checked

The downloaded binary packages are in
C:\Users\User\AppData\Local\Temp\RtmpaGI1w7\downloaded_packages
√  checking for file 
'C:\Users\User\AppData\Local\Temp\RtmpaGI1w7\remotes8a0416e2c30\Groupe-ElementR-SpatialPosition-e425314/DESCRIPTION' ...
-  preparing 'SpatialPosition':
√  checking DESCRIPTION meta-information ... 
-  checking for LF line-endings in source and make files and shell scripts
-  checking for empty or unneeded directories
-  looking to see if a 'data/datalist' file should be added
-  building 'SpatialPosition_2.0.1.tar.gz'

Installing package into ‘C:/Users/User/Documents/R/win-library/3.6’
(as ‘lib’ is unspecified)
* installing *source* package 'SpatialPosition' ...
** using staged installation
** R
** data
*** moving datasets to lazyload DB
** byte-compile and prepare package for lazy loading
** help
*** installing help indices
  converting help for package 'SpatialPosition'
    finding HTML links ... done
    CreateDistMatrix                        html  
    CreateGrid                              html  
    SpatialPosition                         html  
    hospital                                html  
    huff                                    html  
    isopoly                                 html  
    mcStewart                               html  
    paris                                   html  
    plotHuff                                html  
    plotReilly                              html  
    plotStewart                             html  
    quickStewart                            html  
    rasterHuff                              html  
    rasterReilly                            html  
    finding level-2 HTML links ... done

    rasterStewart                           html  
    rasterToContourPoly                     html  
    reilly                                  html  
    smoothy                                 html  
    spatMask                                html  
    spatPts                                 html  
    spatUnits                               html  
    stewart                                 html  
** building package indices
** installing vignettes
** testing if installed package can be loaded from temporary location
** testing if installed package can be loaded from final location
** testing if installed package keeps a record of temporary installation path
* DONE (SpatialPosition)
> library(SpatialPosition)
> 

这个sessionInfo()安装成功:

> sessionInfo()
R version 3.6.3 (2020-02-29)
Platform: x86_64-w64-mingw32/x64 (64-bit)
Running under: Windows 10 x64 (build 18362)

Matrix products: default

locale:
[1] LC_COLLATE=English_United States.1252  LC_CTYPE=English_United States.1252    LC_MONETARY=English_United States.1252
[4] LC_NUMERIC=C                           LC_TIME=English_United States.1252    

【讨论】:

  • 嗨@mysteRious,我使用的 Azure jupyter notebook 有 3.5.3 版本的 R。当我尝试安装'Remotes'时,它显示:“包'remotes'不可用(对于R版本3.5.3)”并且当我运行'remotes::install_github("Groupe-ElementR/SpatialPosition")..出现错误:'错误:无法从 GitHub 安装'未知包''....所以是 R 版本的问题吗?除了 3.6.3 哪个版本支持它。 ?
  • 这可能会有所帮助:stackoverflow.com/questions/25721884/…
猜你喜欢
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2019-04-08
  • 2022-11-11
  • 1970-01-01
  • 1970-01-01
  • 2018-07-20
  • 1970-01-01
相关资源
最近更新 更多