r - Jupyter Notebook 在 El Capitan 公测版上找不到 R 内核

标签 r jupyter osx-elcapitan

我在备用计算机上安装了 El Capitan beta 用于测试目的,以便在我们数据科学团队的其他人在今年秋天某个时候最终版本发布后升级他们的日常机器之前找出潜在问题(注意:我可以导航围绕 Unix 但我远不是 Mac 程序员)。 python 2 和 3 的内核工作得很好,但是当我尝试加载 R 内核时,我收到以下消息:

从 Jupyter notebook 本身我得到:

Traceback (most recent call last):
  File "/Users/test/anaconda/lib/python3.4/site-packages/IPython/html/base/handlers.py", line 365, in wrapper
    result = yield gen.maybe_future(method(self, *args, **kwargs))
  File "/Users/test/anaconda/lib/python3.4/site-packages/IPython/html/services/sessions/handlers.py", line 53, in post
    model = sm.create_session(path=path, kernel_name=kernel_name)
  File "/Users/test/anaconda/lib/python3.4/site-packages/IPython/html/services/sessions/sessionmanager.py", line 66, in create_session
    kernel_name=kernel_name)
  File "/Users/test/anaconda/lib/python3.4/site-packages/IPython/html/services/kernels/kernelmanager.py", line 84, in start_kernel
    kernel_name=kernel_name, **kwargs)
  File "/Users/test/anaconda/lib/python3.4/site-packages/IPython/kernel/multikernelmanager.py", line 112, in start_kernel
    km.start_kernel(**kwargs)
  File "/Users/test/anaconda/lib/python3.4/site-packages/IPython/kernel/manager.py", line 240, in start_kernel
    **kw)
  File "/Users/test/anaconda/lib/python3.4/site-packages/IPython/kernel/manager.py", line 189, in _launch_kernel
    return launch_kernel(kernel_cmd, **kw)
  File "/Users/test/anaconda/lib/python3.4/site-packages/IPython/kernel/launcher.py", line 213, in launch_kernel
    proc = Popen(cmd, **kwargs)
  File "/Users/test/anaconda/lib/python3.4/subprocess.py", line 859, in __init__
    restore_signals, start_new_session)
  File "/Users/test/anaconda/lib/python3.4/subprocess.py", line 1457, in _execute_child
    raise child_exception_type(errno_num, err_msg)
FileNotFoundError: [Errno 2] No such file or directory: 'R'

我在终端中收到以下错误消息。

[E 19:44:58.862 NotebookApp] Unhandled error in API request
    Traceback (most recent call last):
      File "/Users/test/anaconda/lib/python3.4/site-packages/IPython/html/base/handlers.py", line 365, in wrapper
        result = yield gen.maybe_future(method(self, *args, **kwargs))
      File "/Users/test/anaconda/lib/python3.4/site-packages/IPython/html/services/sessions/handlers.py", line 53, in post
        model = sm.create_session(path=path, kernel_name=kernel_name)
      File "/Users/test/anaconda/lib/python3.4/site-packages/IPython/html/services/sessions/sessionmanager.py", line 66, in create_session
        kernel_name=kernel_name)
      File "/Users/test/anaconda/lib/python3.4/site-packages/IPython/html/services/kernels/kernelmanager.py", line 84, in start_kernel
        kernel_name=kernel_name, **kwargs)
      File "/Users/test/anaconda/lib/python3.4/site-packages/IPython/kernel/multikernelmanager.py", line 112, in start_kernel
        km.start_kernel(**kwargs)
      File "/Users/test/anaconda/lib/python3.4/site-packages/IPython/kernel/manager.py", line 240, in start_kernel
        **kw)
      File "/Users/test/anaconda/lib/python3.4/site-packages/IPython/kernel/manager.py", line 189, in _launch_kernel
        return launch_kernel(kernel_cmd, **kw)
      File "/Users/test/anaconda/lib/python3.4/site-packages/IPython/kernel/launcher.py", line 213, in launch_kernel
        proc = Popen(cmd, **kwargs)
      File "/Users/test/anaconda/lib/python3.4/subprocess.py", line 859, in __init__
        restore_signals, start_new_session)
      File "/Users/test/anaconda/lib/python3.4/subprocess.py", line 1457, in _execute_child
        raise child_exception_type(errno_num, err_msg)
    FileNotFoundError: [Errno 2] No such file or directory: 'R'
