Jupyter notebook keeps reconnecting to kernel

前端 未结 2 713
悲哀的现实
悲哀的现实 2021-01-19 05:31

I get to open the Jupyter console without any problems, but when I create a new notebook it keeps connecting to and disconnecting from the kernel (the messages \"Connecting

相关标签:
2条回答
  • 2021-01-19 06:05

    I've just changed the port from 8888 to 9999, and the problem is gone.

    use the command

    jupyter notebook --generate-config
    

    (it says where the generated config file is)

    to generate a config file, then find the line

    c.NotebookApp.port
    

    and change the port.

    0 讨论(0)
  • 2021-01-19 06:14

    I'm using jupyter behind a nginx proxy. I met the same problem as you are. After drill down, I find the problem is existed in my nginx conf.

    After adding the following line to my nginx conf, it works!

    proxy_http_version 1.1;

    Here's the complete nginx conf:

    upstream my-notebook-workhorse {
      server 127.0.0.1:8888 fail_timeout=0;
    }
    
    map $http_upgrade $connection_upgrade {
        default upgrade;
        '' close;
    }
    
    # let my-notebook deal with the redirection
    server {
      listen                    80;
      server_name               my-notebook.wh;
      server_tokens             off;
      root                      /dev/null;
    
      # Increase this if you want to upload larger attachments
      client_max_body_size      20m;
    
      # individual nginx logs for this vhost
      access_log                /var/log/nginx/my-notebook_access.log;
      error_log                 /var/log/nginx/my-notebook_error.log;
    
      location / {
        proxy_pass http://my-notebook-workhorse;
        proxy_set_header X-Real-IP $remote_addr;
        proxy_set_header Host $host;
        proxy_set_header X-Forwarded_For $proxy_add_x_forwarded_for;
        proxy_set_header X-NginX-Proxy true;
        auth_basic "Restricted Content";
    
        # WebSocket support
        proxy_http_version 1.1;
        proxy_set_header Upgrade $http_upgrade;
        proxy_set_header Connection $connection_upgrade;
        proxy_set_header Origin "";
        proxy_read_timeout 86400;
      }
    }
    

    I don't known why it happens since the old version without proxy_http_version 1.1; worked well in last few months before I met the issue.

    0 讨论(0)
提交回复
热议问题