How to use iPython notebook with ngrok - python

(Maybe better ask on superuser?)
iPython works fine if I use an ssh tunnel.
Using ngrok
iPython notebook loads I get an error about mathjax not loading.
I can enter code into cells but if I try to execute I get no result but the kernel seems to be running. Basically nothing works. I have no idea if I am doing something wrong or if this just wont work.
I am starting starting ngrok like this
./ngrok -authtoken myauthtoken 5023
and ipython notebook like
ipython notebook --no-browser --port=5023
Then connect to the iPython session at
https://mysubdomain.ngrok.com

Author of ngrok here: ipython notebooks and any other websocket connections now work properly as of ngrok 0.22 which is available at https://ngrok.com/download

Related

How to reconnect to an existing Jupyter notebook session in VS code?

I remember I was able to reconnect to an existing Jupyter notebook session in VS code before by changing the kernel for a notebook. Now the option to reconnect to an existing session is gone, see:
How do I reconnect to an existing Jupyter notebook session in VS code?
To be clear, the sessions were never shut down. In fact, I can still see them running in the Running tab of my browser version of jupyter notebook, although clicking on them results in a 404 error:
The jupyter kernel is running on a remote server. I use a SSH session to connect back to it when I work.
Current versions: VS code is v1.68.1 and the Jupyter extension on remote machine is v2022.5.1001601848, if that helps.
If you would like to connect to an existing jupyter server can you do so by going into the command Jupyter: Specify Jupyter Server for Connections and selecting the appropriate remote server from the list. If the required server is not on that list, then you can select it.

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.

How to use a remote Jupyter server in VSCode?

I want to use a remote Jupyter server via SSH with VSCode but I get an error whenever I try to specify the URI of any server. This also happens with local instances of Jupyter. Any server that is not started by VS Code seems to be unusable.
I am just starting a server like this
$ jupyter notebook --no-browser --port 8080
Then I enter the address in VSCode with the correct port and token
Nothing happens and I get this error, as you can see in the log below.
Command 'Python: Specify local or remote Jupyter server for connections' resulted in an error (Running the contributed command: 'python.datascience.selectjupyteruri' failed.)
Has anyone else been experiencing anything similar? I honestly have no idea how to troubleshoot this. It is worth noting that selecting the Default: VS Code will automatically start a server for you on localhost option raises the same error.
It looks like you're running a fairly old version of the Python extension, as the python.datascience.selectjupyteruri command no longer exists in the Python extension—it is now provided in a standalone Jupyter extension. Please consider upgrading to the latest version of the Python and Jupyter extensions. If that doesn't resolve the problem, please file an issue at https://github.com/microsoft/vscode-jupyter/issues and we'll be happy to help.

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.

Force Jupyter Notebook *not* to open a web browser

I'm running Jupyter notebooks (Python 3) on a remote cluster that I'm connected/tunneled to over SSH.
Jupyter's default behavior is to try to open the dashboard in a web browser when it launches -- aparently (I only just updated), at some point they switched to the Python 3 webbrowser library for this.
According to webbrowser's documentation:
text-mode browsers will be used if graphical browsers are not available or an X11 display isn’t available.
This is exactly what happens. I run jupyter notebook, webbrowser launches elinks, and my one-time authentication token gets eaten, preventing me from connecting to the notebook.
Jupyter isn't configured to use a browser -- c.NotebookApp.browser is commented out in my config -- and running BROWSER="" jupyter notebook doesn't help either.
How can I force Jupyter not to open any browser?
jupyter-notebook --help includes the following:
--no-browser
Don't open the notebook in a browser after startup.
jupyter notebook --generate-config
Then edit ~/.jupyter/jupyter_notebook_config.py and Add
NotebookApp.open_browser = False
You can achieve this by specifying --no-browser:
$ jupyter notebook --no-browser
I also recommend that you specify the port you want to use:
jupyter notebook --no-browser --port= <port_number>
ie:
$ jupyter notebook --no-browser --port=8888
You have to keep in mind that when you do this, jupyter will provide you with a token on the console, token that the server will ask you when connect remotely through the browser.
If you want to simplify this procedure, you can set a password that is easier for you to remember. To do this, you can run in a console:
$ jupyter notebook --generate-config
and later:
$ jupyter notebook password
This last command will ask you for the password that you wish to use to enter remotely.
Regards!

Categories

Resources