[E 19:44:58.870 NotebookApp] {
      "Accept-Language": "en-US,en;q=0.8",
      "Content-Length": "72",
      "Accept": "application/json, text/javascript, */*; q=0.01",
      "Dnt": "1",
      "X-Requested-With": "XMLHttpRequest",
      "Content-Type": "application/x-www-form-urlencoded; charset=UTF-8",
      "Origin": "http://localhost:8888",
      "Referer": "http://localhost:8888/notebooks/Untitled4.ipynb?kernel_name=ir",
      "Accept-Encoding": "gzip, deflate",
      "Connection": "keep-alive",
      "Host": "localhost:8888",
      "User-Agent": "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_11_0) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/43.0.2357.132 Safari/537.36"
    }
[E 19:44:58.870 NotebookApp] 500 POST /api/sessions (::1) 25.54ms referer=http://localhost:8888/notebooks/Untitled4.ipynb?kernel_name=ir
[I 20:04:04.914 NotebookApp] Creating new notebook in
[I 20:04:05.707 NotebookApp] Kernel started: 75ef1aa5-453d-4a18-94df-eae30238c688

我的第一个想法是尝试重新安装 R 内核(及其依赖项),但这些依赖项必须从它们的二进制文件编译并且需要 Xcode(没有公开测试版)。有谁知道解决这个问题的潜在方法(或者对从哪里开始寻找有任何想法)?我想弄清楚这是否是我们可以自己解决的问题,或者我们是否可能需要等待 Jupyter 小组的官方修复。提前致谢。

最佳答案

能够让这个工作。更新到 beta 会弄乱 R $PATH 以及自制软件及其依赖项。采取以下步骤解决了我遇到的所有问题。

1) Reinstall Revolution R Open (或您首选的 R 安装。我喜欢 RRO,因为它包含英特尔 MKL - 数学核心库)

2) 修复 Homebrew 权限:

$ sudo chown -R "$USER":admin /usr/local

3) 清理 Homebrew 安装:

$ rm -rf /usr/local/Cellar /usr/local/.git && brew cleanup

4) 重新安装 Homebew:

$ ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"

5) 安装 OS X 命令行工具(如果尚未安装):

$ xcode-select --install

6)安装zqm:

$ brew install zmq

7) 在终端中启动 R

$R

8) 运行以下命令:

install.packages(c('rzmq','repr','IRkernel','IRdisplay'),
                 repos = c('http://irkernel.github.io/', getOption('repos')),
                 type = 'source')
IRkernel::installspec()

现在应该可以打开一个新的终端窗口并启动 jupyter。

关于r - Jupyter Notebook 在 El Capitan 公测版上找不到 R 内核,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/31395604/

相关文章:

r - 如何反转R中数据帧的顺序

r - 检查 HTTPS(安全超文本传输​​协议(protocol))url 是否有效

Python Jupyter 笔记本 : Specify cell execution order

xcode - iOS 模拟器无法启动

macos - 沙箱用户: This Apple ID has not yet been used with the App Store

r - 大矩阵 : solve(crossprod(X)) when dim(X) = 100, 000:5000

R 和传单绘制的圆半径不正确?

python - 升级 Ipython 时出现问题(prompt_toolkit 不兼容)

python - 将 jupyter notebook 转为 python 脚本的最佳实践

osx-elcapitan - 如何从intellij访问Iterm2