0

I had a stablize version of ananconda distribution installed on my Macbook (OS 10.15) for years.

I mainly program in Python 3 so everything was working smoothly.

However, today I followed the instructions on anacondo's website to install R (see here)

Once I completed the instructions on anacondo's website to install R I attempted to Open the environment with the R package using the Open with Jupyter Notebook option. as instructed in the link above.

When I do that I get the following error:

Last login: Sun Nov  3 11:27:16 on ttys001

The default interactive shell is now zsh.
To update your account to use zsh, please run `chsh -s /bin/zsh`.
For more details, please visit https://support.apple.com/kb/HT208050.
/Users/mycomputer/.anaconda/navigator/a.tool ; exit;
(base) mycomputers-MacBook-Air:~ mycomputer$ /Users/mycomputer/.anaconda/navigator/a.tool ; exit;
[W 11:29:35.377 NotebookApp] Error loading server extension jupyterlab
    Traceback (most recent call last):
      File "/Users/mycomputer/anaconda/envs/R_environment/lib/python3.6/site-packages/notebook/notebookapp.py", line 1271, in init_server_extensions
        mod = importlib.import_module(modulename)
      File "/Users/mycomputer/anaconda/envs/R_environment/lib/python3.6/importlib/__init__.py", line 126, in import_module
        return _bootstrap._gcd_import(name[level:], package, level)
      File "<frozen importlib._bootstrap>", line 978, in _gcd_import
      File "<frozen importlib._bootstrap>", line 961, in _find_and_load
      File "<frozen importlib._bootstrap>", line 948, in _find_and_load_unlocked
    ModuleNotFoundError: No module named 'jupyterlab'
[I 11:29:35.390 NotebookApp] Serving notebooks from local directory: /Users/mycomputer
[I 11:29:35.390 NotebookApp] 0 active kernels 
[I 11:29:35.390 NotebookApp] The Jupyter Notebook is running at: http://localhost:8888/?token=b0bbdfcb5934081d376514f0d5f68ff0eab87b935d557dce

The notebook server seems to launch.

So I click new to create a new notebook and select R as the language. It opens and in the first cell I type in library(ggplot2) and I try to execute the cell. I immediately get a kernal has died error.

The console tracebook is as follows:

*** caught segfault ***
address 0x10, cause 'memory not mapped'

Traceback:
 1: dyn.load(file, DLLpath = DLLpath, ...)
 2: library.dynam(lib, package, package.lib)
 3: loadNamespace(j <- i[[1L]], c(lib.loc, .libPaths()), versionCheck = vI[[j]])
 4: asNamespace(ns)
 5: namespaceImportFrom(ns, loadNamespace(j <- i[[1L]], c(lib.loc,     .libPaths()), versionCheck = vI[[j]]), i[[2L]], from = package)
 6: loadNamespace(i, c(lib.loc, .libPaths()), versionCheck = vI[[i]])
 7: namespaceImport(ns, loadNamespace(i, c(lib.loc, .libPaths()),     versionCheck = vI[[i]]), from = package)
 8: loadNamespace(package, lib.loc)
 9: doTryCatch(return(expr), name, parentenv, handler)
