Jupyter notebook looses connection - python

I am fairly new to working with python, so I am sorry if this is a naive question.
I have set up a jupyter notebook that I start through the windows terminal. I run it with python 3.9.7 in an Anaconda virtual environment. I use microsoft edge as host browser because I had problems with google chrome blocking jupyter lab.
Since yesterday, I receive an error message after opening my notebook with - jupyter lab command (which has worked for me since some weeks now). The puzzling thing is, that I can open my notebook and work in it for some minutes usually, but then this message pops up:
Server Connection Error: A connection to the Jupyter server could not be established. JupyterLab will continue trying to reconnect. Check
your network connection or Jupyter server configuration.
Unfortunately, I have really no idea why this could be, therefore I have not tried much to fix this yet. I have a stable internet connection. Simply closing the notebook and reopening it worked for some times, but after a while of working in the notebook it looses the connection again.
Has anyone experienced similar problems?
Thank you for your help and ideas!

I had this issue with jupyter lab my error seems the same:
"A connection to the Jupyter server could not be established.
JupyterLab will continue trying to reconnect. Check your network
connection or Jupyter server configuration."
The problem for me was that I had started the program from the command line using the "jupyter-lab" command and had subsequently closed my terminal after the jupyter lab opened. Closing terminal shut down the required server. Left the terminal open and is working normally.

Related

Jupyter notebook in blank when initiating a notebook - remote desktop

I'm trying to run jupyter notebook on a remote desktop, which is highly secured (i.e. I had to activate scripting on internet explorer to be able to log in into outlook).
I am really new to this remote desktop thing and I would like to know why is this happening and if it has a solution. As a finance student, I really struggle with this stuff.
I used miniconda to run this. Also, this is shown in the terminal before opening the jupyter notebook window:
"[W 09:21:35.153 NotebookApp] Terminals not available (error was DLL load failed while importing winpty: The specified procedure could not be found.)"
What is shown when I open a notebook
Best regards,
I'm not sure Internet Explorer supports jupyter notebooks, try with another browser if you can.

Connection to the notebook server cannot be established

I used to work with Jupyter notebook normally, but after formatting my laptop and reinstall it again, notebooks take a lot of time to be charged and the connection to the notebook server cannot be established.
Also when I look at my cmd, I recognize that Jupyter tries to call some libraries which are not in this particular notebook I opened, for example, the Cose library which I used in another notebook which I didn't even open after the installation!
And I always get the following message on my notebook:
Connection to the notebook server cannot be established. The notebook will continue its attempts. Check your network connection or the settings of the notebook server.
So what should I do, I really need your help and I will be so thankful.
Two options:
You can try installing cose module - it shows ModuleNotFoundError. Probably when you reformatted your laptop, the library could have been uninstalled.
You can try re-installing conda and jupyter notebook

Remote Jupyter notebook server disconnects and crashes semi-randomly

I have a home server, which I use to run Jupyter.
I open a terminal window on my macbook and login into the server using ssh username#home-server. I then start jupyter using jupyter notebook --no-browser. I then open another terminal window on my macbook and set up Jupyter server port forwarding ssh -L 8000:localhost:8888 username#home-server. Then I can open a browser on my mac, navigate to localhost:8000 with the right token, and everything works.
But!
Periodically, the Jupyter server disconnects and the terminal window I used to set up port forwarding starts printing "Connection refused" messages. When I re-open the terminals and re-ssh-login into the server, it shows no Jupyter notebooks running. This is puzzling, as I would expect Jupyter to keep running on the remote server, even if I lose the internet connection to it.
Similarly, if I close my macbook and it goes to sleep, the Jupyter notebook also somehow dies on the remote server.
Any thoughts on what I am doing wrong? The server is running OpenSUSE Leap.
Thanks!

Run jupyter notebook on GCP without any dependency on my laptop

I'm currently using GCP to run the Jupyter notebooks on the notebook server provided by Google. Every time I open the notebook server in commandline, it shuts down when there is a network interruption or power outage on my end. I'm very naive on GCP too.
Is there any way that I could run the Ipython notebooks on the server and later collect the results without having to bother about anything else?
Thanks in advance!
Have you tried using GCP's AI Platform Notebooks?
https://cloud.google.com/ai-platform-notebooks/
You can open these notebooks directly in your browser unlike the older Datalab notebooks (no need to SSH). That should solve your network interruption issues

IPython notebook WebSocket connection could not be established. You will NOT be able to run code

I've been tryin to run some simple code in IPython notebook but i keep getting this error:
"A WebSocket connection could not be established. You will NOT be able to run code. Check your network connection or notebook server configuration."
There were no problems during the install and there are no error messeges when i load the notebook.
I'm thinking maybe it has something to do with the fact im running my local server on xamp?
Doed anyone have a clue how to solve this?
I would be very greatfull.
Edit: I'm loading my notebook using the command 'ipython notebook' in the command prompet the output is:
[NotebookApp]"Using existing profile dir: c:\users\Nimrod\.ipython\profile_default
[NotebookApp]using MathJax from CDN: http://cdn.mathjax.org/mathjax/latest/mathjax.js
[NotebookApp] Serving notebooks from local directory c:\users\Nimrod
[NotebookApp] 0 active kernels
[NotebookApp] use control c to stop server and shut doen all kernels
[NotebookApp] Kernel started: 0ac0db12-63a0-4a4a-be25-0051
Thanks a lot.
Okay, by default ipython notebook launches standalone using the tornado http server running on local port 8888.
Try typing localhost:8888 into your browser.
If you want to customize it to run on a different port use:
ipython notebook --port=<NEW PORT>
If you'd also like to allow connections from remote machines do:
ipython notebook --ip=0.0.0.0 --port=<NEW PORT>

Categories