Jupyter notebook: connection to kernel restarts infinitely - python

I just moved on to a new PC at work, installed Anaconda.
When trying to run a notebook I see the "connecting to kernel... connected to kernel" message flash to infinity with an icon saying "No connection to kernel".
It appears as if the connection gets killed after starting.
Gif: https://i.gyazo.com/6a36abdcc1c5af6e31b4666f4baef4cf.gif
Another person at work in my room has the same problem, so perhaps it has something to do with the antivirus or domain systems at work.
How can I get my jupyter to work?

Turn off the antivirus. In my case there was the Kasperskiy who was blocking the connection

Related

Random WinError 10060 when trying to connect to websocket

Background - using a windows machine, Windows 10/11, connected to the internet through ethernet cable. Using python's websocket-client module, on pycharm.
Problem - one fine day, out of the blue, I am no longer able to connect to FTX's websocket wss://ftx.com/ws/ on my local windows machine and kept getting the error [WinError 10060] A connection attempt failed because the connected party did not properly respond after a period of time, or established connection failed because connected host has failed to respond
I tried on my VPS, a linux machine, with the same exact code and it works fine.
Attempts to fix the problem were:
A full reformat of computer, windows 10 > windows 10, and reinstall python 3.10 and pycharm.
Then upgrading windows 10 > windows 11.
Made sure all drivers are up to date, and also reinstalling them.
Resetting network settings from Windows
Tested the websocket connection with other end point and it worked fine. eg wss://api.gemini.com/v1/marketdata/BTCUSD
None of the above worked.
My websocket connection is in a while loop something like this
while True:
try:
ws.run_forever()
time.sleep(0.2)
except:
pass
So it would keep retrying.
There was a weird behavior when, from windows, I disable, and re-enable the network adapter, the websocket connection would suddenly be successful. And if I were to disable and re-enable the network adapter again; sometimes it would continue to fail, or sometimes the connection would be successful again. Note this is while the code is still executing in the while loop.
And, if I were to stop and re-run the code, it would never work, and the error WinError 10060 would arise.
At this point I am stumped and have no clue how to solve this problem as it was totally random and out of the blue. Looking for help and advise please..!

Error when open Jupyter Notebook from putty

I'am trying to open Jupyter Notebook from Putty. I have a server where is installed Python and Jupyter. I followed all the steps from this post Remote access Jupyter notebook from Windows but it doesn't work. I got the error: This site can't be reached.
Any idea?
Thx
edit: I added a photo with the ps from putty and the error from browser. It's said:
This site can't be reached
.
The good old logout/reboot mechanisms work in this case too!
You can try closing the jupyter connection in the tunnel's connection, logout from the remote server, re-connect and try. Has worked a few times for me today.
If that doesn't work, there might be stale jupyter notebook processes on the remote server. Query for them and kill them and then logout-log back in and try.
If that still does not work, try implementing your code through ipython to check if Jupyter is working at all, even if its user interface isn't loading on your browser.

Jupyter notebook error: The port 8888 is already in use, trying another port

I just installed Anaconda on y windows 10, but when I try to run the jupyter notebook or jupyter lab by the icon, nothing happend.
Tried to run the jupyter by anaconda prompt and got the error: The port 8888 is already in use, trying another port.
Tried to run in several different ports and the error is the same.
Tried to kill the task by PID and when I run the jupyter again by promp and it lasts forever and nothing happens
Tried to change the browser by manual config and everything is the same
Tried to uninstall anaconda and install again several times and boom: Same errors
I checked also proxy stuff but everything related to this is unable on my pc
Checked firewall and antivirus and also everything seems to be normal
Any other recommendation is welcome :)
As mentioned here you may just change port to other, for example:
jupyter notebook --port 8889

Jupyter Notebook: "unable to connect to Kernel"

I have just started to use virtual environment and tried to create one for Jupyter Notebook, and almost succeeded but when I tried to open a new notebook it gave the error "unable to connect to kernel or server":
Refreshing the browser, clearing the browser cache , restarting anaconda etc also did't fix the problem!
Can you tell me how to fix it?
This happens most times, try restarting anaconda it should fix the server issues, also clear browser cache.

Re-connecting to remotely run kernel with jupyter lab

I am working on a remote server with jupyter lab and has one job running. However, the connection was dropped and now I'm trying to re-connect to the same running kernel. I honestly read through many examples and jupyter docs, but I couldn't find a solution. My previous run was outputting intermediate results and I am wondering whether I can re-connect back to the running kernel and continue see the output?
I normally connect via ssh:
ssh -L 8000:localhost:8080 usere#123.45.678.9
...
then I run
jupyter notebook --no-browser --port=8080
and in the browser on my local machine I simply open 'locahost:8000' and it works nicely.
I tried to repeat those steps but I can't re-connect to existing running kernel and continue see the output.
Any suggestions please?
Suddenly, I understand your problem. So you are not let server keep running. Instead, you manually launch it everytime.
Basically the idea is that you need to make it keep running. Somehow like nohup jupyter notebook --no-browser --port=8080 & or use systemd. So that when you lose connection, the jupyter server is still running.
Then you can just reconnect to server by ssh -L 8000:localhost:8080 usere#123.45.678.9. And open locahost:8000. Finally you will see that everything is just the same as you left.

Categories

Resources