I have recently installed Anaconda and also enabled r kernel by using conda install -c r r-irkernel
which i took reference from: https://kyleake.medium.com/how-to-install-r-in-jupyter-with-irkernel-in-3-steps-917519326e41 .
Now from jupyter notebook
when I try to install tidyverse
package I get this error regarding 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)
seems like jsonlite' 1.6 is already loaded, but >= 1.7.2 is required
is the problem, so when I try to manually install jsonlite
then I get this issue:
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
so how can i install tidyverse package
in jupyter notebook
?
Do not mix conda install
and install.packages
. Only use install.packages
if the package is not on conda. tidyverse is on conda (see anaconda.org/r/r-tidyverse), so you should now remove.packages("tidyverse")
and then conda install -c r r-tidyverse
.
You may be also interested in learning about conda-forge channel which provides much more R packages.
If you are also using Python, this also apply to mixing pip install and conda install - doing so will break your installations in the ways that are difficult to imagine (see Is that a bad idea to use conda and pip install on the same environment?). Largely this can be attributed to conda using its own mechanisms for handling library/package paths which and not interacting great with other distribution systems.