diff --git a/day3/0-welcome/0-day2-additions.ipynb b/day3/0-welcome/0-day2-additions.ipynb new file mode 100644 index 0000000000000000000000000000000000000000..ac717b5ef37ea8c2318bf66e6988b87c8f69904d --- /dev/null +++ b/day3/0-welcome/0-day2-additions.ipynb @@ -0,0 +1,235 @@ +{ + "cells": [ + { + "cell_type": "markdown", + "id": "lasting-priest", + "metadata": {}, + "source": [ + "### Additions to day 1\n", + "\n", + "---------------------------------------------" + ] + }, + { + "cell_type": "markdown", + "id": "fourth-horizon", + "metadata": {}, + "source": [ + "#### Exercise 1:\n", + "1. Mounting GPFS on HDF-Cloud" + ] + }, + { + "cell_type": "markdown", + "id": "second-metallic", + "metadata": {}, + "source": [ + "**ONLY FOR HDF-CLOUD** \n", + "**!!DANGEROUS!! YOU ARE MOUNTING WRITEABLE** \n", + "Mount the $HOMEs from GPFS on the HDF Cloud" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "pacific-complement", + "metadata": {}, + "outputs": [], + "source": [ + "import json\n", + "import os\n", + "from contextlib import closing\n", + "\n", + "import pyunicore.client as unicore_client\n", + "import requests" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "virgin-india", + "metadata": {}, + "outputs": [], + "source": [ + "def get_access_token():\n", + " remote_node = os.getenv(\"REMOTE_NODE\")\n", + " remote_hub_port = os.getenv(\"REMOTE_HUB_PORT\")\n", + " hub_api_url = f\"http://{remote_node}:{remote_hub_port}/hub/api/user\"\n", + " headers = {\"Authorization\": \"token {}\".format(os.getenv(\"JUPYTERHUB_API_TOKEN\"))}\n", + " with closing(requests.get(hub_api_url, headers=headers)) as r:\n", + " if r.status_code == 200:\n", + " resp = json.loads(r.content.decode(\"utf-8\"))\n", + " else:\n", + " raise Exception(\n", + " \"Could not receive access token: {} {}\".format(\n", + " r.status_code, r.content.decode(\"utf-8\")\n", + " )\n", + " )\n", + " # No HPC accounts -> no access token in this script\n", + " if (\n", + " \"auth_state\" in resp.keys()\n", + " and \"oauth_user\" in resp[\"auth_state\"].keys()\n", + " and \"hpc_infos_attribute\" in resp[\"auth_state\"][\"oauth_user\"]\n", + " and len(resp[\"auth_state\"][\"oauth_user\"][\"hpc_infos_attribute\"]) > 0\n", + " ):\n", + " return resp[\"auth_state\"][\"access_token\"]\n", + " else:\n", + " return None" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "sixth-topic", + "metadata": {}, + "outputs": [], + "source": [ + "def get_mount_command(access_token):\n", + " _auth = \"https://uftp.fz-juelich.de:9112/UFTP_Auth/rest/auth/\"\n", + " _tr = unicore_client.Transport(access_token)\n", + " _info = _tr.get(url=_auth)\n", + " _uid = _info[\"JUDAC\"][\"uid\"]\n", + " remote_base_dir = \"/p/home/jusers/%s\" % _uid\n", + "\n", + " # authenticate\n", + " _req = {\n", + " \"persistent\": \"true\",\n", + " \"serverPath\": \"%s/___UFTP___MULTI___FILE___SESSION___MODE___\" % remote_base_dir,\n", + " }\n", + " _reply = _tr.post(url=_auth + \"/JUDAC\", json=_req).json()\n", + " uftp_pwd = _reply[\"secret\"]\n", + " uftp_host = _reply[\"serverHost\"]\n", + " uftp_port = _reply[\"serverPort\"]\n", + " return f\"curlftpfs -s -o ro,uid=1094,gid=100,ftp_method=singlecwd,enable_epsv,user=anonymous:{uftp_pwd} {uftp_host}:{uftp_port}\"" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "streaming-affect", + "metadata": {}, + "outputs": [], + "source": [ + "if __name__ == \"__main__\":\n", + " access_token = get_access_token()\n", + " if not access_token:\n", + " exit(1)\n", + " mount_cmd = get_mount_command(access_token)\n", + " print(mount_cmd)" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "yellow-lloyd", + "metadata": {}, + "outputs": [], + "source": [ + "# mount\n", + "# (if you want to mount the GPFS, then change \"ro\" to \"rw\" in `mount_cmd` - DANGEROSE)\n", + "!mkdir -p uftp-mount\n", + "!$mount_cmd uftp-mount" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "romance-johnston", + "metadata": {}, + "outputs": [], + "source": [ + "# ...\n", + "!ls -l uftp-mount" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "cognitive-flush", + "metadata": {}, + "outputs": [], + "source": [ + "# unmount\n", + "!fusermount -u uftp-mount" + ] + }, + { + "cell_type": "markdown", + "id": "scheduled-composite", + "metadata": {}, + "source": [ + "#### Exercise 2:\n", + "1. Check the Tutorials in the Sidebar->Gitlab" + ] + }, + { + "cell_type": "markdown", + "id": "athletic-singapore", + "metadata": {}, + "source": [ + "#### Exercise 3:\n", + "1. Change Texteditor\n", + " - Menu:Settings -> Text Editor Keymap\n", + " - Menu:Settings -> Text Editor Theme\n", + "2. Menu:Settings -> Show Active File in Filebrowser" + ] + }, + { + "cell_type": "markdown", + "id": "horizontal-aviation", + "metadata": {}, + "source": [ + "#### Exercise 4:\n", + "1. Open an Jupyter-Notebook file with the JSON Editor" + ] + }, + { + "cell_type": "markdown", + "id": "weird-footage", + "metadata": {}, + "source": [ + "#### Exercise 5:\n", + "1. Check list of available Jupyer kernel: \n", + "https://github.com/jupyter/jupyter/wiki/Jupyter-kernels\n" + ] + }, + { + "cell_type": "markdown", + "id": "chronic-whole", + "metadata": {}, + "source": [ + "#### Exercise 6:\n", + " 1. Modify your running kernel without creating a special one." + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "vertical-border", + "metadata": {}, + "outputs": [], + "source": [] + } + ], + "metadata": { + "kernelspec": { + "display_name": "Python 3", + "language": "python", + "name": "python3" + }, + "language_info": { + "codemirror_mode": { + "name": "ipython", + "version": 3 + }, + "file_extension": ".py", + "mimetype": "text/x-python", + "name": "python", + "nbconvert_exporter": "python", + "pygments_lexer": "ipython3", + "version": "3.8.5" + } + }, + "nbformat": 4, + "nbformat_minor": 5 +} diff --git a/day3/0-welcome/PRACE-Wrkshp_interactive-hpc-with-jupyter_welcome_day3.pdf b/day3/0-welcome/PRACE-Wrkshp_interactive-hpc-with-jupyter_welcome_day3.pdf new file mode 100644 index 0000000000000000000000000000000000000000..b464fd7657bdba4fdfa3bca0956bb37eaf5c8732 Binary files /dev/null and b/day3/0-welcome/PRACE-Wrkshp_interactive-hpc-with-jupyter_welcome_day3.pdf differ diff --git a/day3/1-my-own-JupyterLab/1-switch-default-Jupyterlab.ipynb b/day3/1-my-own-JupyterLab/1-switch-default-Jupyterlab.ipynb new file mode 100644 index 0000000000000000000000000000000000000000..89453494fc1b214d9af69b173141bfe1f99cee50 --- /dev/null +++ b/day3/1-my-own-JupyterLab/1-switch-default-Jupyterlab.ipynb @@ -0,0 +1,85 @@ +{ + "cells": [ + { + "cell_type": "markdown", + "id": "stuffed-collapse", + "metadata": {}, + "source": [ + "### Switch the default JupyterLab installation\n", + "\n", + "---------------------------------------------" + ] + }, + { + "cell_type": "markdown", + "id": "spectacular-placement", + "metadata": {}, + "source": [ + "#### Exercise 1:\n", + "1. Open $JUPYTER_LOG_DIR/.start\n", + "2. Check for call of optional start-script\n", + "3. Create own start-script\n", + " - `$HOME/.jupyter/start_jupyter-jsc.sh`" + ] + }, + { + "cell_type": "markdown", + "id": "successful-intranet", + "metadata": {}, + "source": [ + "```bash\n", + "module purge\n", + "module use $OTHERSTAGES\n", + "module load Stages/Devel-2020\n", + "module load GCCcore/.9.3.0\n", + "module load JupyterCollection/2020.2.5\n", + "```" + ] + }, + { + "cell_type": "markdown", + "id": "civil-stupid", + "metadata": {}, + "source": [ + "Starting a JupyterLab through Jupyter-JSC now on the cluster using this $HOME \n", + "- will now source `$HOME/.jupyter/start_jupyter-jsc.sh` before it calls `jupyter lab --no-browser`\n", + "- and therefore will now use `JupyterCollection/2020.2.5`." + ] + }, + { + "cell_type": "markdown", + "id": "extra-tooth", + "metadata": {}, + "source": [ + "#### Exercise 2:\n", + " 1. Check `which jupyter`\n", + " 2. Check the jupyter installation\n", + " - `cd $EBROOTJUPYTERCOLLECTION/easybuild/`\n", + " - `vim JupyterCollection-2020.2.5-gcccoremkl-9.3.0-2020.2.254.eb`\n", + " 3. Check the easybuild files of our Jupyter module on Github:\n", + " - https://github.com/easybuilders/JSC/tree/2020/Golden_Repo/j" + ] + } + ], + "metadata": { + "kernelspec": { + "display_name": "Python 3", + "language": "python", + "name": "python3" + }, + "language_info": { + "codemirror_mode": { + "name": "ipython", + "version": 3 + }, + "file_extension": ".py", + "mimetype": "text/x-python", + "name": "python", + "nbconvert_exporter": "python", + "pygments_lexer": "ipython3", + "version": "3.8.5" + } + }, + "nbformat": 4, + "nbformat_minor": 5 +} diff --git a/day3/1-my-own-JupyterLab/2-JupyterLab-from-condaforge.ipynb b/day3/1-my-own-JupyterLab/2-JupyterLab-from-condaforge.ipynb new file mode 100644 index 0000000000000000000000000000000000000000..d479358c1fcb3f6cb237d0ff57828abd49a25aef --- /dev/null +++ b/day3/1-my-own-JupyterLab/2-JupyterLab-from-condaforge.ipynb @@ -0,0 +1,800 @@ +{ + "cells": [ + { + "cell_type": "markdown", + "id": "adopted-characterization", + "metadata": {}, + "source": [ + "### Install your own JupyterLab from conda\n", + "\n", + "---------------------------------------------" + ] + }, + { + "cell_type": "markdown", + "id": "extended-response", + "metadata": {}, + "source": [ + "### Prepare Conda Settings" + ] + }, + { + "cell_type": "markdown", + "id": "alternative-paris", + "metadata": {}, + "source": [ + "Selectable **CONDA_TARGET_DIR** path for the central conda installation, should be in the project filesystem" + ] + }, + { + "cell_type": "code", + "execution_count": 1, + "id": "streaming-commissioner", + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "/p/project/training2109/goebbert1/miniconda3\n" + ] + } + ], + "source": [ + "export CONDA_TARGET_DIR=${PROJECT}/${USER}/miniconda3 ## ${HOME}/miniconda3\n", + "echo $CONDA_TARGET_DIR # double check" + ] + }, + { + "cell_type": "markdown", + "id": "operating-soviet", + "metadata": {}, + "source": [ + "Selectable **CONDA_ENV** name, will be used to specify the environment name\n", + " - must be lowercase" + ] + }, + { + "cell_type": "code", + "execution_count": 2, + "id": "related-sessions", + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "my_jupyterlab3\n" + ] + } + ], + "source": [ + "CONDA_ENV=my_jupyterlab3\n", + "\n", + "export CONDA_ENV=$(echo \"${CONDA_ENV}\" | awk '{print tolower($0)}')\n", + "echo ${CONDA_ENV} # double check" + ] + }, + { + "cell_type": "markdown", + "id": "olive-table", + "metadata": {}, + "source": [ + "---\n", + "## 1. Download/Install Miniconda" + ] + }, + { + "cell_type": "markdown", + "id": "confidential-pharmacy", + "metadata": {}, + "source": [ + "Start here if you want to run the full installation.\n", + "If you want to create another environment in an existing conda setup go to **create environment**. If you want to attach yourself to an existing environment go to **create user kernel**." + ] + }, + { + "cell_type": "markdown", + "id": "composed-spending", + "metadata": {}, + "source": [ + "* 1.1 - Download Minconda installer" + ] + }, + { + "cell_type": "code", + "execution_count": 7, + "id": "adapted-constraint", + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "--2021-04-21 21:38:36-- https://repo.continuum.io/miniconda/Miniconda3-latest-Linux-x86_64.sh\n", + "Resolving repo.continuum.io (repo.continuum.io)... 104.18.201.79, 104.18.200.79, 2606:4700::6812:c84f, ...\n", + "Connecting to repo.continuum.io (repo.continuum.io)|104.18.201.79|:443... connected.\n", + "HTTP request sent, awaiting response... 301 Moved Permanently\n", + "Location: https://repo.anaconda.com/miniconda/Miniconda3-latest-Linux-x86_64.sh [following]\n", + "--2021-04-21 21:38:36-- https://repo.anaconda.com/miniconda/Miniconda3-latest-Linux-x86_64.sh\n", + "Resolving repo.anaconda.com (repo.anaconda.com)... 104.16.130.3, 104.16.131.3, 2606:4700::6810:8303, ...\n", + "Connecting to repo.anaconda.com (repo.anaconda.com)|104.16.130.3|:443... connected.\n", + "HTTP request sent, awaiting response... 200 OK\n", + "Length: 94235922 (90M) [application/x-sh]\n", + "Saving to: ‘/p/project/ccstvs/goebbert1/home_juwels/Miniconda3.sh’\n", + "\n", + "/p/project/ccstvs/g 100%[===================>] 89.87M 70.1MB/s in 1.3s \n", + "\n", + "2021-04-21 21:38:38 (70.1 MB/s) - ‘/p/project/ccstvs/goebbert1/home_juwels/Miniconda3.sh’ saved [94235922/94235922]\n", + "\n" + ] + } + ], + "source": [ + "wget --output-document=$HOME/Miniconda3.sh https://repo.continuum.io/miniconda/Miniconda3-latest-Linux-x86_64.sh" + ] + }, + { + "cell_type": "markdown", + "id": "substantial-provider", + "metadata": {}, + "source": [ + "* 1.2 - Create target directory" + ] + }, + { + "cell_type": "code", + "execution_count": 9, + "id": "secret-maker", + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "/p/project/training2109/goebbert1/miniconda3\n" + ] + } + ], + "source": [ + "mkdir -p ${CONDA_TARGET_DIR}\n", + "echo $CONDA_TARGET_DIR # double check" + ] + }, + { + "cell_type": "markdown", + "id": "streaming-shopping", + "metadata": {}, + "source": [ + "* 1.3 - Install Miniconda" + ] + }, + { + "cell_type": "code", + "execution_count": 10, + "id": "characteristic-woman", + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "PREFIX=/p/project/training2109/goebbert1/miniconda3\n", + "Unpacking payload ...\n", + "Collecting package metadata (current_repodata.json): done \n", + "Solving environment: done\n", + "\n", + "## Package Plan ##\n", + "\n", + " environment location: /p/project/training2109/goebbert1/miniconda3\n", + "\n", + " added / updated specs:\n", + " - _libgcc_mutex==0.1=main\n", + " - brotlipy==0.7.0=py38h27cfd23_1003\n", + " - ca-certificates==2020.10.14=0\n", + " - certifi==2020.6.20=pyhd3eb1b0_3\n", + " - cffi==1.14.3=py38h261ae71_2\n", + " - chardet==3.0.4=py38h06a4308_1003\n", + " - conda-package-handling==1.7.2=py38h03888b9_0\n", + " - conda==4.9.2=py38h06a4308_0\n", + " - cryptography==3.2.1=py38h3c74f83_1\n", + " - idna==2.10=py_0\n", + " - ld_impl_linux-64==2.33.1=h53a641e_7\n", + " - libedit==3.1.20191231=h14c3975_1\n", + " - libffi==3.3=he6710b0_2\n", + " - libgcc-ng==9.1.0=hdf63c60_0\n", + " - libstdcxx-ng==9.1.0=hdf63c60_0\n", + " - ncurses==6.2=he6710b0_1\n", + " - openssl==1.1.1h=h7b6447c_0\n", + " - pip==20.2.4=py38h06a4308_0\n", + " - pycosat==0.6.3=py38h7b6447c_1\n", + " - pycparser==2.20=py_2\n", + " - pyopenssl==19.1.0=pyhd3eb1b0_1\n", + " - pysocks==1.7.1=py38h06a4308_0\n", + " - python==3.8.5=h7579374_1\n", + " - readline==8.0=h7b6447c_0\n", + " - requests==2.24.0=py_0\n", + " - ruamel_yaml==0.15.87=py38h7b6447c_1\n", + " - setuptools==50.3.1=py38h06a4308_1\n", + " - six==1.15.0=py38h06a4308_0\n", + " - sqlite==3.33.0=h62c20be_0\n", + " - tk==8.6.10=hbc83047_0\n", + " - tqdm==4.51.0=pyhd3eb1b0_0\n", + " - urllib3==1.25.11=py_0\n", + " - wheel==0.35.1=pyhd3eb1b0_0\n", + " - xz==5.2.5=h7b6447c_0\n", + " - yaml==0.2.5=h7b6447c_0\n", + " - zlib==1.2.11=h7b6447c_3\n", + "\n", + "\n", + "The following NEW packages will be INSTALLED:\n", + "\n", + " _libgcc_mutex pkgs/main/linux-64::_libgcc_mutex-0.1-main\n", + " brotlipy pkgs/main/linux-64::brotlipy-0.7.0-py38h27cfd23_1003\n", + " ca-certificates pkgs/main/linux-64::ca-certificates-2020.10.14-0\n", + " certifi pkgs/main/noarch::certifi-2020.6.20-pyhd3eb1b0_3\n", + " cffi pkgs/main/linux-64::cffi-1.14.3-py38h261ae71_2\n", + " chardet pkgs/main/linux-64::chardet-3.0.4-py38h06a4308_1003\n", + " conda pkgs/main/linux-64::conda-4.9.2-py38h06a4308_0\n", + " conda-package-han~ pkgs/main/linux-64::conda-package-handling-1.7.2-py38h03888b9_0\n", + " cryptography pkgs/main/linux-64::cryptography-3.2.1-py38h3c74f83_1\n", + " idna pkgs/main/noarch::idna-2.10-py_0\n", + " ld_impl_linux-64 pkgs/main/linux-64::ld_impl_linux-64-2.33.1-h53a641e_7\n", + " libedit pkgs/main/linux-64::libedit-3.1.20191231-h14c3975_1\n", + " libffi pkgs/main/linux-64::libffi-3.3-he6710b0_2\n", + " libgcc-ng pkgs/main/linux-64::libgcc-ng-9.1.0-hdf63c60_0\n", + " libstdcxx-ng pkgs/main/linux-64::libstdcxx-ng-9.1.0-hdf63c60_0\n", + " ncurses pkgs/main/linux-64::ncurses-6.2-he6710b0_1\n", + " openssl pkgs/main/linux-64::openssl-1.1.1h-h7b6447c_0\n", + " pip pkgs/main/linux-64::pip-20.2.4-py38h06a4308_0\n", + " pycosat pkgs/main/linux-64::pycosat-0.6.3-py38h7b6447c_1\n", + " pycparser pkgs/main/noarch::pycparser-2.20-py_2\n", + " pyopenssl pkgs/main/noarch::pyopenssl-19.1.0-pyhd3eb1b0_1\n", + " pysocks pkgs/main/linux-64::pysocks-1.7.1-py38h06a4308_0\n", + " python pkgs/main/linux-64::python-3.8.5-h7579374_1\n", + " readline pkgs/main/linux-64::readline-8.0-h7b6447c_0\n", + " requests pkgs/main/noarch::requests-2.24.0-py_0\n", + " ruamel_yaml pkgs/main/linux-64::ruamel_yaml-0.15.87-py38h7b6447c_1\n", + " setuptools pkgs/main/linux-64::setuptools-50.3.1-py38h06a4308_1\n", + " six pkgs/main/linux-64::six-1.15.0-py38h06a4308_0\n", + " sqlite pkgs/main/linux-64::sqlite-3.33.0-h62c20be_0\n", + " tk pkgs/main/linux-64::tk-8.6.10-hbc83047_0\n", + " tqdm pkgs/main/noarch::tqdm-4.51.0-pyhd3eb1b0_0\n", + " urllib3 pkgs/main/noarch::urllib3-1.25.11-py_0\n", + " wheel pkgs/main/noarch::wheel-0.35.1-pyhd3eb1b0_0\n", + " xz pkgs/main/linux-64::xz-5.2.5-h7b6447c_0\n", + " yaml pkgs/main/linux-64::yaml-0.2.5-h7b6447c_0\n", + " zlib pkgs/main/linux-64::zlib-1.2.11-h7b6447c_3\n", + "\n", + "\n", + "Preparing transaction: done\n", + "Executing transaction: done\n", + "installation finished.\n", + "WARNING:\n", + " You currently have a PYTHONPATH environment variable set. This may cause\n", + " unexpected behavior when running the Python interpreter in Miniconda3.\n", + " For best results, please verify that your PYTHONPATH only points to\n", + " directories of packages that are compatible with the Python interpreter\n", + " in Miniconda3: /p/project/training2109/goebbert1/miniconda3\n" + ] + } + ], + "source": [ + "bash $HOME/Miniconda3.sh -b -u -p ${CONDA_TARGET_DIR}" + ] + }, + { + "cell_type": "code", + "execution_count": 3, + "id": "intellectual-pipeline", + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "/p/software/juwels/stages/Devel-2020/software/JupyterKernel-XPython/0.9.5-gcccoremkl-9.3.0-2020.2.254-2020.2.6/lib/python3.8/site-packages:/p/software/juwels/stages/Devel-2020/software/JupyterKernel-XPython/0.9.5-gcccoremkl-9.3.0-2020.2.254-2020.2.6/lib/python3.8/site-packages:/p/software/juwels/stages/Devel-2020/software/pybind11/2.6.2-GCCcore-9.3.0-Python-3.8.5/lib/python3.8/site-packages:/p/software/juwels/stages/Devel-2020/software/JupyterKernel-Octave/6.1.0-gcccoremkl-9.3.0-2020.2.254-2020.2.6/lib/python3.8/site-packages:/p/software/juwels/stages/Devel-2020/software/JupyterKernel-Julia/1.5.2-gcccoremkl-9.3.0-2020.2.254-2020.2.6/lib/python3.8/site-packages:/p/software/juwels/stages/Devel-2020/software/JupyterKernel-Cling/0.7-gcccoremkl-9.3.0-2020.2.254-2020.2.6/lib/python3.8/site-packages:/p/software/juwels/stages/Devel-2020/software/JupyterKernel-Bash/0.7.1-gcccoremkl-9.3.0-2020.2.254-2020.2.6/lib/python3.8/site-packages:/p/software/juwels/stages/Devel-2020/software/JupyterProxy-XpraHTML5/0.3.0-gcccoremkl-9.3.0-2020.2.254-2020.2.6/lib/python3.8/site-packages:/p/software/juwels/stages/Devel-2020/software/JupyterProxy-XpraHTML5/0.3.0-gcccoremkl-9.3.0-2020.2.254-2020.2.6/lib/python3.8/site-packages:/p/software/juwels/stages/Devel-2020/software/Jupyter/2020.2.6-gcccoremkl-9.3.0-2020.2.254-Python-3.8.5/lib/python3.8/site-packages:/p/software/juwels/stages/Devel-2020/software/Shapely/1.7.1-GCCcore-9.3.0-Python-3.8.5/lib/python3.8/site-packages:/p/software/juwels/stages/Devel-2020/software/GEOS/3.8.1-GCCcore-9.3.0-Python-3.8.5/lib/python3.8/site-packages:/p/software/juwels/stages/Devel-2020/software/numba/0.51.1-gcccoremkl-9.3.0-2020.2.254-Python-3.8.5/lib/python3.8/site-packages:/p/software/juwels/stages/Devel-2020/software/numba/0.51.1-gcccoremkl-9.3.0-2020.2.254-Python-3.8.5/lib/python3.8/site-packages:/p/software/juwels/stages/Devel-2020/software/numba/0.51.1-gcccoremkl-9.3.0-2020.2.254-Python-3.8.5/lib/python3.8/site-packages:/p/software/juwels/stages/Devel-2020/software/scikit/2020-gcccoremkl-9.3.0-2020.2.254-Python-3.8.5/lib/python3.8/site-packages:/p/software/juwels/stages/Devel-2020/software/dask/2.22.0-gcccoremkl-9.3.0-2020.2.254-Python-3.8.5/lib/python3.8/site-packages:/p/software/juwels/stages/Devel-2020/software/netcdf4-python/1.5.4-GCCcore-9.3.0-serial-Python-3.8.5/lib/python3.8/site-packages:/p/software/juwels/stages/Devel-2020/software/netcdf4-python/1.5.4-GCCcore-9.3.0-serial-Python-3.8.5/lib/python3.8/site-packages:/p/software/juwels/stages/Devel-2020/software/h5py/2.10.0-GCCcore-9.3.0-serial-Python-3.8.5/lib/python3.8/site-packages:/p/software/juwels/stages/Devel-2020/software/SciPy-Stack/2020-gcccoremkl-9.3.0-2020.2.254-Python-3.8.5/lib/python3.8/site-packages:/p/software/juwels/stages/Devel-2020/software/ITK/5.1.2-GCCcore-9.3.0-nompi-Python-3.8.5/lib/python3.8/site-packages:/p/software/juwels/stages/Devel-2020/software/Python/3.8.5-GCCcore-9.3.0/easybuild/python:/p/software/juwels/stages/Devel-2020/software/Python/3.8.5-GCCcore-9.3.0/lib/python3.8/site-packages\n" + ] + } + ], + "source": [ + "# verify that PYTHONPATH only points to directories of packages\n", + "# that are compatible with the Python interpreter in Miniconda3\n", + "echo $PYTHONPATH" + ] + }, + { + "cell_type": "code", + "execution_count": 4, + "id": "boring-tokyo", + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "\n" + ] + } + ], + "source": [ + "# for now we unset the PYTHONPATH\n", + "# if you want to use modules with conda, you might need to think about this step again\n", + "unset PYTHONPATH\n", + "echo $PYTHONPATH" + ] + }, + { + "cell_type": "code", + "execution_count": 12, + "id": "defensive-retail", + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "no change /p/project/training2109/goebbert1/miniconda3/condabin/conda\n", + "no change /p/project/training2109/goebbert1/miniconda3/bin/conda\n", + "no change /p/project/training2109/goebbert1/miniconda3/bin/conda-env\n", + "no change /p/project/training2109/goebbert1/miniconda3/bin/activate\n", + "no change /p/project/training2109/goebbert1/miniconda3/bin/deactivate\n", + "no change /p/project/training2109/goebbert1/miniconda3/etc/profile.d/conda.sh\n", + "no change /p/project/training2109/goebbert1/miniconda3/etc/fish/conf.d/conda.fish\n", + "no change /p/project/training2109/goebbert1/miniconda3/shell/condabin/Conda.psm1\n", + "no change /p/project/training2109/goebbert1/miniconda3/shell/condabin/conda-hook.ps1\n", + "no change /p/project/training2109/goebbert1/miniconda3/lib/python3.8/site-packages/xontrib/conda.xsh\n", + "no change /p/project/training2109/goebbert1/miniconda3/etc/profile.d/conda.csh\n", + "modified /p/project/ccstvs/goebbert1/home_juwels/.bashrc\n", + "\n", + "==> For changes to take effect, close and re-open your current shell. <==\n", + "\n" + ] + } + ], + "source": [ + "${CONDA_TARGET_DIR}/bin/conda init bash" + ] + }, + { + "cell_type": "markdown", + "id": "furnished-infrared", + "metadata": {}, + "source": [ + "**ATTENTION:** Conda modifies $HOME/.bashrc\n", + "\n", + "```bash\n", + "# >>> conda initialize >>>\n", + "# !! Contents within this block are managed by 'conda init' !!\n", + "__conda_setup=\"$('/home/jovyan/miniconda3/bin/conda' 'shell.bash' 'hook' 2> /dev/null)\"\n", + "if [ $? -eq 0 ]; then\n", + " eval \"$__conda_setup\"\n", + "else\n", + " if [ -f \"/home/jovyan/miniconda3/etc/profile.d/conda.sh\" ]; then\n", + " . \"/home/jovyan/miniconda3/etc/profile.d/conda.sh\"\n", + " else\n", + " export PATH=\"/home/jovyan/miniconda3/bin:$PATH\"\n", + " fi\n", + "fi\n", + "unset __conda_setup\n", + "# <<< conda initialize <<<\n", + "```" + ] + }, + { + "cell_type": "markdown", + "id": "textile-vacation", + "metadata": {}, + "source": [ + "* 1.4 - Disable automatic activation" + ] + }, + { + "cell_type": "code", + "execution_count": 13, + "id": "proved-version", + "metadata": {}, + "outputs": [], + "source": [ + "${CONDA_TARGET_DIR}/bin/conda config --set auto_activate_base false" + ] + }, + { + "cell_type": "markdown", + "id": "surprised-carolina", + "metadata": {}, + "source": [ + "---\n", + "## 2. Create conda environment with JupyterLab 3 installed" + ] + }, + { + "cell_type": "markdown", + "id": "offensive-crack", + "metadata": {}, + "source": [ + "Create new conda environment. The following steps can be repeated if multiple environments should be created. If the Python version differ towards the external Python version, a mix of Conda modules and external modules will not be possible" + ] + }, + { + "cell_type": "code", + "execution_count": 5, + "id": "central-rebecca", + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Collecting package metadata (current_repodata.json): done\n", + "Solving environment: done\n", + "\n", + "## Package Plan ##\n", + "\n", + " environment location: /p/project/training2109/goebbert1/miniconda3/envs/my_jupyterlab3\n", + "\n", + " added / updated specs:\n", + " - ipywidgets\n", + " - jupyterlab=3\n", + " - matplotlib\n", + " - nodejs\n", + " - pandas=0.24\n", + " - pip\n", + " - xeus-python\n", + "\n", + "\n", + "The following packages will be downloaded:\n", + "\n", + " package | build\n", + " ---------------------------|-----------------\n", + " debugpy-1.2.1 | py38h709712a_1 1.9 MB conda-forge\n", + " xeus-1.0.1 | h7d0c39e_2 939 KB conda-forge\n", + " xeus-python-0.12.3 | py38h56bed4f_0 799 KB conda-forge\n", + " ------------------------------------------------------------\n", + " Total: 3.6 MB\n", + "\n", + "The following NEW packages will be INSTALLED:\n", + "\n", + " _libgcc_mutex conda-forge/linux-64::_libgcc_mutex-0.1-conda_forge\n", + " _openmp_mutex conda-forge/linux-64::_openmp_mutex-4.5-1_gnu\n", + " anyio conda-forge/linux-64::anyio-2.2.0-py38h578d9bd_0\n", + " argon2-cffi conda-forge/linux-64::argon2-cffi-20.1.0-py38h497a2fe_2\n", + " async_generator conda-forge/noarch::async_generator-1.10-py_0\n", + " attrs conda-forge/noarch::attrs-20.3.0-pyhd3deb0d_0\n", + " babel conda-forge/noarch::babel-2.9.0-pyhd3deb0d_0\n", + " backcall conda-forge/noarch::backcall-0.2.0-pyh9f0ad1d_0\n", + " backports conda-forge/noarch::backports-1.0-py_2\n", + " backports.functoo~ conda-forge/noarch::backports.functools_lru_cache-1.6.4-pyhd8ed1ab_0\n", + " bleach conda-forge/noarch::bleach-3.3.0-pyh44b312d_0\n", + " brotlipy conda-forge/linux-64::brotlipy-0.7.0-py38h497a2fe_1001\n", + " ca-certificates conda-forge/linux-64::ca-certificates-2020.12.5-ha878542_0\n", + " certifi conda-forge/linux-64::certifi-2020.12.5-py38h578d9bd_1\n", + " cffi conda-forge/linux-64::cffi-1.14.5-py38ha65f79e_0\n", + " chardet conda-forge/linux-64::chardet-4.0.0-py38h578d9bd_1\n", + " cryptography conda-forge/linux-64::cryptography-3.4.7-py38ha5dfef3_0\n", + " cycler conda-forge/noarch::cycler-0.10.0-py_2\n", + " dbus conda-forge/linux-64::dbus-1.13.6-h48d8840_2\n", + " debugpy conda-forge/linux-64::debugpy-1.2.1-py38h709712a_1\n", + " decorator conda-forge/noarch::decorator-5.0.7-pyhd8ed1ab_0\n", + " defusedxml conda-forge/noarch::defusedxml-0.7.1-pyhd8ed1ab_0\n", + " deprecation conda-forge/noarch::deprecation-2.1.0-pyh9f0ad1d_0\n", + " entrypoints conda-forge/noarch::entrypoints-0.3-pyhd8ed1ab_1003\n", + " expat conda-forge/linux-64::expat-2.3.0-h9c3ff4c_0\n", + " fontconfig conda-forge/linux-64::fontconfig-2.13.1-hba837de_1005\n", + " freetype conda-forge/linux-64::freetype-2.10.4-h0708190_1\n", + " gettext conda-forge/linux-64::gettext-0.19.8.1-h0b5b191_1005\n", + " glib conda-forge/linux-64::glib-2.68.1-h9c3ff4c_0\n", + " glib-tools conda-forge/linux-64::glib-tools-2.68.1-h9c3ff4c_0\n", + " gst-plugins-base conda-forge/linux-64::gst-plugins-base-1.18.4-h29181c9_0\n", + " gstreamer conda-forge/linux-64::gstreamer-1.18.4-h76c114f_0\n", + " icu conda-forge/linux-64::icu-68.1-h58526e2_0\n", + " idna conda-forge/noarch::idna-2.10-pyh9f0ad1d_0\n", + " importlib-metadata conda-forge/linux-64::importlib-metadata-4.0.1-py38h578d9bd_0\n", + " ipykernel conda-forge/linux-64::ipykernel-5.5.3-py38hd0cf306_0\n", + " ipython conda-forge/linux-64::ipython-7.22.0-py38hd0cf306_0\n", + " ipython_genutils conda-forge/noarch::ipython_genutils-0.2.0-py_1\n", + " ipywidgets conda-forge/noarch::ipywidgets-7.6.3-pyhd3deb0d_0\n", + " jedi conda-forge/linux-64::jedi-0.18.0-py38h578d9bd_2\n", + " jinja2 conda-forge/noarch::jinja2-2.11.3-pyh44b312d_0\n", + " jpeg conda-forge/linux-64::jpeg-9d-h36c2ea0_0\n", + " json5 conda-forge/noarch::json5-0.9.5-pyh9f0ad1d_0\n", + " jsonschema conda-forge/noarch::jsonschema-3.2.0-pyhd8ed1ab_3\n", + " jupyter-packaging conda-forge/noarch::jupyter-packaging-0.9.2-pyhd8ed1ab_0\n", + " jupyter_client conda-forge/noarch::jupyter_client-6.1.12-pyhd8ed1ab_0\n", + " jupyter_core conda-forge/linux-64::jupyter_core-4.7.1-py38h578d9bd_0\n", + " jupyter_server conda-forge/linux-64::jupyter_server-1.6.2-py38h578d9bd_0\n", + " jupyterlab conda-forge/noarch::jupyterlab-3.0.14-pyhd8ed1ab_0\n", + " jupyterlab_pygmen~ conda-forge/noarch::jupyterlab_pygments-0.1.2-pyh9f0ad1d_0\n", + " jupyterlab_server conda-forge/noarch::jupyterlab_server-2.4.0-pyhd8ed1ab_0\n", + " jupyterlab_widgets conda-forge/noarch::jupyterlab_widgets-1.0.0-pyhd8ed1ab_1\n", + " kiwisolver conda-forge/linux-64::kiwisolver-1.3.1-py38h1fd1430_1\n", + " krb5 conda-forge/linux-64::krb5-1.17.2-h926e7f8_0\n", + " lcms2 conda-forge/linux-64::lcms2-2.12-hddcbb42_0\n", + " ld_impl_linux-64 conda-forge/linux-64::ld_impl_linux-64-2.35.1-hea4e1c9_2\n", + " libblas conda-forge/linux-64::libblas-3.9.0-8_openblas\n", + " libcblas conda-forge/linux-64::libcblas-3.9.0-8_openblas\n", + " libclang conda-forge/linux-64::libclang-11.1.0-default_ha53f305_0\n", + " libedit conda-forge/linux-64::libedit-3.1.20191231-he28a2e2_2\n", + " libevent conda-forge/linux-64::libevent-2.1.10-hcdb4288_3\n", + " libffi conda-forge/linux-64::libffi-3.3-h58526e2_2\n", + " libgcc-ng conda-forge/linux-64::libgcc-ng-9.3.0-h2828fa1_19\n", + " libgfortran-ng conda-forge/linux-64::libgfortran-ng-9.3.0-hff62375_19\n", + " libgfortran5 conda-forge/linux-64::libgfortran5-9.3.0-hff62375_19\n", + " libglib conda-forge/linux-64::libglib-2.68.1-h3e27bee_0\n", + " libgomp conda-forge/linux-64::libgomp-9.3.0-h2828fa1_19\n", + " libiconv conda-forge/linux-64::libiconv-1.16-h516909a_0\n", + " liblapack conda-forge/linux-64::liblapack-3.9.0-8_openblas\n", + " libllvm11 conda-forge/linux-64::libllvm11-11.1.0-hf817b99_2\n", + " libopenblas conda-forge/linux-64::libopenblas-0.3.12-pthreads_h4812303_1\n", + " libpng conda-forge/linux-64::libpng-1.6.37-h21135ba_2\n", + " libpq conda-forge/linux-64::libpq-13.1-hfd2b0eb_2\n", + " libsodium conda-forge/linux-64::libsodium-1.0.18-h36c2ea0_1\n", + " libstdcxx-ng conda-forge/linux-64::libstdcxx-ng-9.3.0-h6de172a_19\n", + " libtiff conda-forge/linux-64::libtiff-4.2.0-hdc55705_0\n", + " libuuid conda-forge/linux-64::libuuid-2.32.1-h7f98852_1000\n", + " libuv conda-forge/linux-64::libuv-1.41.0-h7f98852_0\n", + " libwebp-base conda-forge/linux-64::libwebp-base-1.2.0-h7f98852_2\n", + " libxcb conda-forge/linux-64::libxcb-1.13-h7f98852_1003\n", + " libxkbcommon conda-forge/linux-64::libxkbcommon-1.0.3-he3ba5ed_0\n", + " libxml2 conda-forge/linux-64::libxml2-2.9.10-h72842e0_4\n", + " lz4-c conda-forge/linux-64::lz4-c-1.9.3-h9c3ff4c_0\n", + " markupsafe conda-forge/linux-64::markupsafe-1.1.1-py38h497a2fe_3\n", + " matplotlib conda-forge/linux-64::matplotlib-3.4.1-py38h578d9bd_0\n", + " matplotlib-base conda-forge/linux-64::matplotlib-base-3.4.1-py38hcc49a3a_0\n", + " mistune conda-forge/linux-64::mistune-0.8.4-py38h497a2fe_1003\n", + " mysql-common conda-forge/linux-64::mysql-common-8.0.23-ha770c72_1\n", + " mysql-libs conda-forge/linux-64::mysql-libs-8.0.23-h935591d_1\n", + " nbclassic conda-forge/noarch::nbclassic-0.2.7-pyhd8ed1ab_0\n", + " nbclient conda-forge/noarch::nbclient-0.5.3-pyhd8ed1ab_0\n", + " nbconvert conda-forge/linux-64::nbconvert-6.0.7-py38h578d9bd_3\n", + " nbformat conda-forge/noarch::nbformat-5.1.3-pyhd8ed1ab_0\n", + " ncurses conda-forge/linux-64::ncurses-6.2-h58526e2_4\n", + " nest-asyncio conda-forge/noarch::nest-asyncio-1.5.1-pyhd8ed1ab_0\n", + " nodejs conda-forge/linux-64::nodejs-15.14.0-h92b4a50_0\n", + " notebook conda-forge/noarch::notebook-6.3.0-pyha770c72_1\n", + " nspr conda-forge/linux-64::nspr-4.30-h9c3ff4c_0\n", + " nss conda-forge/linux-64::nss-3.64-hb5efdd6_0\n", + " numpy conda-forge/linux-64::numpy-1.20.2-py38h9894fe3_0\n", + " olefile conda-forge/noarch::olefile-0.46-pyh9f0ad1d_1\n", + " openjpeg conda-forge/linux-64::openjpeg-2.4.0-hf7af979_0\n", + " openssl conda-forge/linux-64::openssl-1.1.1k-h7f98852_0\n", + " packaging conda-forge/noarch::packaging-20.9-pyh44b312d_0\n", + " pandas conda-forge/linux-64::pandas-0.24.2-py38hb3f55d8_1\n", + " pandoc conda-forge/linux-64::pandoc-2.12-h7f98852_0\n", + " pandocfilters conda-forge/noarch::pandocfilters-1.4.2-py_1\n", + " parso conda-forge/noarch::parso-0.8.2-pyhd8ed1ab_0\n", + " pcre conda-forge/linux-64::pcre-8.44-he1b5a44_0\n", + " pexpect conda-forge/noarch::pexpect-4.8.0-pyh9f0ad1d_2\n", + " pickleshare conda-forge/noarch::pickleshare-0.7.5-py_1003\n", + " pillow conda-forge/linux-64::pillow-8.1.2-py38ha0e1e83_1\n", + " pip conda-forge/noarch::pip-21.0.1-pyhd8ed1ab_0\n", + " prometheus_client conda-forge/noarch::prometheus_client-0.10.1-pyhd8ed1ab_0\n", + " prompt-toolkit conda-forge/noarch::prompt-toolkit-3.0.18-pyha770c72_0\n", + " pthread-stubs conda-forge/linux-64::pthread-stubs-0.4-h36c2ea0_1001\n", + " ptyprocess conda-forge/noarch::ptyprocess-0.7.0-pyhd3deb0d_0\n", + " pycparser conda-forge/noarch::pycparser-2.20-pyh9f0ad1d_2\n", + " pygments conda-forge/noarch::pygments-2.8.1-pyhd8ed1ab_0\n", + " pyopenssl conda-forge/noarch::pyopenssl-20.0.1-pyhd8ed1ab_0\n", + " pyparsing conda-forge/noarch::pyparsing-2.4.7-pyh9f0ad1d_0\n", + " pyqt conda-forge/linux-64::pyqt-5.12.3-py38h578d9bd_7\n", + " pyqt-impl conda-forge/linux-64::pyqt-impl-5.12.3-py38h7400c14_7\n", + " pyqt5-sip conda-forge/linux-64::pyqt5-sip-4.19.18-py38h709712a_7\n", + " pyqtchart conda-forge/linux-64::pyqtchart-5.12-py38h7400c14_7\n", + " pyqtwebengine conda-forge/linux-64::pyqtwebengine-5.12.1-py38h7400c14_7\n", + " pyrsistent conda-forge/linux-64::pyrsistent-0.17.3-py38h497a2fe_2\n", + " pysocks conda-forge/linux-64::pysocks-1.7.1-py38h578d9bd_3\n", + " python conda-forge/linux-64::python-3.8.8-hffdb5ce_0_cpython\n", + " python-dateutil conda-forge/noarch::python-dateutil-2.8.1-py_0\n", + " python_abi conda-forge/linux-64::python_abi-3.8-1_cp38\n", + " pytz conda-forge/noarch::pytz-2021.1-pyhd8ed1ab_0\n", + " pyzmq conda-forge/linux-64::pyzmq-22.0.3-py38h2035c66_1\n", + " qt conda-forge/linux-64::qt-5.12.9-hda022c4_4\n", + " readline conda-forge/linux-64::readline-8.1-h46c0cb4_0\n", + " requests conda-forge/noarch::requests-2.25.1-pyhd3deb0d_0\n", + " send2trash conda-forge/noarch::send2trash-1.5.0-py_0\n", + " setuptools conda-forge/linux-64::setuptools-49.6.0-py38h578d9bd_3\n", + " six conda-forge/noarch::six-1.15.0-pyh9f0ad1d_0\n", + " sniffio conda-forge/linux-64::sniffio-1.2.0-py38h578d9bd_1\n", + " sqlite conda-forge/linux-64::sqlite-3.35.4-h74cdb3f_0\n", + " terminado conda-forge/linux-64::terminado-0.9.4-py38h578d9bd_0\n", + " testpath conda-forge/noarch::testpath-0.4.4-py_0\n", + " tk conda-forge/linux-64::tk-8.6.10-h21135ba_1\n", + " tomlkit conda-forge/linux-64::tomlkit-0.7.0-py38h578d9bd_3\n", + " tornado conda-forge/linux-64::tornado-6.1-py38h497a2fe_1\n", + " traitlets conda-forge/noarch::traitlets-5.0.5-py_0\n", + " urllib3 conda-forge/noarch::urllib3-1.26.4-pyhd8ed1ab_0\n", + " wcwidth conda-forge/noarch::wcwidth-0.2.5-pyh9f0ad1d_2\n", + " webencodings conda-forge/noarch::webencodings-0.5.1-py_1\n", + " wheel conda-forge/noarch::wheel-0.36.2-pyhd3deb0d_0\n", + " widgetsnbextension conda-forge/linux-64::widgetsnbextension-3.5.1-py38h578d9bd_4\n", + " xeus conda-forge/linux-64::xeus-1.0.1-h7d0c39e_2\n", + " xeus-python conda-forge/linux-64::xeus-python-0.12.3-py38h56bed4f_0\n", + " xorg-libxau conda-forge/linux-64::xorg-libxau-1.0.9-h7f98852_0\n", + " xorg-libxdmcp conda-forge/linux-64::xorg-libxdmcp-1.1.3-h7f98852_0\n", + " xz conda-forge/linux-64::xz-5.2.5-h516909a_1\n", + " zeromq conda-forge/linux-64::zeromq-4.3.4-h9c3ff4c_0\n", + " zipp conda-forge/noarch::zipp-3.4.1-pyhd8ed1ab_0\n", + " zlib conda-forge/linux-64::zlib-1.2.11-h516909a_1010\n", + " zstd conda-forge/linux-64::zstd-1.4.9-ha95c52a_0\n", + "\n", + "\n", + "\n", + "Downloading and Extracting Packages\n", + "debugpy-1.2.1 | 1.9 MB | ##################################### | 100% \n", + "xeus-python-0.12.3 | 799 KB | ##################################### | 100% \n", + "xeus-1.0.1 | 939 KB | ##################################### | 100% \n", + "Preparing transaction: done\n", + "Verifying transaction: done\n", + "Executing transaction: | Enabling notebook extension jupyter-js-widgets/extension...\n", + " - Validating: \u001b[32mOK\u001b[0m\n", + "\n", + "done\n", + "#\n", + "# To activate this environment, use\n", + "#\n", + "# $ conda activate my_jupyterlab3\n", + "#\n", + "# To deactivate an active environment, use\n", + "#\n", + "# $ conda deactivate\n", + "\n" + ] + } + ], + "source": [ + "${CONDA_TARGET_DIR}/bin/conda create -n ${CONDA_ENV} --override-channels --strict-channel-priority -c conda-forge -c anaconda --yes jupyterlab=3 xeus-python ipywidgets nodejs pip pandas=0.24 matplotlib" + ] + }, + { + "cell_type": "markdown", + "id": "measured-finance", + "metadata": {}, + "source": [ + "----------------------------------------------------\n", + "## 3. Activate Conda Environment" + ] + }, + { + "cell_type": "code", + "execution_count": 3, + "id": "regional-haiti", + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "/p/project/training2109/goebbert1/miniconda3\n", + "my_jupyterlab3\n", + "(my_jupyterlab3) (my_jupyterlab3) (my_jupyterlab3) (my_jupyterlab3) (my_jupyterlab3) \n", + "(my_jupyterlab3) " + ] + }, + { + "ename": "", + "evalue": "1", + "execution_count": 3, + "output_type": "error", + "traceback": [] + } + ], + "source": [ + "# verify that PYTHONPATH only points to directories of packages\n", + "# that are compatible with the Python interpreter in Miniconda3\n", + "unset PYTHONPATH\n", + "\n", + "# just to show that jupyterlab starts\n", + "# we have to ensure that the bash-kernel shell\n", + "# does not have JUPYTER*- environment variables set from the running JupyterLab (which serves this notebook)\n", + "unset JUPYTER_PATH\n", + "unset JUPYTERLAB_DIR\n", + "unset JUPYTER_DATA_DIR\n", + "unset JUPYTER_CONFIG_PATH\n", + "\n", + "# Activate your Python virtual environment\n", + "echo ${CONDA_TARGET_DIR}\n", + "echo ${CONDA_ENV}\n", + "source \"${CONDA_TARGET_DIR}\"/bin/activate \"${CONDA_ENV}\"\n", + " \n", + "# Ensure python packages installed in conda are always prefered, not necessary if module purge is used\n", + "#export PYTHONPATH=${CONDA_PREFIX}/lib/python3.6/site-packages:${PYTHONPATH}\n", + "\n", + "echo $PYTHONPATH" + ] + }, + { + "cell_type": "code", + "execution_count": 4, + "id": "sticky-intensity", + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "/p/project/training2109/goebbert1/miniconda3/envs/my_jupyterlab3/bin/jupyter\n", + "(my_jupyterlab3) " + ] + }, + { + "ename": "", + "evalue": "1", + "execution_count": 4, + "output_type": "error", + "traceback": [] + } + ], + "source": [ + "which jupyter" + ] + }, + { + "cell_type": "markdown", + "id": "instrumental-virtue", + "metadata": {}, + "source": [ + "---------\n", + "## 4. Start the fresh installed JupyterLab from the Conda Environment" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "proved-samoa", + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "(my_jupyterlab3) [I 2021-04-21 22:15:48.763 ServerApp] jupyterlab | extension was successfully linked.\n", + "[I 2021-04-21 22:15:48.967 ServerApp] nbclassic | extension was successfully linked.\n", + "[I 2021-04-21 22:15:49.122 LabApp] JupyterLab extension loaded from /p/project/training2109/goebbert1/miniconda3/envs/my_jupyterlab3/lib/python3.8/site-packages/jupyterlab\n", + "[I 2021-04-21 22:15:49.122 LabApp] JupyterLab application directory is /p/project/training2109/goebbert1/miniconda3/envs/my_jupyterlab3/share/jupyter/lab\n", + "[I 2021-04-21 22:15:49.124 ServerApp] jupyterlab | extension was successfully loaded.\n", + "[I 2021-04-21 22:15:49.128 ServerApp] nbclassic | extension was successfully loaded.\n", + "[I 2021-04-21 22:15:49.128 ServerApp] Serving notebooks from local directory: /p/home/jusers/goebbert1/juwels/prace-2021.04-jupyter4hpc_solutions/day3/1-my-own-JupyterLab\n", + "[I 2021-04-21 22:15:49.128 ServerApp] Jupyter Server 1.6.2 is running at:\n", + "[I 2021-04-21 22:15:49.128 ServerApp] http://localhost:8888/lab?token=6fe491022fc9717e78a5447b3ebaf55f62971b8993d5c186\n", + "[I 2021-04-21 22:15:49.128 ServerApp] http://127.0.0.1:8888/lab?token=6fe491022fc9717e78a5447b3ebaf55f62971b8993d5c186\n", + "[I 2021-04-21 22:15:49.128 ServerApp] Use Control-C to stop this server and shut down all kernels (twice to skip confirmation).\n", + "[C 2021-04-21 22:15:49.133 ServerApp] \n", + " \n", + " To access the server, open this file in a browser:\n", + " file:///p/project/ccstvs/goebbert1/home_juwels/.local/share/jupyter/runtime/jpserver-19355-open.html\n", + " Or copy and paste one of these URLs:\n", + " http://localhost:8888/lab?token=6fe491022fc9717e78a5447b3ebaf55f62971b8993d5c186\n", + " http://127.0.0.1:8888/lab?token=6fe491022fc9717e78a5447b3ebaf55f62971b8993d5c186\n" + ] + } + ], + "source": [ + "## JUST FOR TESTING !!!\n", + "jupyter lab --no-browser" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "colored-nickel", + "metadata": {}, + "outputs": [], + "source": [] + } + ], + "metadata": { + "kernelspec": { + "display_name": "Bash", + "language": "bash", + "name": "bash" + }, + "language_info": { + "codemirror_mode": "shell", + "file_extension": ".sh", + "mimetype": "text/x-sh", + "name": "bash" + } + }, + "nbformat": 4, + "nbformat_minor": 5 +} diff --git a/day3/1-my-own-JupyterLab/3-manually-connect-to-JupyterLab.ipynb b/day3/1-my-own-JupyterLab/3-manually-connect-to-JupyterLab.ipynb new file mode 100644 index 0000000000000000000000000000000000000000..e69f4f1abdea93df8247f93201e766bc7a99a07d --- /dev/null +++ b/day3/1-my-own-JupyterLab/3-manually-connect-to-JupyterLab.ipynb @@ -0,0 +1,226 @@ +{ + "cells": [ + { + "cell_type": "markdown", + "id": "contained-explanation", + "metadata": {}, + "source": [ + "### How to manually start and connect to JupyterLab\n", + "\n", + "---------------------------------------------" + ] + }, + { + "cell_type": "markdown", + "id": "small-panic", + "metadata": {}, + "source": [ + "#### Exercise 1:\n" + ] + }, + { + "cell_type": "markdown", + "id": "simple-syndrome", + "metadata": {}, + "source": [ + "1. Open a Terminal\n", + " - if you use the terminal from within a running JupyterLab, you need to clean up a bit\n", + " ```\n", + " unset JUPYTER_PATH\n", + "unset JUPYTERLAB_DIR\n", + "unset JUPYTER_DATA_DIR\n", + "unset JUPYTER_CONFIG_PATH\n", + "```\n", + "2. Decide what JupyterLab you want to start\n", + " - a) preinstalled JupyterLab from a module\n", + " - b) JupyterLab from your own conda-environment" + ] + }, + { + "cell_type": "markdown", + "id": "breeding-probe", + "metadata": {}, + "source": [ + "#### A) Using a preinstalled JupyterLab from a module\n", + "\n", + "Run the following commands to prepare your shell\n", + "```bash\n", + "module purge\n", + "module use $OTHERSTAGES\n", + "module load Stages/Devel-2020\n", + "module load GCCcore/.9.3.0\n", + "module load JupyterCollection/2020.2.5\n", + "```\n", + "\n", + "Start JupyterLab\n", + "```bash\n", + "jupyter lab --no-browser\n", + "```" + ] + }, + { + "cell_type": "markdown", + "id": "round-flush", + "metadata": {}, + "source": [ + "#### B) JupyterLab from your own conda-environment\n", + "\n", + "Prepare preinstalled conda environment:\n", + "```bash\n", + "export CONDA_TARGET_DIR=/p/project/training2109/goebbert1/miniconda3\n", + "CONDA_ENV=my_jupyterlab3\n", + "\n", + "# >>> conda initialize >>>\n", + "__conda_setup=\"$('/p/project/training2109/goebbert1/miniconda3/bin/conda' 'shell.bash' 'hook' 2> /dev/null)\"\n", + "if [ $? -eq 0 ]; then\n", + " eval \"$__conda_setup\"\n", + "else\n", + " if [ -f \"/p/project/training2109/goebbert1/miniconda3/etc/profile.d/conda.sh\" ]; then\n", + " . \"/p/project/training2109/goebbert1/miniconda3/etc/profile.d/conda.sh\"\n", + " else\n", + " export PATH=\"/p/project/training2109/goebbert1/miniconda3/bin:$PATH\"\n", + " fi\n", + "fi\n", + "unset __conda_setup\n", + "# <<< conda initialize <<<\n", + "```" + ] + }, + { + "cell_type": "markdown", + "id": "spiritual-mustang", + "metadata": {}, + "source": [ + "Load conda environment\n", + "```bash\n", + "# verify that PYTHONPATH only points to directories of packages\n", + "# that are compatible with the Python interpreter in Miniconda3\n", + "unset PYTHONPATH\n", + "\n", + "# just to show that jupyterlab starts\n", + "# we have to ensure that the bash-kernel shell\n", + "# does not have JUPYTER*- environment variables set from the running JupyterLab (which serves this notebook)\n", + "unset JUPYTER_PATH\n", + "unset JUPYTERLAB_DIR\n", + "unset JUPYTER_DATA_DIR\n", + "unset JUPYTER_CONFIG_PATH\n", + "\n", + "# Activate your Python virtual environment\n", + "echo ${CONDA_TARGET_DIR}\n", + "echo ${CONDA_ENV}\n", + "source \"${CONDA_TARGET_DIR}\"/bin/activate \"${CONDA_ENV}\"\n", + " \n", + "# Ensure python packages installed in conda are always prefered, not necessary if module purge is used\n", + "#export PYTHONPATH=${CONDA_PREFIX}/lib/python3.6/site-packages:${PYTHONPATH}\n", + "\n", + "echo $PYTHONPATH\n", + "```\n", + "\n", + "Start JupyterLab\n", + "```bash\n", + "jupyter lab --no-browser\n", + "```" + ] + }, + { + "cell_type": "markdown", + "id": "boolean-tamil", + "metadata": {}, + "source": [ + "---------\n", + "### Tunnel the new JupyterLab to your local machine\n", + "\n", + "**Linux or Mac:** \n", + "If your operating system is Linux or Mac use: " + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "olive-madonna", + "metadata": {}, + "outputs": [], + "source": [ + "ssh -N -L <LOCAL_PORT>:<JLAB_NODE>:<JLAB_PORT> <USERID>@<LOGIN_NODE>.fz-juelich.de\n", + "# example: ssh -N -L 8888:juwels04:8888 goebbert1@juwels01.fz-juelich.de\n", + "\n", + "# if you want to tunnel to juwels04 only, then you shoudcan set JLAB_NODE to \"localhost\"" + ] + }, + { + "cell_type": "markdown", + "id": "scientific-commission", + "metadata": {}, + "source": [ + "**Attention:**\n", + "- LOGIN_NODE - Hostname of login node from the view of your local machine\n", + "- JLAB_NODE - Hostname of the node running JupyterLab from the view of LOGIN_NODE\n", + "- LOCAL_PORT - port on your local machine\n", + "- JLAB_PORT - port on the node running JupyterLab" + ] + }, + { + "cell_type": "markdown", + "id": "under-willow", + "metadata": {}, + "source": [ + "**Windows:**\n", + "In case your operating system is Windows, the setup of the tunnel depends on your ssh client.\n", + "Here a short overview on how-to setup a tunnel with **PuTTY** is given.\n", + "\n", + "It is assumed that PuTTY is already configured in a way that a general ssh connection to JUWELS is possible.\n", + "That means that host name, user name and the private ssh key (using PuTTY's Pageant) are correctly set.\n", + "You already made a first connection to JUWELS using PUTTY.\n", + "\n", + "To establish the ssh tunnel start PUTTY and enter the \"SSH-->tunnels\" tab in the PuTTY configuration window before connecting to JUWELS.\n", + "You have to enter the source port (eg. <LOCAL_PORT> = 8888) and the destination (eg. juwels01.fz-juelich.de:8888) and than press add.\n", + "After pressing add, the tunnel should appear in the list of forwarded ports and you can establish the tunnel by pressing the open button." + ] + }, + { + "cell_type": "markdown", + "id": "ordered-tract", + "metadata": {}, + "source": [ + "" + ] + }, + { + "cell_type": "markdown", + "id": "unexpected-sharing", + "metadata": {}, + "source": [ + "" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "strategic-concert", + "metadata": {}, + "outputs": [], + "source": [] + } + ], + "metadata": { + "kernelspec": { + "display_name": "Python 3", + "language": "python", + "name": "python3" + }, + "language_info": { + "codemirror_mode": { + "name": "ipython", + "version": 3 + }, + "file_extension": ".py", + "mimetype": "text/x-python", + "name": "python", + "nbconvert_exporter": "python", + "pygments_lexer": "ipython3", + "version": "3.8.5" + } + }, + "nbformat": 4, + "nbformat_minor": 5 +} diff --git a/day3/1-my-own-JupyterLab/4-debugging-with-JupyterLab3.ipynb b/day3/1-my-own-JupyterLab/4-debugging-with-JupyterLab3.ipynb new file mode 100644 index 0000000000000000000000000000000000000000..e78fe688634f19e8ea5e0d2bb64d8b0b175ff302 --- /dev/null +++ b/day3/1-my-own-JupyterLab/4-debugging-with-JupyterLab3.ipynb @@ -0,0 +1,83 @@ +{ + "cells": [ + { + "cell_type": "markdown", + "id": "registered-starter", + "metadata": {}, + "source": [ + "### Debugging with JupyterLab 3\n", + "---------------------------------------------" + ] + }, + { + "cell_type": "markdown", + "id": "preliminary-witness", + "metadata": {}, + "source": [ + "#### Preparation:\n" + ] + }, + { + "cell_type": "markdown", + "id": "endless-turkey", + "metadata": {}, + "source": [ + "1. You have used Conda to install your own JupyterLab in version 3\n", + " - check `2-JupyterLab-from-condaforge.ipynb`\n", + "2. You have started your JupyterLab and have successfully setup a tunnel\n", + " - check `3-manually-connect-to-JupyterLab.ipynb` if you have not\n", + "3. You have download the debugger example notebook" + ] + }, + { + "cell_type": "code", + "execution_count": 4, + "id": "million-falls", + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + " % Total % Received % Xferd Average Speed Time Time Time Current\n", + " Dload Upload Total Spent Left Speed\n", + "100 152k 100 152k 0 0 673k 0 --:--:-- --:--:-- --:--:-- 676k\n" + ] + } + ], + "source": [ + "# Download the debugger tutorial notebook\n", + "!curl -o debugger.ipynb https://raw.githubusercontent.com/jupyterlab/debugger/dfd6bf9d51a7a0cd78ca54f4173fcf527bd4d7fd/examples/index.ipynb" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "nutritional-parish", + "metadata": {}, + "outputs": [], + "source": [] + } + ], + "metadata": { + "kernelspec": { + "display_name": "Python 3", + "language": "python", + "name": "python3" + }, + "language_info": { + "codemirror_mode": { + "name": "ipython", + "version": 3 + }, + "file_extension": ".py", + "mimetype": "text/x-python", + "name": "python", + "nbconvert_exporter": "python", + "pygments_lexer": "ipython3", + "version": "3.8.5" + } + }, + "nbformat": 4, + "nbformat_minor": 5 +} diff --git a/day3/1-my-own-JupyterLab/PuTTY-add-tunnel.png b/day3/1-my-own-JupyterLab/PuTTY-add-tunnel.png new file mode 100644 index 0000000000000000000000000000000000000000..d1ffca13393f998810a179c657c82a743bf7d480 Binary files /dev/null and b/day3/1-my-own-JupyterLab/PuTTY-add-tunnel.png differ diff --git a/day3/1-my-own-JupyterLab/PuTTY-tunnel-added.png b/day3/1-my-own-JupyterLab/PuTTY-tunnel-added.png new file mode 100644 index 0000000000000000000000000000000000000000..8b2d0e3a01e94c6bf3daf6d1845ceab56ce948a2 Binary files /dev/null and b/day3/1-my-own-JupyterLab/PuTTY-tunnel-added.png differ diff --git a/day3/2-kernelgateway/1-kernelgateway.ipynb b/day3/2-kernelgateway/1-kernelgateway.ipynb new file mode 100644 index 0000000000000000000000000000000000000000..9fdf947f3a2c161667f8d7a1fae278e21d09446d --- /dev/null +++ b/day3/2-kernelgateway/1-kernelgateway.ipynb @@ -0,0 +1,366 @@ +{ + "cells": [ + { + "cell_type": "markdown", + "id": "civic-cinema", + "metadata": {}, + "source": [ + "### Jupyter Kernel Gateway\n", + "Jupyter Kernel Gateway is a web server that provides headless access to Jupyter kernels. Your application communicates with the kernels remotely, through REST calls and Websockets rather than ZeroMQ messages.\n", + "[more](https://github.com/jupyter/kernel_gateway)\n", + "\n", + "---------------------------------------------" + ] + }, + { + "cell_type": "markdown", + "id": "rubber-stuart", + "metadata": {}, + "source": [ + "#### Exercise 1:\n", + "1. Check, if kernelgateway is installed" + ] + }, + { + "cell_type": "code", + "execution_count": 1, + "id": "aging-parish", + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Jupyter Kernel Gateway\n", + "\n", + "Provisions Jupyter kernels and proxies HTTP/Websocket traffic to them.\n", + "\n", + "Options\n", + "-------\n", + "\n", + "Arguments that take values are actually convenience aliases to full\n", + "Configurables, whose aliases are listed on the help line. For more information\n", + "on full configurables, see '--help-all'.\n", + "\n", + "--debug\n", + " set log level to logging.DEBUG (maximize logging output)\n", + "--generate-config\n", + " generate default config file\n", + "-y\n", + " Answer yes to any questions instead of prompting.\n", + "--log-level=<Enum> (Application.log_level)\n", + " Default: 30\n", + " Choices: (0, 10, 20, 30, 40, 50, 'DEBUG', 'INFO', 'WARN', 'ERROR', 'CRITICAL')\n", + " Set the log level by value or name.\n", + "--config=<Unicode> (JupyterApp.config_file)\n", + " Default: ''\n", + " Full path of a config file.\n", + "--ip=<Unicode> (KernelGatewayApp.ip)\n", + " Default: '127.0.0.1'\n", + " IP address on which to listen (KG_IP env var)\n", + "--port=<Int> (KernelGatewayApp.port)\n", + " Default: 8888\n", + " Port on which to listen (KG_PORT env var)\n", + "--port_retries=<Int> (KernelGatewayApp.port_retries)\n", + " Default: 50\n", + " Number of ports to try if the specified port is not available\n", + " (KG_PORT_RETRIES env var)\n", + "--api=<Unicode> (KernelGatewayApp.api)\n", + " Default: 'kernel_gateway.jupyter_websocket'\n", + " Controls which API to expose, that of a Jupyter notebook server, the seed\n", + " notebook's, or one provided by another module, respectively using values\n", + " 'kernel_gateway.jupyter_websocket', 'kernel_gateway.notebook_http', or\n", + " another fully qualified module name (KG_API env var)\n", + "--seed_uri=<Unicode> (KernelGatewayApp.seed_uri)\n", + " Default: None\n", + " Runs the notebook (.ipynb) at the given URI on every kernel launched. No\n", + " seed by default. (KG_SEED_URI env var)\n", + "--keyfile=<Unicode> (KernelGatewayApp.keyfile)\n", + " Default: None\n", + " The full path to a private key file for usage with SSL/TLS. (KG_KEYFILE env\n", + " var)\n", + "--certfile=<Unicode> (KernelGatewayApp.certfile)\n", + " Default: None\n", + " The full path to an SSL/TLS certificate file. (KG_CERTFILE env var)\n", + "--client-ca=<Unicode> (KernelGatewayApp.client_ca)\n", + " Default: None\n", + " The full path to a certificate authority certificate for SSL/TLS client\n", + " authentication. (KG_CLIENT_CA env var)\n", + "--ssl_version=<Int> (KernelGatewayApp.ssl_version)\n", + " Default: None\n", + " Sets the SSL version to use for the web socket connection. (KG_SSL_VERSION\n", + " env var)\n", + "\n", + "Class parameters\n", + "----------------\n", + "\n", + "Parameters are set from command-line arguments of the form:\n", + "`--Class.trait=value`. This line is evaluated in Python, so simple expressions\n", + "are allowed, e.g.:: `--C.a='range(3)'` For setting C.a=[0,1,2].\n", + "\n", + "KernelGatewayApp options\n", + "------------------------\n", + "--KernelGatewayApp.allow_credentials=<Unicode>\n", + " Default: ''\n", + " Sets the Access-Control-Allow-Credentials header. (KG_ALLOW_CREDENTIALS env\n", + " var)\n", + "--KernelGatewayApp.allow_headers=<Unicode>\n", + " Default: ''\n", + " Sets the Access-Control-Allow-Headers header. (KG_ALLOW_HEADERS env var)\n", + "--KernelGatewayApp.allow_methods=<Unicode>\n", + " Default: ''\n", + " Sets the Access-Control-Allow-Methods header. (KG_ALLOW_METHODS env var)\n", + "--KernelGatewayApp.allow_origin=<Unicode>\n", + " Default: ''\n", + " Sets the Access-Control-Allow-Origin header. (KG_ALLOW_ORIGIN env var)\n", + "--KernelGatewayApp.answer_yes=<Bool>\n", + " Default: False\n", + " Answer yes to any prompts.\n", + "--KernelGatewayApp.api=<Unicode>\n", + " Default: 'kernel_gateway.jupyter_websocket'\n", + " Controls which API to expose, that of a Jupyter notebook server, the seed\n", + " notebook's, or one provided by another module, respectively using values\n", + " 'kernel_gateway.jupyter_websocket', 'kernel_gateway.notebook_http', or\n", + " another fully qualified module name (KG_API env var)\n", + "--KernelGatewayApp.auth_token=<Unicode>\n", + " Default: ''\n", + " Authorization token required for all requests (KG_AUTH_TOKEN env var)\n", + "--KernelGatewayApp.base_url=<Unicode>\n", + " Default: '/'\n", + " The base path for mounting all API resources (KG_BASE_URL env var)\n", + "--KernelGatewayApp.certfile=<Unicode>\n", + " Default: None\n", + " The full path to an SSL/TLS certificate file. (KG_CERTFILE env var)\n", + "--KernelGatewayApp.client_ca=<Unicode>\n", + " Default: None\n", + " The full path to a certificate authority certificate for SSL/TLS client\n", + " authentication. (KG_CLIENT_CA env var)\n", + "--KernelGatewayApp.config_file=<Unicode>\n", + " Default: ''\n", + " Full path of a config file.\n", + "--KernelGatewayApp.config_file_name=<Unicode>\n", + " Default: ''\n", + " Specify a config file to load.\n", + "--KernelGatewayApp.default_kernel_name=<Unicode>\n", + " Default: ''\n", + " Default kernel name when spawning a kernel (KG_DEFAULT_KERNEL_NAME env var)\n", + "--KernelGatewayApp.env_process_whitelist=<List>\n", + " Default: []\n", + " Environment variables allowed to be inherited from the spawning process by\n", + " the kernel\n", + "--KernelGatewayApp.expose_headers=<Unicode>\n", + " Default: ''\n", + " Sets the Access-Control-Expose-Headers header. (KG_EXPOSE_HEADERS env var)\n", + "--KernelGatewayApp.force_kernel_name=<Unicode>\n", + " Default: ''\n", + " Override any kernel name specified in a notebook or request\n", + " (KG_FORCE_KERNEL_NAME env var)\n", + "--KernelGatewayApp.generate_config=<Bool>\n", + " Default: False\n", + " Generate default config file.\n", + "--KernelGatewayApp.ip=<Unicode>\n", + " Default: '127.0.0.1'\n", + " IP address on which to listen (KG_IP env var)\n", + "--KernelGatewayApp.kernel_manager_class=<Type>\n", + " Default: 'kernel_gateway.services.kernels.manager.SeedingMappingKernel...\n", + " The kernel manager class to use.\n", + "--KernelGatewayApp.kernel_spec_manager_class=<Type>\n", + " Default: 'jupyter_client.kernelspec.KernelSpecManager'\n", + " The kernel spec manager class to use. Should be a subclass of\n", + " `jupyter_client.kernelspec.KernelSpecManager`.\n", + "--KernelGatewayApp.keyfile=<Unicode>\n", + " Default: None\n", + " The full path to a private key file for usage with SSL/TLS. (KG_KEYFILE env\n", + " var)\n", + "--KernelGatewayApp.log_datefmt=<Unicode>\n", + " Default: '%Y-%m-%d %H:%M:%S'\n", + " The date format used by logging formatters for %(asctime)s\n", + "--KernelGatewayApp.log_format=<Unicode>\n", + " Default: '[%(name)s]%(highlevel)s %(message)s'\n", + " The Logging format template\n", + "--KernelGatewayApp.log_level=<Enum>\n", + " Default: 30\n", + " Choices: (0, 10, 20, 30, 40, 50, 'DEBUG', 'INFO', 'WARN', 'ERROR', 'CRITICAL')\n", + " Set the log level by value or name.\n", + "--KernelGatewayApp.max_age=<Unicode>\n", + " Default: ''\n", + " Sets the Access-Control-Max-Age header. (KG_MAX_AGE env var)\n", + "--KernelGatewayApp.max_kernels=<Int>\n", + " Default: None\n", + " Limits the number of kernel instances allowed to run by this gateway.\n", + " Unbounded by default. (KG_MAX_KERNELS env var)\n", + "--KernelGatewayApp.port=<Int>\n", + " Default: 8888\n", + " Port on which to listen (KG_PORT env var)\n", + "--KernelGatewayApp.port_retries=<Int>\n", + " Default: 50\n", + " Number of ports to try if the specified port is not available\n", + " (KG_PORT_RETRIES env var)\n", + "--KernelGatewayApp.prespawn_count=<Int>\n", + " Default: None\n", + " Number of kernels to prespawn using the default language. No prespawn by\n", + " default. (KG_PRESPAWN_COUNT env var)\n", + "--KernelGatewayApp.seed_uri=<Unicode>\n", + " Default: None\n", + " Runs the notebook (.ipynb) at the given URI on every kernel launched. No\n", + " seed by default. (KG_SEED_URI env var)\n", + "--KernelGatewayApp.ssl_version=<Int>\n", + " Default: None\n", + " Sets the SSL version to use for the web socket connection. (KG_SSL_VERSION\n", + " env var)\n", + "--KernelGatewayApp.trust_xheaders=<CBool>\n", + " Default: False\n", + " Use x-* header values for overriding the remote-ip, useful when application\n", + " is behing a proxy. (KG_TRUST_XHEADERS env var)\n", + "\n", + "NotebookHTTPPersonality options\n", + "-------------------------------\n", + "--NotebookHTTPPersonality.allow_notebook_download=<Bool>\n", + " Default: False\n", + " Optional API to download the notebook source code in notebook-http mode,\n", + " defaults to not allow\n", + "--NotebookHTTPPersonality.cell_parser=<Unicode>\n", + " Default: 'kernel_gateway.notebook_http.cell.parser'\n", + " Determines which module is used to parse the notebook for endpoints and\n", + " documentation. Valid module names include\n", + " 'kernel_gateway.notebook_http.cell.parser' and\n", + " 'kernel_gateway.notebook_http.swagger.parser'. (KG_CELL_PARSER env var)\n", + "--NotebookHTTPPersonality.comment_prefix=<Dict>\n", + " Default: {'scala': '//', None: '#'}\n", + " Maps kernel language to code comment syntax\n", + "--NotebookHTTPPersonality.static_path=<Unicode>\n", + " Default: None\n", + " Serve static files on disk in the given path as /public, defaults to not\n", + " serve\n", + "\n", + "JupyterWebsocketPersonality options\n", + "-----------------------------------\n", + "--JupyterWebsocketPersonality.env_whitelist=<List>\n", + " Default: []\n", + " Environment variables allowed to be set when a client requests a new kernel\n", + "--JupyterWebsocketPersonality.list_kernels=<Bool>\n", + " Default: False\n", + " Permits listing of the running kernels using API endpoints /api/kernels and\n", + " /api/sessions (KG_LIST_KERNELS env var). Note: Jupyter Notebook allows this\n", + " by default but kernel gateway does not.\n", + "\n" + ] + } + ], + "source": [ + "# show all config options\n", + "jupyter kernelgateway --help-all" + ] + }, + { + "cell_type": "markdown", + "id": "saved-relation", + "metadata": {}, + "source": [ + "#### Exercise 2:\n", + "Using a gateway server for kernel management \n", + "https://jupyter-notebook.readthedocs.io/en/stable/public_server.html#using-a-gateway-server-for-kernel-management" + ] + }, + { + "cell_type": "markdown", + "id": "normal-supplier", + "metadata": {}, + "source": [ + "#### Exercise 2:\n", + "1. Start a Jupyter Kernel Gateway" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "fabulous-russian", + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "[KernelGatewayApp] Jupyter Kernel Gateway at http://127.0.0.1:10100\n" + ] + } + ], + "source": [ + "jupyter kernelgateway --KernelGatewayApp.api=kernel_gateway.jupyter_websocket --port=10100" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "signal-extension", + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "[I 06:15:36.505 LabApp] Appmode server extension loaded.\n", + "[I 06:15:39.002 LabApp] Loading IPython parallel extension\n", + "[I 06:15:40.514 LabApp] [jupyter_nbextensions_configurator] enabled 0.4.1\n", + "Created secure socket directory for Xpra: /home/jovyan/.tmp/xpra_sockets_1094\n", + "Created secure password file for Xpra: /home/jovyan/.tmp/tmpi8dcssms\n", + "Created secure encryption key file for Xpra: /home/jovyan/.tmp/tmpo1h504ny\n", + "Xpra command: /p/software/hdfcloud/stages/2020/software/JupyterProxy-XpraHTML5/0.3.0-gcccoremkl-9.3.0-2020.2.254-2020.2.6/lib/python3.8/site-packages/jupyter_xprahtml5_proxy/share/launch_xpra.sh start --html=on --bind-tcp=0.0.0.0:{port} --start=xterm -fa Monospace --tcp-auth=file:filename=/home/jovyan/.tmp/tmpi8dcssms --tcp-encryption=AES --tcp-encryption-keyfile=/home/jovyan/.tmp/tmpo1h504ny --clipboard-direction=both --no-mdns --no-bell --no-speaker --no-printing --no-microphone --no-notifications --no-systemd-run --sharing --no-daemon\n", + "[I 06:15:41.960 LabApp] JupyterLab extension loaded from /p/software/hdfcloud/stages/2020/software/Jupyter/2020.2.6-gcccoremkl-9.3.0-2020.2.254-Python-3.8.5/lib/python3.8/site-packages/jupyterlab\n", + "[I 06:15:41.961 LabApp] JupyterLab application directory is /p/software/hdfcloud/stages/2020/software/Jupyter/2020.2.6-gcccoremkl-9.3.0-2020.2.254-Python-3.8.5/share/jupyter/lab\n", + "[I 06:15:42.063 LabApp] Registered QuickOpenHandler extension at URL path /api/quickopen to serve results of scanning local path /home/jovyan/prace-2021.04-jupyter4hpc_solutions/day3/2-kernelgateway\n", + "[I 06:15:42.076 LabApp] Loading lmod extension\n", + "[I 06:15:42.951 LabApp] Serving notebooks from local directory: /home/jovyan/prace-2021.04-jupyter4hpc_solutions/day3/2-kernelgateway\n", + "[I 06:15:42.952 LabApp] Jupyter Notebook 6.2.0 is running at:\n", + "[I 06:15:42.952 LabApp] http://localhost:8888/?token=9dc46224be7d17d9674395fd442d15e790ec98e15941da47\n", + "[I 06:15:42.952 LabApp] or http://127.0.0.1:8888/?token=9dc46224be7d17d9674395fd442d15e790ec98e15941da47\n", + "[I 06:15:42.952 LabApp] Kernels will be managed by the Gateway server running at:\n", + "[I 06:15:42.952 LabApp] http://localhost:10100\n", + "[I 06:15:42.952 LabApp] Use Control-C to stop this server and shut down all kernels (twice to skip confirmation).\n", + "[W 06:15:42.966 LabApp] No web browser found: could not locate runnable browser.\n", + "[C 06:15:42.967 LabApp] \n", + " \n", + " To access the notebook, open this file in a browser:\n", + " file:///home/jovyan/.local/share/jupyter/runtime/nbserver-2928-open.html\n", + " Or copy and paste one of these URLs:\n", + " http://localhost:8888/?token=9dc46224be7d17d9674395fd442d15e790ec98e15941da47\n", + " or http://127.0.0.1:8888/?token=9dc46224be7d17d9674395fd442d15e790ec98e15941da47\n" + ] + } + ], + "source": [ + "# kernel gateway must be running\n", + "# (localhost just for demonstration, of course)\n", + "jupyter lab --gateway-url=http://localhost:10100" + ] + }, + { + "cell_type": "markdown", + "id": "military-february", + "metadata": {}, + "source": [ + "------------\n", + "```\n", + "[I 06:08:01.024 NotebookApp] Kernels will be managed by the Gateway server running at:\n", + "[I 06:08:01.024 NotebookApp] http://my-gateway-server:8888\n", + "```\n", + "When provided, all kernel specifications will be retrieved from the specified Gateway server and all kernels will be managed by that server. This option enables the ability to target kernel processes against managed clusters while allowing for the notebook’s management to remain local to the Notebook server." + ] + } + ], + "metadata": { + "kernelspec": { + "display_name": "Bash", + "language": "bash", + "name": "bash" + }, + "language_info": { + "codemirror_mode": "shell", + "file_extension": ".sh", + "mimetype": "text/x-sh", + "name": "bash" + } + }, + "nbformat": 4, + "nbformat_minor": 5 +} diff --git a/day3/4-Jupyter-JSC-under-the-hood/PRACE-Wrkshp_interactive-hpc-with-jupyter_under-the-hood_day3.pdf b/day3/4-Jupyter-JSC-under-the-hood/PRACE-Wrkshp_interactive-hpc-with-jupyter_under-the-hood_day3.pdf new file mode 100644 index 0000000000000000000000000000000000000000..15e515ccecf674fba77ab8b36b28630a144837bd Binary files /dev/null and b/day3/4-Jupyter-JSC-under-the-hood/PRACE-Wrkshp_interactive-hpc-with-jupyter_under-the-hood_day3.pdf differ