Homebrew安装的Anaconda中的JupyterLab无法启动内核,寻找旧安装

时间:2018-04-11 21:01:47

标签: anaconda jupyter-notebook jupyter-lab homebrew-cask

我希望有人能帮助我理解为什么JupyterLab无法在我的系统上启动内核。

背景

我正在开发macOS High Sierra。我以前通过Mac OS安装程序在我的主文件夹($HOME/anaconda)的默认位置安装了Anaconda。基于this thread我卸载了Anaconda。

我从Homebrew Cask重新安装了Anaconda(将export PATH=/usr/local/anaconda3/bin:"$PATH"放在我的.bashrc)。

问题

现在我

  • 运行jupyter-lab
  • 创建一个新笔记本,
  • 选择一个Python 3内核,

该过程失败,输出如下:

Traceback (most recent call last): File "/usr/local/anaconda3/lib/python3.6/site-packages/tornado/web.py", line 1543, in _execute result = yield result File "/usr/local/anaconda3/lib/python3.6/site-packages/tornado/gen.py", line 1099, in run value = future.result() File "/usr/local/anaconda3/lib/python3.6/site-packages/tornado/gen.py", line 1107, in run yielded = self.gen.throw(*exc_info) File "/usr/local/anaconda3/lib/python3.6/site-packages/notebook/services/sessions/handlers.py", line 73, in post type=mtype)) File "/usr/local/anaconda3/lib/python3.6/site-packages/tornado/gen.py", line 1099, in run value = future.result() File "/usr/local/anaconda3/lib/python3.6/site-packages/tornado/gen.py", line 1107, in run yielded = self.gen.throw(*exc_info) File "/usr/local/anaconda3/lib/python3.6/site-packages/notebook/services/sessions/sessionmanager.py", line 79, in create_session kernel_id = yield self.start_kernel_for_session(session_id, path, name, type, kernel_name) File "/usr/local/anaconda3/lib/python3.6/site-packages/tornado/gen.py", line 1099, in run value = future.result() File "/usr/local/anaconda3/lib/python3.6/site-packages/tornado/gen.py", line 1107, in run yielded = self.gen.throw(*exc_info) File "/usr/local/anaconda3/lib/python3.6/site-packages/notebook/services/sessions/sessionmanager.py", line 92, in start_kernel_for_session self.kernel_manager.start_kernel(path=kernel_path, kernel_name=kernel_name) File "/usr/local/anaconda3/lib/python3.6/site-packages/tornado/gen.py", line 1099, in run value = future.result() File "/usr/local/anaconda3/lib/python3.6/site-packages/tornado/gen.py", line 315, in wrapper yielded = next(result) File "/usr/local/anaconda3/lib/python3.6/site-packages/notebook/services/kernels/kernelmanager.py", line 148, in start_kernel super(MappingKernelManager, self).start_kernel(**kwargs) File "/usr/local/anaconda3/lib/python3.6/site-packages/jupyter_client/multikernelmanager.py", line 110, in start_kernel km.start_kernel(**kwargs) File "/usr/local/anaconda3/lib/python3.6/site-packages/jupyter_client/manager.py", line 259, in start_kernel **kw) File "/usr/local/anaconda3/lib/python3.6/site-packages/jupyter_client/manager.py", line 204, in _launch_kernel return launch_kernel(kernel_cmd, **kw) File "/usr/local/anaconda3/lib/python3.6/site-packages/jupyter_client/launcher.py", line 128, in launch_kernel proc = Popen(cmd, **kwargs) File "/usr/local/anaconda3/lib/python3.6/subprocess.py", line 709, in __init__ restore_signals, start_new_session) File "/usr/local/anaconda3/lib/python3.6/subprocess.py", line 1344, in _execute_child raise child_exception_type(errno_num, err_msg, err_filename) FileNotFoundError: [Errno 2] No such file or directory: '~/anaconda/bin/python': '~/anaconda/bin/python'

我已经从我的环境$HOME/anaconda.bashrc删除了对.bash_profile(我的旧安装位置)的所有引用,所以我无法弄清楚提取参考的地方。

任何建议都将不胜感激。

1 个答案:

答案 0 :(得分:0)

这个问题在this GitHub thread中针对Jupyter项目得到了回答。基本解决方案:

  • 运行jupyter kernelspec list以查看它是否指向正确的Python安装
    • 如果没有,请删除文件夹~/Library/Jupyter
    • 重新运行jupyter kernelspec list

这应该重建目录并输出

之类的输出

Available kernels: python3 /usr/local/anaconda3/share/jupyter/kernels/python3

这是Homebrew安装Anaconda的正确位置。