10: tryCatchOne(expr, names, parentenv, handlers[[1L]])
11: tryCatchList(expr, classes, parentenv, handlers)
12: tryCatch({    attr(package, "LibPath") <- which.lib.loc    ns <- loadNamespace(package, lib.loc)    env <- attachNamespace(ns, pos = pos, deps)}, 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)})
13: library(ggplot2)
14: eval(expr, envir, enclos)
15: eval(expr, envir, enclos)
16: withVisible(eval(expr, envir, enclos))
17: withCallingHandlers(withVisible(eval(expr, envir, enclos)), warning = wHandler,     error = eHandler, message = mHandler)
18: doTryCatch(return(expr), name, parentenv, handler)
19: tryCatchOne(expr, names, parentenv, handlers[[1L]])
20: tryCatchList(expr, classes, parentenv, handlers)
21: tryCatch(expr, error = function(e) {    call <- conditionCall(e)    if (!is.null(call)) {        if (identical(call[[1L]], quote(doTryCatch)))             call <- sys.call(-4L)        dcall <- deparse(call)[1L]        prefix <- paste("Error in", dcall, ": ")        LONG <- 75L        msg <- conditionMessage(e)        sm <- strsplit(msg, "\n")[[1L]]        w <- 14L + nchar(dcall, type = "w") + nchar(sm[1L], type = "w")        if (is.na(w))             w <- 14L + nchar(dcall, type = "b") + nchar(sm[1L],                 type = "b")        if (w > LONG)             prefix <- paste0(prefix, "\n  ")    }    else prefix <- "Error : "    msg <- paste0(prefix, conditionMessage(e), "\n")    .Internal(seterrmessage(msg[1L]))    if (!silent && identical(getOption("show.error.messages"),         TRUE)) {        cat(msg, file = outFile)        .Internal(printDeferredWarnings())    }    invisible(structure(msg, class = "try-error", condition = e))})
22: try(f, silent = TRUE)
23: handle(ev <- withCallingHandlers(withVisible(eval(expr, envir,     enclos)), warning = wHandler, error = eHandler, message = mHandler))
24: timing_fn(handle(ev <- withCallingHandlers(withVisible(eval(expr,     envir, enclos)), warning = wHandler, error = eHandler, message = mHandler)))
25: evaluate_call(expr, parsed$src[[i]], envir = envir, enclos = enclos,     debug = debug, last = i == length(out), use_try = stop_on_error !=         2L, keep_warning = keep_warning, keep_message = keep_message,     output_handler = output_handler, include_timing = include_timing)
26: evaluate(request$content$code, envir = .GlobalEnv, output_handler = oh,     stop_on_error = 1L)
27: doTryCatch(return(expr), name, parentenv, handler)
28: tryCatchOne(expr, names, parentenv, handlers[[1L]])
29: tryCatchList(expr, names[-nh], parentenv, handlers[-nh])
30: doTryCatch(return(expr), name, parentenv, handler)
31: tryCatchOne(tryCatchList(expr, names[-nh], parentenv, handlers[-nh]),     names[nh], parentenv, handlers[[nh]])
32: tryCatchList(expr, classes, parentenv, handlers)
33: tryCatch(evaluate(request$content$code, envir = .GlobalEnv, output_handler = oh,     stop_on_error = 1L), interrupt = function(cond) interrupted <<- TRUE,     error = .self$handle_error)
34: executor$execute(msg)
35: handle_shell()
36: kernel$run()
37: IRkernel::main()
An irrecoverable exception occurred. R is aborting now ...

I then load up an existing python 3 notebook and attempt to run the first cell which has import numpy as np in it and I get the following error:

ModuleNotFoundError                       Traceback (most recent call last)
<ipython-input-2-2c671b621757> in <module>()
----> 1 import numpy as np

When I launch the jupyter notebook from the command line rather than from within Ananconda-Navigator the notebook launches fine without any errors HOWEVER when I click new to create new notebook it does NOT have R as an option. It only has R as an option when I launch the jupyter notebook from within the Ananconda-Navigator from the R environment I created.

Finally, the Ananconda-Navigator application icon fails to load HOWEVER, I can launch it from the command line via anaconda-navigator command.

So clearly, the installation of R environment described on anaconda's website has messed everything up.

I even re-installed ananconda python on top of everything I had to see if that would clear up any of the problems. Nope - same thing.

I downloaded Rstudio directly and tried to launch it - and I got the following error:

Unable to locate `R` binary by scanning standard locations.

How can the RStudio app NOT find what it just installed? Bizarre?

Does anyone have any ideas what is going on and how do I fix the various issues that are present?

codingknob
  • 11,108
  • 25
  • 89
  • 126
  • 1
    File it on [Anaconda Issues](https://github.com/ContinuumIO/anaconda-issues). My guess is it's a Catalina-specific problem. Meanwhile, if you make sure **base** has `nb_conda_kernels` package installed and the R env has `r-irkernel`, then the env will show up as an available kernel in Jupyter launched from shell (as in [this answer](https://stackoverflow.com/a/56409235/570918)). – merv Nov 03 '19 at 17:36
  • See https://github.com/ContinuumIO/anaconda-issues/issues/11423 – codingknob Nov 03 '19 at 18:22
  • I also can't seem to get RStudio to launch successfully - I just installed it and launched but get a `Unable to locate R binary by scanning standard locations` error – codingknob Nov 03 '19 at 19:21
  • also filed an issue with RStudio https://github.com/rstudio/rstudio/issues/5690 – codingknob Nov 03 '19 at 19:25
  • did you install R? It's a separate install – merv Nov 03 '19 at 19:55
  • does it not come with the anaconda distribution that I installed? – codingknob Nov 03 '19 at 20:15
  • I feel like we're getting off-topic here. First, no, Anaconda default install doesn't include R. Second, Conda installs things in isolated environments, but RStudio only searches default install locations (e.g., CRAN R installs), so it won't find them. Try searching how to configure RStudio to use a Conda environment. Some details on setting the binary are [here](https://support.rstudio.com/hc/en-us/articles/200486138-Changing-R-versions-for-RStudio-desktop), but also see [this post](https://community.rstudio.com/t/why-not-r-via-conda/9438/4). – merv Nov 03 '19 at 20:32
  • Okay - I installed R separately so now RStudio works - However the Jupyter Notebook bug remains as described – codingknob Nov 03 '19 at 22:50

0 Answers0