在Google Cloud VM上运行Jupyter Notebook的SSL错误

时间:2019-07-10 16:32:58

标签: google-cloud-platform jupyter-notebook ssl-certificate virtual-machine jupyter

我已经在GCP虚拟机上设置了一个实例,并安装了蟒蛇,火炬等,并初始化了我的Jupyter笔记本(包括配置设置)。我已经安装了Google存储桶,一切似乎都还不错,除了运行Jupyter时是这样:

~$ jupyter notebook --certfile=/home/username/certs/mycert.pem
[I 16:18:41.293 NotebookApp] [nb_conda_kernels] enabled, 3 kernels found
[I 16:18:44.879 NotebookApp] Serving notebooks from local directory: 
/home/username
[I 16:18:44.879 NotebookApp] 0 active kernels 
[I 16:18:44.879 NotebookApp] The Jupyter Notebook is running at: 
https://0.0.0.0:8888/
[I 16:18:44.879 NotebookApp] Use Control-C to stop this server and shut 
down all kernels (twice to skip confirmation).

我可以在我的VM的外部IP上访问它:

https://xx.xxx.xxx.xx:8888

但是一旦我这样做,我就会收到此错误:

ssl.SSLError: [SSL: SSLV3_ALERT_CERTIFICATE_UNKNOWN] sslv3 alert 
certificate unknown (_ssl.c:645)

完整追溯:

[W 16:18:52.343 NotebookApp] SSL Error on 11 ('73.43.19.83', 56932): 
[SSL: SSLV3_ALERT_CERTIFICATE
_UNKNOWN] sslv3 alert certificate unknown (_ssl.c:645)
[W 16:18:52.343 NotebookApp] SSL Error on 14 ('73.43.19.83', 56936): [SSL: SSLV3_ALERT_CERTIFICATE
_UNKNOWN] sslv3 alert certificate unknown (_ssl.c:645)
[E 16:18:52.343 NotebookApp] Uncaught exception
    Traceback (most recent call last):
      File "/home/username/anaconda3/lib/python3.5/site-packages/tornado/http1connection.py", l
ine 693, in _server_request_loop
        ret = yield conn.read_response(request_delegate)
      File "/home/username/anaconda3/lib/python3.5/site-packages/tornado/gen.py", line 870, in 
run
        value = future.result()
      File "/home/username/anaconda3/lib/python3.5/site-packages/tornado/concurrent.py", line 2
15, in result
        raise_exc_info(self._exc_info)
      File "<string>", line 3, in raise_exc_info
      File "/home/username/anaconda3/lib/python3.5/site-packages/tornado/gen.py", line 876, in 
run
        yielded = self.gen.throw(*exc_info)
      File "/home/username/anaconda3/lib/python3.5/site-packages/tornado/http1connection.py", l
ine 168, in _read_message
        quiet_exceptions=iostream.StreamClosedError)
      File "/home/username/anaconda3/lib/python3.5/site-packages/tornado/gen.py", line 870, in 
run
        value = future.result()
      File "/home/username/anaconda3/lib/python3.5/site-packages/tornado/concurrent.py", line 2
15, in result
        raise_exc_info(self._exc_info)
      File "<string>", line 3, in raise_exc_info
      File "/home/username/anaconda3/lib/python3.5/site-packages/tornado/iostream.py", line 124
3, in _do_ssl_handshake
        self.socket.do_handshake()
      File "/home/username/anaconda3/lib/python3.5/ssl.py", line 988, in do_handshake
        self._sslobj.do_handshake()
      File "/home/username/anaconda3/lib/python3.5/ssl.py", line 633, in do_handshake
        self._sslobj.do_handshake()
    ssl.SSLError: [SSL: SSLV3_ALERT_CERTIFICATE_UNKNOWN] sslv3 alert certificate unknown (_ssl.c:6
45)

这是在Linux VM上。在本地,我在PC上。我已经尝试过为Jupyter重写配置文件,但是我陷入了这个问题。我在网上找到的所有解决方案都没有用。

1 个答案:

答案 0 :(得分:0)

似乎您正在尝试使用Jupyter手动设置VM实例。这往往很棘手,您是否考虑过改用GCP的AI平台笔记本? https://cloud.google.com/ai-platform-notebooks

它为您提供了一个带有Jupyter Lab的VM,并预先安装和配置了许多流行的DL / ML库,您甚至不需要SSH即可访问笔记本。