通过/etc/rc.local运行时,Jupyter Notebook无法找到内核 [英] Jupyter notebook can't find kernel when run through /etc/rc.local
问题描述
我在带有python2(默认)和ITorch内核的EC2实例上拥有Jupyter Notebook服务器.通过SSH命令行运行时,一切正常.
I have a Jupyter Notebook server on an EC2 instance with python2 (default) and ITorch kernels. Everything works fine when run through SSH command line.
问题是,当我尝试在启动时运行该笔记本时,笔记本服务器找不到ITorch内核.我确实可以在python笔记本上正常工作.我得到的错误是一个窗口说
The problem is that when I try to make this run at startup, the notebook server can't find ITorch kernel. I does work fine for python notebooks though. The error I get is a window saying
Kernel not found
I couldn't find a kernel matching iTorch. Please select a kernel: (python2)
我所做的就是将此行添加到/etc/rc.local
What I did was adding this line to /etc/rc.local
/home/ubuntu/anaconda2/bin/jupyter-notebook --JupyterApp.config-file=/home/ubuntu/.jupyter/jupyter_notebook_config.py &> /dev/null &
笔记本服务器显然运行良好.这是来自系统日志
The notebook server apparently runs fine. This is from the system log
ip-172-31-20-152 login: [32m[I 12:20:51.073 NotebookApp][0;10m Serving notebooks from local directory: /home/ubuntu/notebook
[32m[I 12:20:51.076 NotebookApp][0;10m 0 active kernels
[32m[I 12:20:51.078 NotebookApp][0;10m The Jupyter Notebook is running at: https://[all ip addresses on your system]:8888/
[32m[I 12:20:51.081 NotebookApp][0;10m Use Control-C to stop this server and shut down all kernels (twice to skip confirmation).
这些是我在配置文件中唯一修改过的行
These are the only lines I modified in my config file
# Configuration file for jupyter-notebook.
c = get_config()
c.NotebookApp.notebook_dir = u'/home/ubuntu/notebook'
c.NotebookApp.certfile = u'/home/ubuntu/certs/mycert.pem'
c.NotebookApp.keyfile = u'/home/ubuntu/certs/mycert.key'
c.NotebookApp.ip = '*'
c.NotebookApp.open_browser = False
c.NotebookApp.password = u'<password>'
c.NotebookApp.port = 8888
推荐答案
@Thomas K评论解决了它:
@Thomas K comment solved it:
"ITorch内核可能是为您的用户设置的,并且当系统运行它时,它是另一个用户.运行jupyter kernelspec list
以查看内核的位置,如果ITorch在您的主目录下,则将其复制到/usr/local/share/jupyter/kernels/
".
"The ITorch kernel is probably set up for your user, and when the system runs it, it's a different user. Run jupyter kernelspec list
to see where the kernels are, and if ITorch is under your home directory, copy it to /usr/local/share/jupyter/kernels/
".
这篇关于通过/etc/rc.local运行时,Jupyter Notebook无法找到内核的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!