I can open a remote Jupyter Notebook but I need to:
connect in SSH to the server
then use jupyter plugin to connect to the kernel.
Is there a way to do that more simply ?
Related
I am using the Visual Studio Code SSH connection.
In Python, one can use a jupyter notebook .ipynb or cells divided by #%% in a .py file to open an interactive prompt.
I would like to close the ssh connection but keep the jupyter notebook or the interactive prompt running.
How can I do that?
i'm working with VSCode on remote server via ssh with the jupyter notebook extension.
but when im disconnect from the session the process of the code is stopped.
is there a way to run the notebook from the VSCode with a backgroung process with tools like tmux.
cause i'm far of being a linux expert and i cant figure out how can i run the notebook process with tmux via the VSCode.
thanks a lot in advance.
Simply start a tmux process in the remote terminal start Jupyter in the tmux session. You can go out of the tmux session without closing it.
In VSC you can choose the tmux session as the host.
I am trying to run some notebooks in my virtual environment in the VSCode (remotely connected). I install the venv as usual via python3 -m venv <venv-name>, activate it and install all the needed modules. When I run which ipython I get the one from the venv so I install the kernel via ipython kernel install --name "<name>" --user and it is successfully created in ~/.local/share/jupyter/kernels/ directory and the kernel.json points to the venv python. Then I open the VSCode and select both the Python: Select Interpreter and Jupyter: Select Interpreter to start Jupyter server to point to the virtual environment's python, sth. like .../<venv-name>/bin/python3.
However, when I try to run the cell it wants me to select kernel (I can also do it myself in the upper right corner of the VSCode), but my newly created kernel is not there. There are only two (same) ones from usr/bin/python.
It is really strange since twice in two days my kernel magically appeared for one notebook and worked as desired, but when I opened a new notebook, my kernel was gone again. I tried to remove/reinstall kernels, venvs, VSCode's Python and Jupyter extensions but nothing helped. Any suggestions?
For now, I start the kernel in remote command-line via jupyter notebook --no-browser --ip=<ip> and then insert the connection link to Jupyter Server in the bottom right corner of the VSCode status bar but am wondering if there is an easier way since all the stuff (except VSCode) is on a remote machine?
This way is not easy. You can set up Jupyter Kernel easily.
Firstly, using ssh to connect to the remote server.
Secondly, open Command Palette (⇧⌘P) and enter Python: Select Interpreter, you can directly connecting to remote kernel.
resource: https://code.visualstudio.com/docs/datascience/jupyter-notebooks
I have opened my .ipynb file with vscode (Python 3.9 Interpreter - installed jupyterlab), it's connected locally, how can I open it through the browser? what is the default port?
Type:
jupyter notebook in vscode terminal (Ctrl + Shift + ~) and it will start Jupyter in browser of your preference.
If jupyter not installed type:
pip install jupyter in elevated powershell or however you prefer to do installs.
If pip not installed:
python -m pip install -U pip
if python not installed I prefer to install with chocolatey and walkthrough is on their site. https://docs.python-guide.org/starting/install3/win/#install3-windows
I do not have a solution, but only hints. You can let Code start a local server via Ctrl + Shift + P, then Jupyter connect , then select default.
Unfortunately, it's not documented how you can access the server. I gave that feedback on the documentation page.
Source of the image: https://code.visualstudio.com/docs/python/jupyter-support#_connect-to-a-remote-jupyter-server
You can list all running notebooks and their tokens by typing jupyter notebook list in the terminal.
It will output something like this:
Currently running servers:
http://localhost:8889/?token=your_token :: /directory
You can click on the link to open it in the browser.
A solution for CORS-related issues:
In my case, the problem was in my CORS configuration. What fixed it for me was launching the notebook from the terminal with the allowed origin specified:
jupyter notebook --no-browser --NotebookApp.allow_origin_pat=https://.*vscode-cdn\.net
If, for some reason, that doesn't work, you could try the following as a last resort (bearing in mind this will allow ANY origin):
jupyter notebook --no-browser --NotebookApp.allow_origin='*'
Source:
https://github.com/microsoft/vscode-jupyter/wiki/Connecting-to-a-remote-Jupyter-server-from-vscode.dev
When I connect via ssh to a remote machine in vscode, the integrated terminal opens a terminal in the remote machine. Is there a way to open a terminal panel with a terminal of my local machine?
Using the command palette (default ctrl+shift+p/cmd+shift+p), there is an option
Terminal: Create New Integrated Terminal (local)