r - 无法在 jupyter 中为 r 内核安装 tidyverse 包
问题描述
我最近安装了Anaconda并启用了 r 内核,conda install -c r r-irkernel
我参考了以下内容:https ://kyleake.medium.com/how-to-install-r-in-jupyter-with-irkernel-in-3-steps- 917519326e41。
现在,jupyter notebook
当我尝试安装 tidyverse
软件包时,我收到以下错误jsonlite
:
Warning message:
"package 'tidyverse' was built under R version 3.6.3"
Error: package or namespace load failed for 'tidyverse' in loadNamespace(j <- i[[1L]], c(lib.loc, .libPaths()), versionCheck = vI[[j]]):
namespace 'jsonlite' 1.6 is already loaded, but >= 1.7.2 is required
Traceback:
1. library("tidyverse")
2. tryCatch({
. attr(package, "LibPath") <- which.lib.loc
. ns <- loadNamespace(package, lib.loc)
. env <- attachNamespace(ns, pos = pos, deps, exclude, include.only)
. }, error = function(e) {
. P <- if (!is.null(cc <- conditionCall(e)))
. paste(" in", deparse(cc)[1L])
. else ""
. msg <- gettextf("package or namespace load failed for %s%s:\n %s",
. sQuote(package), P, conditionMessage(e))
. if (logical.return)
. message(paste("Error:", msg), domain = NA)
. else stop(msg, call. = FALSE, domain = NA)
. })
3. tryCatchList(expr, classes, parentenv, handlers)
4. tryCatchOne(expr, names, parentenv, handlers[[1L]])
5. value[[3L]](cond)
6. stop(msg, call. = FALSE, domain = NA)
似乎jsonlite' 1.6 is already loaded, but >= 1.7.2 is required
是问题所在,所以当我尝试手动安装时jsonlite
,我遇到了这个问题:
install.packages("jsonlite")
package 'jsonlite' successfully unpacked and MD5 sums checked
Warning message:
"cannot remove prior installation of package 'jsonlite'"Warning message in file.copy(savedcopy, lib, recursive = TRUE):
"problem copying C:\ProgramData\Anaconda3\Lib\R\library\00LOCK\jsonlite\libs\x64\jsonlite.dll to C:\ProgramData\Anaconda3\Lib\R\library\jsonlite\libs\x64\jsonlite.dll: Permission denied"Warning message:
"restored 'jsonlite'"
The downloaded binary packages are in
C:\Users\viny\AppData\Local\Temp\RtmpADyCWE\downloaded_packages
那么我该如何安装tidyverse package
呢jupyter notebook
?
解决方案
不要混合conda install
和install.packages
。仅install.packages
在包不在 conda 上时使用。tidyverse 在 conda 上(请参阅 anaconda.org/r/r-tidyverse),所以你应该时不时remove.packages("tidyverse")
地conda install -c r r-tidyverse
.
您可能也有兴趣了解提供更多 R 包的 conda-forge 频道。
如果您也在使用 Python,这也适用于混合使用 pip install 和 conda install - 这样做会以难以想象的方式破坏您的安装(请参阅在同一环境中使用 conda 和 pip install 是一个坏主意吗?)。这在很大程度上可以归因于 conda 使用其自己的机制来处理库/包路径,而这些路径与其他分发系统的交互并不好。
推荐阅读
- git - 使用 git filter-branch 修改标签消息
- haskell - -> 和 => 符号之间的区别。他们的意思是什么?
- rust - 即使我为结构派生了 parity_codec 的编码,也无法使用它
- javascript - 从对象数组中,仅提取属性的特定值作为数组
- javascript - 我在 TypeScript 承诺上调用了 then(),但它仍在等待中。为什么是这样?我怎样才能解决它?
- python - 使用已保存但无法访问和添加到数据框的链接时出现问题
- android - 如何处理 backPress viewpager 片段
- node.js - 如何在测试期间模拟/拦截对 mongoDB atlas 的调用?(云数据库)
- operating-system - 虚拟地址空间所在的位置
- python - Tensorflow - 设置 EvalSpec