From a88477e60fb5464621d33df17911d7dde0b774ba Mon Sep 17 00:00:00 2001 From: Jim-Xu Date: Wed, 25 Sep 2024 13:46:26 -0500 Subject: [PATCH] add instructions for using jupyter-notebook in VScode --- docs/source/editors.rst | 56 +++++++++++++++++++++++++++++++++++++++++ 1 file changed, 56 insertions(+) diff --git a/docs/source/editors.rst b/docs/source/editors.rst index 4b308a9..716543f 100644 --- a/docs/source/editors.rst +++ b/docs/source/editors.rst @@ -35,3 +35,59 @@ The steps to do this are as follows: for the Command Palette (F1, ⇧⌘P). Enter the following:: ssh @keeling.earth.illinois.edu + +Connect Python Jupyter Notebook in VS Code +------------------------------------------ + +Open terminal and connect to keeling via ``ssh`` and make sure you have the Python +and Jupyter extension installed in VS Code. + +.. code-block:: console + + ssh @keeling.earth.illinois.edu + +You could use ``sinfo`` to check the available partitions and nodes, +e.g. keeling-gpu09, and specify the port number ``xxxx``, e.g. 7777. + +Now you could use the following command to login to the node, + +.. code-block:: console + + ssh -L 127.0.0.1:xxxx:127.0.0.1:xxxx node_name + +You will be required to input the password. After that, activate the Python environment +and start the Jupyter Notebook server. Make sure using +the same port number ``xxxx``. + +.. code-block:: console + + conda activate + jupyter notebook --port=xxxx --ip=127.0.0.1 + +You will see the links like below, + +.. code-block:: console + + To access the server, open this file in a browser: + file:///data/keeling/a//.local/share/jupyter/runtime/jpserver-44396-open.html + Or copy and paste one of these URLs: + http://127.0.0.1:7777/tree?token=1c188a2ddb454ee362005aa556b5cbe189f1012c85139b3a + http://127.0.0.1:7777/tree?token=1c188a2ddb454ee362005aa556b5cbe189f1012c85139b3a + +choose one and copy the link. + +Open an ``ipynb`` file in VS Code. You will see ``Select Kernel`` on the right top +of the window, click it and there will be a pop-up shows ``Existing Jupter Server``. +Click it and choose ``Enter the URL of the running Jupyter Server``, paste the aboved +link here. + +Press ``Enter`` and choose ``Python 3 (ipykernel)``. You will see previous +``Select Kernel`` is changed to ``Python 3 (ipykernel)``. + +Try running following command in a cell to check if it is working. + +.. code-block:: console + + !hostname + +The output should be the node name you are using. \ No newline at end of file