无法在 jupyter 中为 r 内核安装 tidyverse 包
Unable to install tidyverse package for r kernel in jupyter
我最近安装了 Anaconda 并且 启用了 r kernel 通过使用 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[=11=]LOCK\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
那么如何在 jupyter notebook
中安装 tidyverse package
?
不要混用 conda install
和 install.packages
。如果包不在 conda 上,则仅使用 install.packages
。 tidyverse 在 conda 上(参见 anaconda.org/r/r-tidyverse),所以你现在应该 remove.packages("tidyverse")
然后 conda install -c r r-tidyverse
.
您可能也有兴趣了解提供更多 R 包的 conda-forge 频道。
如果您还使用 Python,这也适用于混合 pip 安装和 conda 安装 - 这样做会以难以想象的方式破坏您的安装(参见 )。这在很大程度上可以归因于 conda 使用自己的机制来处理 library/package 路径,而这些路径与其他分发系统没有很好的交互。
我最近安装了 Anaconda 并且 启用了 r kernel 通过使用 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[=11=]LOCK\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
那么如何在 jupyter notebook
中安装 tidyverse package
?
不要混用 conda install
和 install.packages
。如果包不在 conda 上,则仅使用 install.packages
。 tidyverse 在 conda 上(参见 anaconda.org/r/r-tidyverse),所以你现在应该 remove.packages("tidyverse")
然后 conda install -c r r-tidyverse
.
您可能也有兴趣了解提供更多 R 包的 conda-forge 频道。
如果您还使用 Python,这也适用于混合 pip 安装和 conda 安装 - 这样做会以难以想象的方式破坏您的安装(参见