我正在按照 O'Reilly 视频教程 ( http://shop.oreilly.com/product/0636920044260.do ) 中的说明在 MacOS 10.10.5 上运行新的 Jupyter notebook 安装。安装 miniconda 后,我为 R 内核创建了一个环境:
conda create -n jupyter_r -c r r-irkernel r-recommended r-essentials anaconda rpy2 -y
在那个环境中,我可以启动 jupyter notebook 并创建一个新的 R notebook。
但是,当我尝试执行时:
library(dplyr)
我收到一个死内核错误,内核在我的终端中重新启动。
我可以成功执行:
library(ggplot2)
library(lattice)
library(reshape2)
似乎只有库(dplyr)会导致崩溃。我还验证了 anaconda 和 miniconda 安装都会发生这种情况。
崩溃的输出是:
*** caught segfault ***
address 0x18, cause 'memory not mapped'
Traceback:
1: dyn.load(file, DLLpath = DLLpath, ...)
2: library.dynam(lib, package, package.lib)
3: loadNamespace(package, c(which.lib.loc, lib.loc))
4: doTryCatch(return(expr), name, parentenv, handler)
5: tryCatchOne(expr, names, parentenv, handlers[[1L]])
6: tryCatchList(expr, classes, parentenv, handlers)
7: 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 = stderr()) .Internal(printDeferredWarnings()) } invisible(structure(msg, class = "try-error", condition = e))})
8: try({ ns <- loadNamespace(package, c(which.lib.loc, lib.loc)) env <- attachNamespace(ns, pos = pos, deps)})
9: library(dplyr)
10: eval(expr, envir, enclos)
11: eval(expr, envir, enclos)
12: withVisible(eval(expr, envir, enclos))
13: withCallingHandlers(withVisible(eval(expr, envir, enclos)), warning = wHandler, error = eHandler, message = mHandler)
14: doTryCatch(return(expr), name, parentenv, handler)
15: tryCatchOne(expr, names, parentenv, handlers[[1L]])
16: tryCatchList(expr, classes, parentenv, handlers)
17: 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 = stderr()) .Internal(printDeferredWarnings()) } invisible(structure(msg, class = "try-error", condition = e))})
18: try(f, silent = TRUE)
19: handle(ev <- withCallingHandlers(withVisible(eval(expr, envir, enclos)), warning = wHandler, error = eHandler, message = mHandler))
20: 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)
21: evaluate(request$content$code, envir = .GlobalEnv, output_handler = oh, stop_on_error = 0L)
22: doTryCatch(return(expr), name, parentenv, handler)
23: tryCatchOne(expr, names, parentenv, handlers[[1L]])
24: tryCatchList(expr, names[-nh], parentenv, handlers[-nh])
25: doTryCatch(return(expr), name, parentenv, handler)
26: tryCatchOne(tryCatchList(expr, names[-nh], parentenv, handlers[-nh]), names[nh], parentenv, handlers[[nh]])
27: tryCatchList(expr, classes, parentenv, handlers)
28: tryCatch(evaluate(request$content$code, envir = .GlobalEnv, output_handler = oh, stop_on_error = 0L), interrupt = function(cond) interrupted <<- TRUE, error = handle_error)
29: executor$execute(msg)
30: handle_shell()
31: kernel$run()
32: IRkernel::main()
aborting ...
[I 15:33:17.931 NotebookApp] KernelRestarter: restarting kernel (1/5)
关于造成这种情况的任何建议?我发现了许多对 jupyter 内核自发崩溃的引用,但似乎没有任何内容与 dplyr 相关。
谢谢,
亚历克斯