无法从GitHub安装特定的R包。

huangapple go评论76阅读模式
英文:

Unable to install certain R packages from GitHub

问题

我试图从GitHub安装一个包:https://github.com/NIB-SI/seekr

然而,运行

devtools::install_github("ablejec/seekr")

导致以下错误

从GitHub下载存储库 NIB-SI/pisar@HEAD 时出错:无法安装 'pisar' 来自GitHub:输入字符串 34 无效,另外:警告消息:在gsub("[^/]", "", file_list)中:无法将 'NIB-SI-pisar-33d70bb/devel/_Welcome -<c0> R packages.URL' 翻译成宽字符串

具有相同设置(在Windows上运行的RStudio)的其他人可以安装此包,但我有一种隐隐的感觉,错误与UTF-8有关。我可以通过下载的包加载该包,如下所示:

library("seekr", lib.loc = "C:/localfolder/seekr")

我已经在GitHub存储库中提交了此问题,但我有一种感觉,这是一个如此特定的错误,可能不会在不久的将来修复。

供参考,我的SessionInfo输出是:

R版本 4.3.0 (2023-04-21 ucrt) 平台:x86_64-w64-mingw32/x64(64位) 运行在:Windows 10 x64 (build 19044)

矩阵产品:默认

locale: [1] C

时区:Europe/Paris tzcode source: internal

附加的基本包: [1] stats     graphics  grDevices utils     datasets  methods   base

其他附加的包: [1] seekr_0.1.0.9000 lubridate_1.9.2 forcats_1.0.0 stringr_1.5.0 dplyr_1.1.2 purrr_1.0.1 readr_2.1.4 tidyr_1.3.0 [9] tibble_3.2.1 ggplot2_3.4.2 tidyverse_2.0.0 jsonlite_1.8.5

通过一个命名空间加载(而不是附加): [1] generics_0.1.3 utf8_1.2.3 stringi_1.7.12 hms_1.1.3 digest_0.6.31 magrittr_2.0.3 timechange_0.2.0 [8] grid_4.3.0 pkgload_1.3.2 fastmap_1.1.1 processx_3.8.1 pkgbuild_1.4.2 sessioninfo_1.2.2 urlchecker_1.0.1 [15] ps_1.7.5 promises_1.2.0.1 fansi_1.0.4 scales_1.2.1 cli_3.6.1 shiny_1.7.4 rlang_1.1.1 [22] crayon_1.5.2 ellipsis_0.3.2 munsell_0.5.0 withr_2.5.0 remotes_2.4.2 cachem_1.0.8 devtools_2.4.5 [29] tools_4.3.0 tzdb_0.4.0 memoise_2.0.1 colorspace_2.1-0 httpuv_1.6.11 curl_5.0.1 vctrs_0.6.2 [36] R6_2.5.1 mime_0.12 lifecycle_1.0.3 fs_1.6.2 htmlwidgets_1.6.2 usethis_2.2.0 miniUI_0.1.1.1 [43] pkgconfig_2.0.3 callr_3.7.3 pillar_1.9.0 later_1.3.1 gtable_0.3.3 glue_1.6.2 profvis_0.3.8 [50] Rcpp_1.0.10 tidyselect_1.2.0 rstudioapi_0.14 xtable_1.8-4 htmltools_0.5.5 compiler_4.3.0 prettyunits_1.1.1
英文:

I am trying to install a package from GitHub: https://github.com/NIB-SI/seekr

However, running

devtools::install_github(&quot;ablejec/seekr&quot;)

yields the following error

>
&gt; Downloading GitHub repo NIB-SI/pisar@HEAD Error: Failed to install
&gt; &#39;pisar&#39; from GitHub: input string 34 is invalid In addition: Warning
&gt; message: In gsub(&quot;[^/]&quot;, &quot;&quot;, file_list) : unable to translate
&gt; &#39;NIB-SI-pisar-33d70bb/devel/_Welcome -&lt;c0&gt; R packages.URL&#39; to a wide
&gt; string
&gt;

Other people with the same setup (RStudio running on windows) are able to install this package, but I have a sneaking suspicion the error is UTF-8 related. I am able to load the package via the downloaded package as such:

library(&quot;seekr&quot;, lib.loc = &quot;C:/localfolder/seekr&quot;)

I have filed this issue in the GitHub repo, but I have a feeling this is such a specific error that it might not be fixable in the near future.

For reference, my SessionInfo output is:

