尝试在Ubuntu上运行ipython3笔记本服务器时出错

时间:2015-07-31 18:04:16

标签: ipython ipython-notebook jupyter

我按照instructions设置了ipython3服务器。

这是我的ipython_notebook_config.py

c.NotebookApp.ip = '*'
c.NotebookApp.certfile = u'/home/ed/.ipython/profile_default/ds.pem'
c.NotebookApp.open_browser = False
c.NotebookApp.password = u'sha512:..mykey...'
c.NotebookApp.port = 20000

当我启动笔记本时,这就是我得到的:

ipython3 notebook                                                                                 ~
[I 19:51:50.443 NotebookApp] Using MathJax from CDN: https://cdn.mathjax.org/mathjax/latest/MathJax.js
[I 19:51:50.476 NotebookApp] Serving notebooks from local directory: /home/ed
[I 19:51:50.476 NotebookApp] 0 active kernels 
[I 19:51:50.476 NotebookApp] The IPython Notebook is running at: https://[all ip addresses on your system]:20000/
[I 19:51:50.476 NotebookApp] Use Control-C to stop this server and shut down all kernels (twice to skip confirmation)

当我尝试从外部连接到此计算机时出现错误:

[E 19:52:02.413 NotebookApp] Exception in callback (<socket.socket fd=5, family=AddressFamily.AF_INET, type=2049, proto=6, laddr=('0.0.0.0', 20000)>, <function wrap.<locals>.null_wrapper at 0x7f766269a488>)
    Traceback (most recent call last):
      File "/home/ed/.local/lib/python3.4/site-packages/tornado/ioloop.py", line 866, in start
        handler_func(fd_obj, events)
      File "/home/ed/.local/lib/python3.4/site-packages/tornado/stack_context.py", line 275, in null_wrapper
        return fn(*args, **kwargs)
      File "/home/ed/.local/lib/python3.4/site-packages/tornado/netutil.py", line 265, in accept_handler
        callback(connection, address)
      File "/home/ed/.local/lib/python3.4/site-packages/tornado/tcpserver.py", line 239, in _handle_connection
        do_handshake_on_connect=False)
      File "/home/ed/.local/lib/python3.4/site-packages/tornado/netutil.py", line 501, in ssl_wrap_socket
        context = ssl_options_to_context(ssl_options)
      File "/home/ed/.local/lib/python3.4/site-packages/tornado/netutil.py", line 478, in ssl_options_to_context
        context.load_cert_chain(ssl_options['certfile'], ssl_options.get('keyfile', None))
    ssl.SSLError: [SSL] PEM lib (_ssl.c:2536)

我已将其设置在另外两台机器上,我没有遇到任何问题。我不知道出了什么问题,可能是一个缺少的库或一些我看不到的字幕错误。

我在Ubuntu 15.04上使用IPython 3.2.1。,Python 3.4.3。

有什么想法吗?

3 个答案:

答案 0 :(得分:0)

使用修订后的opessl命令

openssl req -x509 -nodes -days 365 -newkey rsa:2048 -keyout mycert.key -out mycert.pem
来自@GeQi的

并确保在浏览器中使用HTTPS为我工作。

答案 1 :(得分:0)

检查1:为22、443、8888更新AWS EC2安全组中的入站规则。

检查2:确保使用以下命令在certs文件夹中创建mycert.pem文件:

  

$ openssl req -x509 -nodes -days 365 -newkey rsa:2048 -keyout   mycert.pem -out mycert.pem

检查3:passwd()>保存SHA密钥并将该密钥添加到jupyter_notebook_config.py中

检查4:使用https://public-DNS-of-EC2-Instance:8888 &如果连接不是私人的,则继续进行下去...

有关更多详细信息: https://github.com/prakashpy/miscellaneous/tree/master/jupyter-notebook-on-aws-ec2

答案 2 :(得分:-1)

  

Jupyter和IPython的未来

     

IPython是一个不断发展的项目,与语言无关的组件越来越多。 IPython 3.x是IPython的最后一个单片版本,包含笔记本服务器,qtconsole等。从IPython 4.0开始,该项目与语言无关的部分:笔记本格式,消息协议,qtconsole,笔记本Web应用程序等。已经转移到Jupyter名下的新项目。 IPython本身专注于交互式Python,其中一部分是为Jupyter提供Python内核。

简而言之,笔记本不再是IPython项目的一部分,因此你应该寻找&#34; Jupyter notebook&#34;的关键字。切换到较新的Jupyter笔记本非常容易,只需按照文档(herehere)安装模块和set up the public server即可。程序几乎完全相同。然而,在完成所有我仍然遇到相同的SSLError之后。我在github repo中找到了解决方案here

  

在对openssl参数稍作修改后,它对我有用。我将密钥和证书保存在同一个文件中,&#39; mycert.pem&#39;。   原文:$ openssl req -x509 -nodes -days 365 -newkey rsa:2048 -keyout mycert.key -out mycert.pem   我的版本:$ openssl req -x509 -nodes -days 365 -newkey rsa:2048 -keyout mycert.pem -out mycert.pem

有些人报告说,这对他们来说不会有问题,但问题尚未解决,尽管这对我来说非常有效。此外,您可能想要清理以前的配置。

# remove the earlier created ipython profile
$ ipython profile locate nbserver
/home/ubuntu/.ipython/profile_nbserver
$ rm -r /home/ubuntu/.ipython/profile_nbserver
$ ipython profile locate nbserver
[ProfileLocate] CRITICAL | Profile 'nbserver' not found.