install.packages(...) 在 Windows 10 上失败

install.packages(...) fails on Windows 10

我正在尝试安装 Visual Studio 2017 的 dplyr 软件包。它依赖于 pillar.

当我从命令行执行安装时,我得到:

> install.packages('pillar')
Installing package into ‘C:/Users/Jérôme Verstrynge/Documents/R/win-library/3.3’
(as ‘lib’ is unspecified)

  There is a binary version available but the source version is later:
       binary source needs_compilation
pillar  1.2.1  1.2.2             FALSE

installing the source package ‘pillar’

trying URL 'http://cran.r-project.org/src/contrib/pillar_1.2.2.tar.gz'
Content type 'application/x-gzip' length 64185 bytes (62 KB)
downloaded 62 KB

* installing *source* package 'pillar' ...
** package 'pillar' successfully unpacked and MD5 sums checked
Warning in file(file, if (append) "a" else "w") :
  cannot open file 'C:/Users/Jirtme Verstrynge/Documents/R/win-library/3.3/pillar/DESCRIPTION': No such file or directory
Error in file(file, if (append) "a" else "w") : 
  cannot open the connection
ERROR: installing package DESCRIPTION failed for package 'pillar'
* removing 'C:/Users/Jérôme Verstrynge/Documents/R/win-library/3.3/pillar'

Jérôme Verstrynge 被伪造为 Jirtme Verstrynge

我该如何解决这个问题?

更多信息

当我从 Windows 10 PowerShell 执行 Get-WinSystemLocale 时,我得到:

LCID             Name             DisplayName
----             ----             -----------
2057             en-GB            English (United Kingdom)

Sys.getlocale() returns:

[1] "LC_COLLATE=English_United Kingdom.1252;
     LC_CTYPE=English_United Kingdom.1252;
     LC_MONETARY=English_United Kingdom.1252;
     LC_NUMERIC=C;
     LC_TIME=English_United Kingdom.1252"

解决方法

我卸载了 Microsoft R 客户端并从 here 重新安装了它。客户端现在的版本是 3.4.3.0.

package pillar 的问题已经消失,但在尝试 install.packages('seriation') 时又出现了一个名为 dendextend 的包。

错误是:

> install.packages('seriation') 
Installing package into ‘C:/Users/Jérôme Verstrynge/Documents/R/win-library/3.4’
(as ‘lib’ is unspecified)
also installing the dependency ‘dendextend’


  There is a binary version available but the source version is later:
           binary source needs_compilation
dendextend  1.7.0  1.8.0             FALSE

trying URL 'http://cran.r-project.org/bin/windows/contrib/3.4/seriation_1.2-3.zip'
Content type 'application/zip' length 1015954 bytes (992 KB)
downloaded 992 KB

package ‘seriation’ successfully unpacked and MD5 sums checked

The downloaded binary packages are in
    C:\Temp\Rtmpi2lOd8\downloaded_packages
installing the source package ‘dendextend’

trying URL 'http://cran.r-project.org/src/contrib/dendextend_1.8.0.tar.gz'
Content type 'application/x-gzip' length 1758392 bytes (1.7 MB)
downloaded 1.7 MB

* installing *source* package 'dendextend' ...
** package 'dendextend' successfully unpacked and MD5 sums checked
Warning in file(file, if (append) "a" else "w") :
  cannot open file 'C:/Users/Jirtme Verstrynge/Documents/R/win-library/3.4/dendextend/DESCRIPTION': No such file or directory
Error in file(file, if (append) "a" else "w") : 
  cannot open the connection
ERROR: installing package DESCRIPTION failed for package 'dendextend'
* removing 'C:/Users/Jérôme Verstrynge/Documents/R/win-library/3.4/dendextend'
In R CMD INSTALL

The downloaded source packages are in
    ‘C:\Temp\Rtmpi2lOd8\downloaded_packages’
Warning messages:
1: running command '"C:/PROGRA~1/MIE74D~1/RCLIEN~1/R_SERVER/bin/x64/R" CMD INSTALL -l "C:\Users\Jérôme Verstrynge\Documents\R\win-library.4" C:\Temp\Rtmpi2lOd8/downloaded_packages/dendextend_1.8.0.tar.gz' had status 1 
2: In utils::install.packages(...) :
  installation of package ‘dendextend’ had non-zero exit status
> 

utils::install.packages(...)

似乎有问题

问题已解决

显然,除了重新安装 Microsoft R 客户端之外,剩下的问题与缺少 CRAN 存储库中尚不可用的二进制包有关。

我怀疑这与 pillar 包有任何关系,但也许是因为这个包是从源代码安装的(不同于从二进制安装的默认设置) .这个问题最终会自行解决,因为 pillar 1.2.2 的二进制版本在您的 CRAN 镜像上可用(它已经在 CRAN 和 https://cloud.r-project.org/web/packages/pillar/index.html 上)。

getOption("repos") 在您的系统上的值是多少?

在这种特定情况下,非 ASCII 字符的错误编码感觉像是一个问题,最好通过为您的家选择仅 ASCII 和 space 自由目录名称(例如 C:\Users\jverstry 而不是您当前的设置)。要排除 Visual Studio 的问题,您可以尝试从 RGui 或 R 终端安装包,请仔细检查包的安装路径是否相同。