>
&gt; R version 4.3.0 (2023-04-21 ucrt) Platform: x86_64-w64-mingw32/x64
&gt; (64-bit) Running under: Windows 10 x64 (build 19044)
&gt;
&gt; Matrix products: default
&gt;
&gt;
&gt; locale: [1] C
&gt;
&gt; time zone: Europe/Paris tzcode source: internal
&gt;
&gt; attached base packages: [1] stats graphics grDevices utils
&gt; datasets methods base
&gt;
&gt; other attached packages: [1] seekr_0.1.0.9000 lubridate_1.9.2
&gt; forcats_1.0.0 stringr_1.5.0 dplyr_1.1.2 purrr_1.0.1
&gt; readr_2.1.4 tidyr_1.3.0 [9] tibble_3.2.1 ggplot2_3.4.2
&gt; tidyverse_2.0.0 jsonlite_1.8.5
&gt;
&gt; loaded via a namespace (and not attached): [1] generics_0.1.3
&gt; utf8_1.2.3 stringi_1.7.12 hms_1.1.3 digest_0.6.31
&gt; magrittr_2.0.3 timechange_0.2.0 [8] grid_4.3.0
&gt; pkgload_1.3.2 fastmap_1.1.1 processx_3.8.1 pkgbuild_1.4.2
&gt; sessioninfo_1.2.2 urlchecker_1.0.1 [15] ps_1.7.5
&gt; promises_1.2.0.1 fansi_1.0.4 scales_1.2.1 cli_3.6.1
&gt; shiny_1.7.4 rlang_1.1.1 [22] crayon_1.5.2
&gt; ellipsis_0.3.2 munsell_0.5.0 withr_2.5.0 remotes_2.4.2
&gt; cachem_1.0.8 devtools_2.4.5 [29] tools_4.3.0 tzdb_0.4.0
&gt; memoise_2.0.1 colorspace_2.1-0 httpuv_1.6.11 curl_5.0.1
&gt; vctrs_0.6.2 [36] R6_2.5.1 mime_0.12
&gt; lifecycle_1.0.3 fs_1.6.2 htmlwidgets_1.6.2 usethis_2.2.0
&gt; miniUI_0.1.1.1 [43] pkgconfig_2.0.3 callr_3.7.3
&gt; pillar_1.9.0 later_1.3.1 gtable_0.3.3 glue_1.6.2
&gt; profvis_0.3.8 [50] Rcpp_1.0.10 tidyselect_1.2.0
&gt; rstudioapi_0.14 xtable_1.8-4 htmltools_0.5.5 compiler_4.3.0
&gt; prettyunits_1.1.1
&gt;

答案1

得分: 4

有一些非UTF8字符在存储库中:我分叉了存储库并删除了它们。如果您从jpmam1/pisar安装pisar,而不是NIB-SI/pisar,即。

然后,重新安装seekr:

devtools::install_github("ablejec/seekr")

它应该可以顺利安装(如果它解决了您的问题,我将向NIB-SI/pisar存储库发起拉取请求)。

英文:

There are some non-UTF8 characters in the repo: I forked the repo and removed them. If you install pisar from jpmam1/pisar, instead of NIB-SI/pisar, i.e.

devtools::install_github(&quot;jpmam1/pisar&quot;)

Then, reinstall seekr with:

devtools::install_github(&quot;ablejec/seekr&quot;)

It should install without issue (I'll make a pull request to the NIB-SI/pisar repo if it solves your problem).

答案2

得分: 1

The English_United States.1252 locale uses Windows-1252 encoding, which is a character encoding of the Latin alphabet. That character encoding is a super set of ISO 8859-1, and it was the default in many Windows applications, so it is designed to be compatible with many older software packages.

当您将区域设置切换为English_United States.1252时,您正在更改R处理和解释字符字符串的方式。某些包可能已考虑了此编码,或者它们可能包含非UTF-8字符,当R尝试将它们解释为UTF-8时会引发问题。
这种切换到此区域有助于解决您的问题的事实表明seekr包(或可能是其某个依赖项之一)包含此类非UTF-8字符。
例如,我看到Bioconductor/BiocManagerseekr的一个依赖项通常与LC_COLLATE=English_United States.1252一起使用,如issue 103所示。

英文:

> Any idea to why the original encoding did not work?

The English_United States.1252 locale uses Windows-1252 encoding, which is a character encoding of the Latin alphabet. That character encoding is a super set of ISO 8859-1, and it was the default in many Windows applications, so it is designed to be compatible with many older software packages.

When you switch your locale to English_United States.1252, you are changing the way that R handles and interprets character strings. Some packages may have been designed with this encoding in mind, or they may include non-UTF-8 characters that cause problems when R tries to interpret them as UTF-8.
See "How to change the locale of R?"

The fact that switching to this locale helped resolve your issue suggests that the seekr package (or possibly one of its dependencies) includes such non-UTF-8 characters.

For instance, I see Bioconductor/BiocManager, a dependency of seekr is usually used with LC_COLLATE=English_United States.1252, as illustrated in issue 103.

huangapple
  • 本文由 发表于 2023年7月6日 15:43:43
  • 转载请务必保留本文链接:https://go.coder-hub.com/76626572.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定