From 9b21d8df7f424dd352472a1734fbfdf4a2bbe307 Mon Sep 17 00:00:00 2001 From: Johannes Laurin Hoermann Date: Mon, 7 Nov 2022 13:22:00 +0100 Subject: [PATCH 01/14] ENH: Container recipe for jupyterlab docker stack-derived SurfaceTopography image --- .../jupyterlab-SurfaceTopography/Dockerfile | 56 +++ .../jupyterlab-SurfaceTopography/README.md | 141 ++++++ .../conda-requirements.in | 2 + .../etc/fonts.conf | 6 + .../requirements.in | 32 ++ .../requirements.txt | 442 ++++++++++++++++++ .../start-wrapper.sh | 18 + 7 files changed, 697 insertions(+) create mode 100644 docker/jupyterlab/jupyterlab-SurfaceTopography/Dockerfile create mode 100644 docker/jupyterlab/jupyterlab-SurfaceTopography/README.md create mode 100644 docker/jupyterlab/jupyterlab-SurfaceTopography/conda-requirements.in create mode 100644 docker/jupyterlab/jupyterlab-SurfaceTopography/etc/fonts.conf create mode 100644 docker/jupyterlab/jupyterlab-SurfaceTopography/requirements.in create mode 100644 docker/jupyterlab/jupyterlab-SurfaceTopography/requirements.txt create mode 100755 docker/jupyterlab/jupyterlab-SurfaceTopography/start-wrapper.sh diff --git a/docker/jupyterlab/jupyterlab-SurfaceTopography/Dockerfile b/docker/jupyterlab/jupyterlab-SurfaceTopography/Dockerfile new file mode 100644 index 0000000..c60152f --- /dev/null +++ b/docker/jupyterlab/jupyterlab-SurfaceTopography/Dockerfile @@ -0,0 +1,56 @@ +# Build from within repository root +# +# Modify conda enviornment running jupyter notebooks +FROM jupyter/scipy-notebook:latest + +COPY --chown=${NB_UID}:${NB_GID} jupyterlab-SurfaceTopography/conda-requirements.in "/home/${NB_USER}/" +RUN pip install pip-tools +RUN pip-compile "/home/${NB_USER}/conda-requirements.in" > "/home/${NB_USER}/conda-requirements.txt" +RUN pip install --quiet --no-cache-dir --requirement "/home/${NB_USER}/conda-requirements.txt" && \ + fix-permissions "${CONDA_DIR}" && \ + fix-permissions "/home/${NB_USER}" + +# FROM imkteksim/dtool-jupyter:latest +# Install from requirements.txt file +USER root +RUN apt-get --yes update && \ + apt-get --yes install \ + clang cmake curl g++ gdb git m4 wget \ + libboost-test-dev \ + libcurl4-openssl-dev \ + libeigen3-dev \ + libfftw3-dev \ + libgmp-dev \ + libnetcdf-dev \ + libopenblas-base \ + libopenblas-dev \ + python3-pip \ + python3-dev \ + python3-netcdf4 && \ + apt-get clean && \ + rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/* +USER ${NB_UID} + +# Workaround for building packages and introducing an ipykernel outside of the jupyterlab conda environment +RUN PATH=$(echo "$PATH" | sed -e 's|/opt/conda[^:]*:||g') && ( \ + pip install --no-binary numpy SurfaceTopography && \ + pip install ipykernel && \ + python3 -m ipykernel install --user --name SurfaceTopography --display-name "Python (SurfaceTopography)" && \ + echo "c.MultiKernelManager.default_kernel_name = 'SurfaceTopography'" >> ${HOME}/.jupyter/jupyter_notebook_config.py) && \ + fix-permissions "${CONDA_DIR}" && \ + fix-permissions "/home/${NB_USER}" + +# Workaround for modifying system python outside of the jupyterlab conda environment +COPY --chown=${NB_UID}:${NB_GID} jupyterlab-SurfaceTopography/requirements.txt "/home/${NB_USER}/" +RUN PATH="/home/${NB_USER}/.local/bin:$(echo "$PATH" | sed -e 's|/opt/conda[^:]*:||g')" && ( \ + pip install --quiet --no-cache-dir --requirement "/home/${NB_USER}/requirements.txt" ) + +WORKDIR /home/jovyan/work + +# Custom fonts config +COPY jupyterlab-SurfaceTopography/start-wrapper.sh /usr/local/bin/ +RUN mkdir -p /home/${NB_USER}/.config/fontconfig +COPY jupyterlab-SurfaceTopography/etc/fonts.conf /home/${NB_USER}/.config/fontconfig/fonts.conf +RUN mkdir -p /home/${NB_USER}/.fonts +RUN rm -rf /home/${NB_USER}/.cache/matplotlib +CMD ["start-wrapper.sh", "start-notebook.sh"] diff --git a/docker/jupyterlab/jupyterlab-SurfaceTopography/README.md b/docker/jupyterlab/jupyterlab-SurfaceTopography/README.md new file mode 100644 index 0000000..c991d84 --- /dev/null +++ b/docker/jupyterlab/jupyterlab-SurfaceTopography/README.md @@ -0,0 +1,141 @@ +# Sample setup jupyterlab-SurfaceTopography + +## Python requirements + +To (re-)generate a `requirements.txt` with fixed package versions, use + +```console +python3 -m venv venv +source venv/bin/activate + +pip install --upgrade pip +pip install wheel +pip install pip-tools + +pip-compile requirements.in > requirements.txt +``` + +## Build container + +Build container from parent directory (`docker/jupyterlab`) with + + docker build -t imteksim/jupyterlab-SurfaceTopography -f jupyterlab-SurfaceTopography/Dockerfile . + +or write directly to tar for transfer with + + docker build --output type=tar,dest=imteksim-jupyterlab-SurfaceTopography.tar -t imteksim/jupyterlab-SurfaceTopography -f jupyterlab-SurfaceTopography/Dockerfile . + +and load at target destination with + + docker load --input imteksim-jupyterlab-SurfaceTopography.tar + +## Certificates with acme.sh + +Identify the public hostname used for issuing SSL certificates, i.e. + + export HOSTNAME="SOME-UUID.fr.bw-cloud-instance.org" + +for a public bw-cloud instance and a seecure directory to hold certificates, i.e. + + export CERTDIR=${HOME}/acme.sh + +and use + + mkdir -p acme.sh + + # zerossl + docker run -v "${CERTDIR}:/acme.sh" --rm neilpang/acme.sh:latest \ + acme.sh --register-account -m ${MY_EMAIL_ADDRESS} + docker run -v "${CERTDIR}:/acme.sh" -p 80:80 --rm neilpang/acme.sh:latest \ + acme.sh --issue -d "${HOSTNAME}" --standalone --force + + # or, letsencrypt + docker run -v "${CERTDIR}:/acme.sh" --rm neilpang/acme.sh:latest \ + acme.sh --server letsencrypt --register-account -m ${MY_EMAIL_ADDRESS} + docker run -v "${CERTDIR}:/acme.sh" -p 80:80 --rm neilpang/acme.sh:latest \ + acme.sh --server letsencrypt --issue -d "${HOSTNAME}" --standalone --force + + sudo chown -R $USER:$USER $HOME/acme.sh + +to (re-)issue certiicates. + +## Fonts + +Microsoft fonts can be installed with + + sudo apt-get install -y fontconfig + sudo apt-get install -y ttf-mscorefonts-installer + sudo fc-cache -f + +Check with + + $ fc-match Arial + LiberationSans-Regular.ttf: "Liberation Sans" "Regular" + +Find location of installed fonts with + + $ dpkg-query -L ttf-mscorefonts-installer + /. + /usr + /usr/lib + /usr/lib/msttcorefonts + /usr/lib/msttcorefonts/update-ms-fonts + /usr/share + /usr/share/doc + /usr/share/doc/ttf-mscorefonts-installer + /usr/share/doc/ttf-mscorefonts-installer/README.Debian + /usr/share/doc/ttf-mscorefonts-installer/changelog.gz + /usr/share/doc/ttf-mscorefonts-installer/copyright + /usr/share/fonts + /usr/share/fonts/truetype + /usr/share/lintian + /usr/share/lintian/overrides + /usr/share/lintian/overrides/ttf-mscorefonts-installer + /usr/share/package-data-downloads + /usr/share/package-data-downloads/ttf-mscorefonts-installer + /var + /var/lib + /var/lib/msttcorefonts + +## Run Jupyter Lab + +Identify a persistent workspace directory, i.e. + + export WORKDIR=${HOME}/work + +and, optionally, a directory of additional fonts to make available to matplotlib, i.e. as above + + export FONTDIR=/usr/share/fonts/truetype/msttcorefonts + +Run public Jupyter Lab on default https port with fixed password + + docker run -d --rm -p 443:443 \ + -v ${WORKDIR}:/home/jovyan/work \ + -v ${FONTDIR}:/home/jovyan/.fonts \ + -v ${CERTDIR}/${HOSTNAME}:/etc/ssl/notebook \ + imteksim/jupyterlab-SurfaceTopography \ + start-notebook.sh \ + --ServerApp.keyfile=/etc/ssl/notebook/${HOSTNAME}.key \ + --ServerApp.certfile=/etc/ssl/notebook/${HOSTNAME}.cer \ + --ServerApp.password='argon2:$argon2id$v=19$m=10240,t=10,p=8$Jg1gFoiE0ybmBCVG+1s6uA$Jxz4/1591Z7so7JK2M1lRA' \ + --ServerApp.ip='*' \ + --ServerApp.port=443 + +Note that the hash of the password is passed. + + argon2:$argon2id$v=19$m=10240,t=10,p=8$Jg1gFoiE0ybmBCVG+1s6uA$Jxz4/1591Z7so7JK2M1lRA + +corresponds to password `imtek-simulation` and has been generated with + + from notebook.auth import passwd + passwd() + +Add + + --user root -e GRANT_SUDO=yes -e NB_GID=100 -e NB_USER=jovyan + +to the docker command line arguments if you need passwordless `sudo` within the container. + +## Access Jupyter Lab web interface + +Make sure `https` port 443 is reachable, navigate browser to `https://${HOSTNAME}` and log in with password specified on Jupyter Lab launch. diff --git a/docker/jupyterlab/jupyterlab-SurfaceTopography/conda-requirements.in b/docker/jupyterlab/jupyterlab-SurfaceTopography/conda-requirements.in new file mode 100644 index 0000000..b8384fb --- /dev/null +++ b/docker/jupyterlab/jupyterlab-SurfaceTopography/conda-requirements.in @@ -0,0 +1,2 @@ +jupyterlab_autorun_cells +jupytext diff --git a/docker/jupyterlab/jupyterlab-SurfaceTopography/etc/fonts.conf b/docker/jupyterlab/jupyterlab-SurfaceTopography/etc/fonts.conf new file mode 100644 index 0000000..f8b8752 --- /dev/null +++ b/docker/jupyterlab/jupyterlab-SurfaceTopography/etc/fonts.conf @@ -0,0 +1,6 @@ + + + + +~/.fonts + diff --git a/docker/jupyterlab/jupyterlab-SurfaceTopography/requirements.in b/docker/jupyterlab/jupyterlab-SurfaceTopography/requirements.in new file mode 100644 index 0000000..9a1a1b9 --- /dev/null +++ b/docker/jupyterlab/jupyterlab-SurfaceTopography/requirements.in @@ -0,0 +1,32 @@ +click +pep517 +tomli +ase +asgiref +cycler +dtool +dtool_lookup_api +dtoolcore +dtool-s3 +gromacs +GromacsWrapper +imteksimfw +ipython +ipywidgets +Jinja2 +matplotlib +MDAnalysis +miniball +nglview +numpy +openpyxl +ovito<=3.6.0 +pandas +panedr +ParmEd +pymongo +PySide2 +PyYAML +scipy +scikit-learn +seaborn diff --git a/docker/jupyterlab/jupyterlab-SurfaceTopography/requirements.txt b/docker/jupyterlab/jupyterlab-SurfaceTopography/requirements.txt new file mode 100644 index 0000000..03c0fbb --- /dev/null +++ b/docker/jupyterlab/jupyterlab-SurfaceTopography/requirements.txt @@ -0,0 +1,442 @@ +# +# This file is autogenerated by pip-compile with python 3.8 +# To update, run: +# +# pip-compile requirements.in +# +aiohttp==3.8.3 + # via dtool-lookup-api +aiosignal==1.2.0 + # via aiohttp +arrow==1.2.3 + # via jinja2-time +ase==3.22.1 + # via -r requirements.in +asgiref==3.5.2 + # via + # -r requirements.in + # dtool-lookup-api +asttokens==2.0.8 + # via stack-data +async-timeout==4.0.2 + # via aiohttp +attrs==22.1.0 + # via aiohttp +backcall==0.2.0 + # via ipython +bcrypt==4.0.1 + # via paramiko +biopython==1.79 + # via mdanalysis +boto3==1.25.2 + # via dtool-s3 +botocore==1.28.2 + # via + # boto3 + # s3transfer +certifi==2022.9.24 + # via requests +cffi==1.15.1 + # via + # cryptography + # pynacl +charset-normalizer==2.1.1 + # via + # aiohttp + # requests +click==8.1.3 + # via + # -r requirements.in + # click-plugins + # dtool-annotation + # dtool-cli + # dtool-config + # dtool-create + # dtool-info + # dtool-overlay + # dtool-s3 + # dtool-tag + # flask +click-plugins==1.1.1 + # via dtool-cli +contourpy==1.0.5 + # via matplotlib +cryptography==38.0.1 + # via paramiko +cycler==0.11.0 + # via + # -r requirements.in + # matplotlib +debugpy==1.6.3 + # via ipykernel +decorator==5.1.1 + # via ipython +dill==0.3.6 + # via imteksimfw +dnspython==2.2.1 + # via pymongo +dtool==3.26.2 + # via -r requirements.in +dtool-annotation==0.1.1 + # via dtool +dtool-cli==0.7.1 + # via + # dtool + # dtool-annotation + # dtool-create + # dtool-info + # dtool-overlay + # dtool-s3 + # dtool-tag +dtool-config==0.4.1 + # via dtool +dtool-create==0.23.4 + # via + # dtool + # imteksimfw +dtool-http==0.5.1 + # via + # dtool + # dtool-create +dtool-info==0.16.2 + # via dtool +dtool-lookup-api==0.5.1 + # via + # -r requirements.in + # imteksimfw +dtool-overlay==0.3.1 + # via dtool +dtool-s3==0.14.1 + # via -r requirements.in +dtool-symlink==0.3.1 + # via + # dtool + # dtool-create +dtool-tag==0.1.1 + # via dtool +dtoolcore==3.18.2 + # via + # -r requirements.in + # dtool + # dtool-annotation + # dtool-cli + # dtool-config + # dtool-create + # dtool-http + # dtool-info + # dtool-lookup-api + # dtool-overlay + # dtool-s3 + # dtool-symlink + # dtool-tag +entrypoints==0.4 + # via jupyter-client +et-xmlfile==1.1.0 + # via openpyxl +executing==1.1.1 + # via stack-data +fasteners==0.18 + # via mdanalysis +fireworks==2.0.3 + # via imteksimfw +flask==2.2.2 + # via + # fireworks + # flask-paginate +flask-paginate==2022.1.8 + # via fireworks +fonttools==4.38.0 + # via matplotlib +frozenlist==1.3.1 + # via + # aiohttp + # aiosignal +griddataformats==1.0.1 + # via mdanalysis +gromacs==0.0.0 + # via -r requirements.in +gromacswrapper==0.8.2 + # via -r requirements.in +gsd==2.6.0 + # via mdanalysis +gunicorn==20.1.0 + # via fireworks +idna==3.4 + # via + # requests + # yarl +importlib-metadata==5.0.0 + # via flask +imteksimfw==0.5.1 + # via -r requirements.in +ipykernel==6.16.2 + # via ipywidgets +ipython==8.5.0 + # via + # -r requirements.in + # ipykernel + # ipywidgets +ipywidgets==8.0.2 + # via + # -r requirements.in + # nglview +itsdangerous==2.1.2 + # via flask +jedi==0.18.1 + # via ipython +jinja2==3.1.2 + # via + # -r requirements.in + # dtool-info + # fireworks + # flask + # imteksimfw + # jinja2-time +jinja2-time==0.2.0 + # via imteksimfw +jmespath==1.0.1 + # via + # boto3 + # botocore +joblib==1.2.0 + # via + # mdanalysis + # scikit-learn +jupyter-client==7.4.4 + # via ipykernel +jupyter-core==4.11.2 + # via jupyter-client +jupyterlab-widgets==3.0.3 + # via + # ipywidgets + # nglview +kiwisolver==1.4.4 + # via matplotlib +markupsafe==2.1.1 + # via + # jinja2 + # werkzeug +matplotlib==3.6.0 + # via + # -r requirements.in + # ase + # gromacswrapper + # mdanalysis + # seaborn +matplotlib-inline==0.1.6 + # via + # ipykernel + # ipython +mdanalysis==2.3.0 + # via -r requirements.in +miniball==1.1.0 + # via -r requirements.in +mmtf-python==1.1.3 + # via mdanalysis +monty==2022.9.9 + # via + # fireworks + # imteksimfw +mrcfile==1.4.3 + # via griddataformats +msgpack==1.0.4 + # via mmtf-python +multidict==6.0.2 + # via + # aiohttp + # yarl +nest-asyncio==1.5.6 + # via + # ipykernel + # jupyter-client +networkx==2.8.7 + # via mdanalysis +nglview==3.0.3 + # via -r requirements.in +numkit==1.2.2 + # via gromacswrapper +numpy==1.23.4 + # via + # -r requirements.in + # ase + # biopython + # contourpy + # griddataformats + # gromacswrapper + # gsd + # matplotlib + # mdanalysis + # miniball + # mrcfile + # nglview + # numkit + # ovito + # pandas + # pyedr + # scikit-learn + # scipy + # seaborn +openpyxl==3.0.10 + # via -r requirements.in +ovito==3.6.0 + # via -r requirements.in +packaging==21.3 + # via + # dtool-s3 + # ipykernel + # matplotlib + # mdanalysis +pandas==1.5.1 + # via + # -r requirements.in + # panedr + # seaborn +panedr==0.7.0 + # via -r requirements.in +paramiko==2.11.0 + # via imteksimfw +parmed==3.4.3 + # via -r requirements.in +parse==1.19.0 + # via dtool-overlay +parso==0.8.3 + # via jedi +pbr==5.11.0 + # via + # panedr + # pyedr +pep517==0.13.0 + # via -r requirements.in +pexpect==4.8.0 + # via ipython +pickleshare==0.7.5 + # via ipython +pillow==9.2.0 + # via matplotlib +prompt-toolkit==3.0.31 + # via ipython +psutil==5.9.3 + # via ipykernel +ptyprocess==0.7.0 + # via pexpect +pure-eval==0.2.2 + # via stack-data +pycparser==2.21 + # via cffi +pyedr==0.7.0 + # via panedr +pygments==2.13.0 + # via + # dtool-info + # ipython +pymongo==4.3.2 + # via + # -r requirements.in + # fireworks +pynacl==1.5.0 + # via paramiko +pyparsing==3.0.9 + # via + # matplotlib + # packaging +pyside2==5.15.2.1 + # via + # -r requirements.in + # ovito +python-dateutil==2.8.2 + # via + # arrow + # botocore + # fireworks + # jupyter-client + # matplotlib + # pandas +pytz==2022.5 + # via pandas +pyyaml==6.0 + # via + # -r requirements.in + # dtool-lookup-api +pyzmq==24.0.1 + # via + # ipykernel + # jupyter-client +requests==2.28.1 + # via dtool-http +ruamel-yaml==0.17.21 + # via + # dtool-create + # fireworks + # imteksimfw +ruamel-yaml-clib==0.2.7 + # via ruamel-yaml +s3transfer==0.6.0 + # via boto3 +scikit-learn==1.1.3 + # via -r requirements.in +scipy==1.9.3 + # via + # -r requirements.in + # ase + # griddataformats + # mdanalysis + # numkit + # scikit-learn +seaborn==0.12.1 + # via -r requirements.in +shiboken2==5.15.2.1 + # via pyside2 +six==1.16.0 + # via + # asttokens + # fireworks + # gromacswrapper + # imteksimfw + # numkit + # paramiko + # python-dateutil +stack-data==0.5.1 + # via ipython +tabulate==0.9.0 + # via fireworks +threadpoolctl==3.1.0 + # via + # mdanalysis + # scikit-learn +tomli==2.0.1 + # via + # -r requirements.in + # pep517 +tornado==6.2 + # via + # ipykernel + # jupyter-client +tqdm==4.64.1 + # via + # fireworks + # mdanalysis +traitlets==5.5.0 + # via + # ipykernel + # ipython + # ipywidgets + # jupyter-client + # jupyter-core + # matplotlib-inline +urllib3==1.26.12 + # via + # botocore + # requests +wcwidth==0.2.5 + # via prompt-toolkit +werkzeug==2.2.2 + # via flask +widgetsnbextension==4.0.3 + # via ipywidgets +yarl==1.8.1 + # via aiohttp +zipp==3.10.0 + # via importlib-metadata + +# The following packages are considered to be unsafe in a requirements file: +# setuptools diff --git a/docker/jupyterlab/jupyterlab-SurfaceTopography/start-wrapper.sh b/docker/jupyterlab/jupyterlab-SurfaceTopography/start-wrapper.sh new file mode 100755 index 0000000..bfd6eef --- /dev/null +++ b/docker/jupyterlab/jupyterlab-SurfaceTopography/start-wrapper.sh @@ -0,0 +1,18 @@ +#!/bin/bash +set -e + +# delete and rebuild matplotlib font cache +rm -rf /home/${NB_USER}/.cache/matplotlib +fc-cache --force +python3 -c 'import matplotlib.font_manager; matplotlib.font_manager._load_fontmanager(try_read_cache=False)' + +echo +echo "matplotlib cache dir:" +echo +python3 -c "import matplotlib; print(matplotlib.get_cachedir())" +echo +echo "matplotlib fonts:" +echo +python3 -c "import matplotlib.font_manager ; [print(f) for f in matplotlib.font_manager.findSystemFonts(fontpaths=None)]" +echo +exec "$@" From dd340696e24d351b4a1de744dfb0dca1b4ecabdc Mon Sep 17 00:00:00 2001 From: Johannes Laurin Hoermann Date: Mon, 7 Nov 2022 13:24:37 +0100 Subject: [PATCH 02/14] DOC: README --- docker/jupyterlab/README.md | 4 ++++ docker/jupyterlab/jupyterlab-SurfaceTopography/README.md | 6 +++--- 2 files changed, 7 insertions(+), 3 deletions(-) create mode 100644 docker/jupyterlab/README.md diff --git a/docker/jupyterlab/README.md b/docker/jupyterlab/README.md new file mode 100644 index 0000000..b31e878 --- /dev/null +++ b/docker/jupyterlab/README.md @@ -0,0 +1,4 @@ +# Content + +Container recipes derived from the Jupyter Docker Stacks at https://jupyter-docker-stacks.readthedocs.io + diff --git a/docker/jupyterlab/jupyterlab-SurfaceTopography/README.md b/docker/jupyterlab/jupyterlab-SurfaceTopography/README.md index c991d84..451cd42 100644 --- a/docker/jupyterlab/jupyterlab-SurfaceTopography/README.md +++ b/docker/jupyterlab/jupyterlab-SurfaceTopography/README.md @@ -19,11 +19,11 @@ pip-compile requirements.in > requirements.txt Build container from parent directory (`docker/jupyterlab`) with - docker build -t imteksim/jupyterlab-SurfaceTopography -f jupyterlab-SurfaceTopography/Dockerfile . + docker build -t imteksim/jupyterlab-surfacetopography -f jupyterlab-SurfaceTopography/Dockerfile . or write directly to tar for transfer with - docker build --output type=tar,dest=imteksim-jupyterlab-SurfaceTopography.tar -t imteksim/jupyterlab-SurfaceTopography -f jupyterlab-SurfaceTopography/Dockerfile . + docker build --output type=tar,dest=imteksim-jupyterlab-SurfaceTopography.tar -t imteksim/jupyterlab-surfacetopography -f jupyterlab-SurfaceTopography/Dockerfile . and load at target destination with @@ -113,7 +113,7 @@ Run public Jupyter Lab on default https port with fixed password -v ${WORKDIR}:/home/jovyan/work \ -v ${FONTDIR}:/home/jovyan/.fonts \ -v ${CERTDIR}/${HOSTNAME}:/etc/ssl/notebook \ - imteksim/jupyterlab-SurfaceTopography \ + imteksim/jupyterlab-surfacetopography \ start-notebook.sh \ --ServerApp.keyfile=/etc/ssl/notebook/${HOSTNAME}.key \ --ServerApp.certfile=/etc/ssl/notebook/${HOSTNAME}.cer \ From b5e7ab434b868e6a388dd1f449e70f05b0925ef9 Mon Sep 17 00:00:00 2001 From: Antoine Sanner <40853209+sannant@users.noreply.github.com> Date: Wed, 9 Nov 2022 09:10:25 +0100 Subject: [PATCH 03/14] Add requirements --- .../jupyterlab/jupyterlab-SurfaceTopography/requirements.in | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/docker/jupyterlab/jupyterlab-SurfaceTopography/requirements.in b/docker/jupyterlab/jupyterlab-SurfaceTopography/requirements.in index 9a1a1b9..59c5e4c 100644 --- a/docker/jupyterlab/jupyterlab-SurfaceTopography/requirements.in +++ b/docker/jupyterlab/jupyterlab-SurfaceTopography/requirements.in @@ -30,3 +30,7 @@ PyYAML scipy scikit-learn seaborn +git+https://github.com/IMTEK-Simulation/code-snippets.git +pytest +ruamel.yaml +jupytext From bf82cb734ed596a16293e32212f1e8fae7c28acb Mon Sep 17 00:00:00 2001 From: Johannes Laurin Hoermann Date: Wed, 9 Nov 2022 09:30:12 +0100 Subject: [PATCH 04/14] DOC: Notes on modifying the container --- .../jupyterlab-SurfaceTopography/README.md | 12 ++++++++++++ .../jupyterlab-SurfaceTopography/requirements.in | 2 -- 2 files changed, 12 insertions(+), 2 deletions(-) diff --git a/docker/jupyterlab/jupyterlab-SurfaceTopography/README.md b/docker/jupyterlab/jupyterlab-SurfaceTopography/README.md index 451cd42..25dcd45 100644 --- a/docker/jupyterlab/jupyterlab-SurfaceTopography/README.md +++ b/docker/jupyterlab/jupyterlab-SurfaceTopography/README.md @@ -1,5 +1,17 @@ # Sample setup jupyterlab-SurfaceTopography +## Changes to the container + +This docker image bases on the [Jupyter Docker Stacks](https://jupyter-docker-stacks.readthedocs.io/en/latest/). +These base images use condato run a JupyterLab instance. Extensions to the Jupyter ecosystem (i.e. `jupytext`) +must hence go into the `conda-requirements.in` file. + +`SurfaceTopography` does not work well within a conda environment. Instead, this image introduces a separate +ipython kernel `SurfaceTopography? that just uses the container-internal system Python and a few system libraries, +i.e. `numpy`. Anything needed for production in connection with `SurfaceTopography` goes in `requirements.in` or +into `requirements.txt` directly. When modifying `requirements.in`, regenerate `requirments.txt`with pinned versions +as described below. + ## Python requirements To (re-)generate a `requirements.txt` with fixed package versions, use diff --git a/docker/jupyterlab/jupyterlab-SurfaceTopography/requirements.in b/docker/jupyterlab/jupyterlab-SurfaceTopography/requirements.in index 59c5e4c..8cbb163 100644 --- a/docker/jupyterlab/jupyterlab-SurfaceTopography/requirements.in +++ b/docker/jupyterlab/jupyterlab-SurfaceTopography/requirements.in @@ -32,5 +32,3 @@ scikit-learn seaborn git+https://github.com/IMTEK-Simulation/code-snippets.git pytest -ruamel.yaml -jupytext From bdd5607cc6b5231a419681ae8a4896a9d7e25d90 Mon Sep 17 00:00:00 2001 From: Johannes Laurin Hoermann Date: Wed, 9 Nov 2022 09:33:03 +0100 Subject: [PATCH 05/14] MAINT: sorted requirments.in --- docker/jupyterlab/jupyterlab-SurfaceTopography/requirements.in | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docker/jupyterlab/jupyterlab-SurfaceTopography/requirements.in b/docker/jupyterlab/jupyterlab-SurfaceTopography/requirements.in index 8cbb163..ebdcb25 100644 --- a/docker/jupyterlab/jupyterlab-SurfaceTopography/requirements.in +++ b/docker/jupyterlab/jupyterlab-SurfaceTopography/requirements.in @@ -25,10 +25,10 @@ pandas panedr ParmEd pymongo +pytest PySide2 PyYAML scipy scikit-learn seaborn git+https://github.com/IMTEK-Simulation/code-snippets.git -pytest From c126786c87a83432b5c889c95bd28c573c5ad3b6 Mon Sep 17 00:00:00 2001 From: Johannes Laurin Hoermann Date: Wed, 9 Nov 2022 09:33:24 +0100 Subject: [PATCH 06/14] MAINT: regenerated requirements.txt --- .../requirements.txt | 57 ++++++++++++------- 1 file changed, 37 insertions(+), 20 deletions(-) diff --git a/docker/jupyterlab/jupyterlab-SurfaceTopography/requirements.txt b/docker/jupyterlab/jupyterlab-SurfaceTopography/requirements.txt index 03c0fbb..a152c12 100644 --- a/docker/jupyterlab/jupyterlab-SurfaceTopography/requirements.txt +++ b/docker/jupyterlab/jupyterlab-SurfaceTopography/requirements.txt @@ -6,7 +6,7 @@ # aiohttp==3.8.3 # via dtool-lookup-api -aiosignal==1.2.0 +aiosignal==1.3.1 # via aiohttp arrow==1.2.3 # via jinja2-time @@ -16,21 +16,23 @@ asgiref==3.5.2 # via # -r requirements.in # dtool-lookup-api -asttokens==2.0.8 +asttokens==2.1.0 # via stack-data async-timeout==4.0.2 # via aiohttp attrs==22.1.0 - # via aiohttp + # via + # aiohttp + # pytest backcall==0.2.0 # via ipython bcrypt==4.0.1 # via paramiko biopython==1.79 # via mdanalysis -boto3==1.25.2 +boto3==1.26.5 # via dtool-s3 -botocore==1.28.2 +botocore==1.29.5 # via # boto3 # s3transfer @@ -59,9 +61,9 @@ click==8.1.3 # flask click-plugins==1.1.1 # via dtool-cli -contourpy==1.0.5 +contourpy==1.0.6 # via matplotlib -cryptography==38.0.1 +cryptography==38.0.3 # via paramiko cycler==0.11.0 # via @@ -133,7 +135,9 @@ entrypoints==0.4 # via jupyter-client et-xmlfile==1.1.0 # via openpyxl -executing==1.1.1 +exceptiongroup==1.0.1 + # via pytest +executing==1.2.0 # via stack-data fasteners==0.18 # via mdanalysis @@ -147,7 +151,7 @@ flask-paginate==2022.1.8 # via fireworks fonttools==4.38.0 # via matplotlib -frozenlist==1.3.1 +frozenlist==1.3.3 # via # aiohttp # aiosignal @@ -157,7 +161,7 @@ gromacs==0.0.0 # via -r requirements.in gromacswrapper==0.8.2 # via -r requirements.in -gsd==2.6.0 +gsd==2.6.1 # via mdanalysis gunicorn==20.1.0 # via fireworks @@ -167,11 +171,15 @@ idna==3.4 # yarl importlib-metadata==5.0.0 # via flask +imteksimcs @ git+https://github.com/IMTEK-Simulation/code-snippets.git + # via -r requirements.in imteksimfw==0.5.1 # via -r requirements.in -ipykernel==6.16.2 +iniconfig==1.1.1 + # via pytest +ipykernel==6.17.0 # via ipywidgets -ipython==8.5.0 +ipython==8.6.0 # via # -r requirements.in # ipykernel @@ -216,7 +224,7 @@ markupsafe==2.1.1 # via # jinja2 # werkzeug -matplotlib==3.6.0 +matplotlib==3.6.2 # via # -r requirements.in # ase @@ -249,7 +257,7 @@ nest-asyncio==1.5.6 # via # ipykernel # jupyter-client -networkx==2.8.7 +networkx==2.8.8 # via mdanalysis nglview==3.0.3 # via -r requirements.in @@ -264,6 +272,7 @@ numpy==1.23.4 # griddataformats # gromacswrapper # gsd + # imteksimcs # matplotlib # mdanalysis # miniball @@ -286,14 +295,16 @@ packaging==21.3 # ipykernel # matplotlib # mdanalysis + # pytest pandas==1.5.1 # via # -r requirements.in + # imteksimcs # panedr # seaborn panedr==0.7.0 # via -r requirements.in -paramiko==2.11.0 +paramiko==2.12.0 # via imteksimfw parmed==3.4.3 # via -r requirements.in @@ -311,11 +322,13 @@ pexpect==4.8.0 # via ipython pickleshare==0.7.5 # via ipython -pillow==9.2.0 +pillow==9.3.0 # via matplotlib -prompt-toolkit==3.0.31 +pluggy==1.0.0 + # via pytest +prompt-toolkit==3.0.32 # via ipython -psutil==5.9.3 +psutil==5.9.4 # via ipykernel ptyprocess==0.7.0 # via pexpect @@ -343,6 +356,8 @@ pyside2==5.15.2.1 # via # -r requirements.in # ovito +pytest==7.2.0 + # via -r requirements.in python-dateutil==2.8.2 # via # arrow @@ -351,7 +366,7 @@ python-dateutil==2.8.2 # jupyter-client # matplotlib # pandas -pytz==2022.5 +pytz==2022.6 # via pandas pyyaml==6.0 # via @@ -379,6 +394,7 @@ scipy==1.9.3 # -r requirements.in # ase # griddataformats + # imteksimcs # mdanalysis # numkit # scikit-learn @@ -395,7 +411,7 @@ six==1.16.0 # numkit # paramiko # python-dateutil -stack-data==0.5.1 +stack-data==0.6.0 # via ipython tabulate==0.9.0 # via fireworks @@ -407,6 +423,7 @@ tomli==2.0.1 # via # -r requirements.in # pep517 + # pytest tornado==6.2 # via # ipykernel From ca07d9504400e374c8d79b13d2f1f697a4b377f5 Mon Sep 17 00:00:00 2001 From: Johannes Laurin Hoermann Date: Wed, 9 Nov 2022 09:41:03 +0100 Subject: [PATCH 07/14] DOC: Note on installing packages in running container --- .../jupyterlab/jupyterlab-SurfaceTopography/README.md | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/docker/jupyterlab/jupyterlab-SurfaceTopography/README.md b/docker/jupyterlab/jupyterlab-SurfaceTopography/README.md index 25dcd45..6e41b90 100644 --- a/docker/jupyterlab/jupyterlab-SurfaceTopography/README.md +++ b/docker/jupyterlab/jupyterlab-SurfaceTopography/README.md @@ -7,11 +7,19 @@ These base images use condato run a JupyterLab instance. Extensions to the Jupyt must hence go into the `conda-requirements.in` file. `SurfaceTopography` does not work well within a conda environment. Instead, this image introduces a separate -ipython kernel `SurfaceTopography? that just uses the container-internal system Python and a few system libraries, +ipython kernel `SurfaceTopography` that just uses the container-internal system Python and a few system libraries, i.e. `numpy`. Anything needed for production in connection with `SurfaceTopography` goes in `requirements.in` or into `requirements.txt` directly. When modifying `requirements.in`, regenerate `requirments.txt`with pinned versions as described below. +If in need to quickly modify the `SurfaceTopography` kernel environment at runtime, pay attention to +breaking out of the default conda enviornment in the shell + +* `conda deactivate`, and +* removing any conda-related artifacts from the `$PATH`, i.e. with `export PATH=$(echo "$PATH" | sed -e 's|/opt/conda[^:]*:||g')` + +The latter is necessary to avoid conda compiler interfering with custom build steps when compiling against system libraries. + ## Python requirements To (re-)generate a `requirements.txt` with fixed package versions, use From 56f47eda049c466db41d27d2ffbd03ad5bd15e16 Mon Sep 17 00:00:00 2001 From: Johannes Laurin Hoermann Date: Wed, 9 Nov 2022 09:58:48 +0100 Subject: [PATCH 08/14] MAINT: added contactmechanics --- docker/jupyterlab/jupyterlab-SurfaceTopography/requirements.in | 1 + 1 file changed, 1 insertion(+) diff --git a/docker/jupyterlab/jupyterlab-SurfaceTopography/requirements.in b/docker/jupyterlab/jupyterlab-SurfaceTopography/requirements.in index ebdcb25..fcf66d2 100644 --- a/docker/jupyterlab/jupyterlab-SurfaceTopography/requirements.in +++ b/docker/jupyterlab/jupyterlab-SurfaceTopography/requirements.in @@ -3,6 +3,7 @@ pep517 tomli ase asgiref +contactmechanics cycler dtool dtool_lookup_api From 1c98cc70f5c52c5e19b8d2e7d3be189b09f8c85c Mon Sep 17 00:00:00 2001 From: Johannes Laurin Hoermann Date: Wed, 9 Nov 2022 10:00:33 +0100 Subject: [PATCH 09/14] WIP: see whether contactmechanics and its dependencies work by just adding to requirements.txt --- .../requirements.txt | 39 ++++++++++++++++++- 1 file changed, 37 insertions(+), 2 deletions(-) diff --git a/docker/jupyterlab/jupyterlab-SurfaceTopography/requirements.txt b/docker/jupyterlab/jupyterlab-SurfaceTopography/requirements.txt index a152c12..f2cbc5c 100644 --- a/docker/jupyterlab/jupyterlab-SurfaceTopography/requirements.txt +++ b/docker/jupyterlab/jupyterlab-SurfaceTopography/requirements.txt @@ -61,6 +61,8 @@ click==8.1.3 # flask click-plugins==1.1.1 # via dtool-cli +contactmechanics==1.0.0 + # via -r requirements.in contourpy==1.0.6 # via matplotlib cryptography==38.0.3 @@ -73,6 +75,8 @@ debugpy==1.6.3 # via ipykernel decorator==5.1.1 # via ipython +defusedxml==0.7.1 + # via surfacetopography dill==0.3.6 # via imteksimfw dnspython==2.2.1 @@ -165,10 +169,14 @@ gsd==2.6.1 # via mdanalysis gunicorn==20.1.0 # via fireworks +h5py==3.7.0 + # via surfacetopography idna==3.4 # via # requests # yarl +igor==0.3 + # via surfacetopography importlib-metadata==5.0.0 # via flask imteksimcs @ git+https://github.com/IMTEK-Simulation/code-snippets.git @@ -231,6 +239,7 @@ matplotlib==3.6.2 # gromacswrapper # mdanalysis # seaborn + # surfacetopography matplotlib-inline==0.1.6 # via # ipykernel @@ -245,10 +254,16 @@ monty==2022.9.9 # via # fireworks # imteksimfw +mpi4py==3.1.4 + # via mufft mrcfile==1.4.3 # via griddataformats msgpack==1.0.4 # via mmtf-python +mufft==0.23.1 + # via + # contactmechanics + # surfacetopography multidict==6.0.2 # via # aiohttp @@ -263,28 +278,40 @@ nglview==3.0.3 # via -r requirements.in numkit==1.2.2 # via gromacswrapper +numpi==0.3.1 + # via + # contactmechanics + # surfacetopography numpy==1.23.4 # via # -r requirements.in # ase # biopython + # contactmechanics # contourpy # griddataformats # gromacswrapper # gsd + # h5py # imteksimcs # matplotlib # mdanalysis # miniball # mrcfile + # mufft # nglview # numkit + # numpi + # numpyencoder # ovito # pandas # pyedr # scikit-learn # scipy # seaborn + # surfacetopography +numpyencoder==0.3.0 + # via surfacetopography openpyxl==3.0.10 # via -r requirements.in ovito==3.6.0 @@ -323,7 +350,9 @@ pexpect==4.8.0 pickleshare==0.7.5 # via ipython pillow==9.3.0 - # via matplotlib + # via + # matplotlib + # surfacetopography pluggy==1.0.0 # via pytest prompt-toolkit==3.0.32 @@ -366,18 +395,22 @@ python-dateutil==2.8.2 # jupyter-client # matplotlib # pandas + # surfacetopography pytz==2022.6 # via pandas pyyaml==6.0 # via # -r requirements.in # dtool-lookup-api + # surfacetopography pyzmq==24.0.1 # via # ipykernel # jupyter-client requests==2.28.1 - # via dtool-http + # via + # dtool-http + # surfacetopography ruamel-yaml==0.17.21 # via # dtool-create @@ -413,6 +446,8 @@ six==1.16.0 # python-dateutil stack-data==0.6.0 # via ipython +surfacetopography==1.1 + # via contactmechanics tabulate==0.9.0 # via fireworks threadpoolctl==3.1.0 From fecdf66528097322de66b712d471277dd0c31322 Mon Sep 17 00:00:00 2001 From: Johannes Laurin Hoermann Date: Wed, 9 Nov 2022 10:56:05 +0100 Subject: [PATCH 10/14] MAINT: manually removed mpi4py dep again --- docker/jupyterlab/jupyterlab-SurfaceTopography/requirements.txt | 2 -- 1 file changed, 2 deletions(-) diff --git a/docker/jupyterlab/jupyterlab-SurfaceTopography/requirements.txt b/docker/jupyterlab/jupyterlab-SurfaceTopography/requirements.txt index f2cbc5c..9fdcf41 100644 --- a/docker/jupyterlab/jupyterlab-SurfaceTopography/requirements.txt +++ b/docker/jupyterlab/jupyterlab-SurfaceTopography/requirements.txt @@ -254,8 +254,6 @@ monty==2022.9.9 # via # fireworks # imteksimfw -mpi4py==3.1.4 - # via mufft mrcfile==1.4.3 # via griddataformats msgpack==1.0.4 From 4a9eaa6c3bbe4a0b9d13263452c70a4759c8913a Mon Sep 17 00:00:00 2001 From: sannant Date: Wed, 9 Nov 2022 11:24:14 +0100 Subject: [PATCH 11/14] add adhesion --- docker/jupyterlab/jupyterlab-SurfaceTopography/requirements.in | 1 + 1 file changed, 1 insertion(+) diff --git a/docker/jupyterlab/jupyterlab-SurfaceTopography/requirements.in b/docker/jupyterlab/jupyterlab-SurfaceTopography/requirements.in index fcf66d2..33cc704 100644 --- a/docker/jupyterlab/jupyterlab-SurfaceTopography/requirements.in +++ b/docker/jupyterlab/jupyterlab-SurfaceTopography/requirements.in @@ -1,6 +1,7 @@ click pep517 tomli +adhesion ase asgiref contactmechanics From 55a223420e641bdf7ea6a17bf39cbc6c5a5cb773 Mon Sep 17 00:00:00 2001 From: Johannes Laurin Hoermann Date: Wed, 9 Nov 2022 14:15:15 +0100 Subject: [PATCH 12/14] ENH: adhesion in requirements.txt --- .../requirements.txt | 17 ++++++++++++++--- 1 file changed, 14 insertions(+), 3 deletions(-) diff --git a/docker/jupyterlab/jupyterlab-SurfaceTopography/requirements.txt b/docker/jupyterlab/jupyterlab-SurfaceTopography/requirements.txt index 9fdcf41..d87e00b 100644 --- a/docker/jupyterlab/jupyterlab-SurfaceTopography/requirements.txt +++ b/docker/jupyterlab/jupyterlab-SurfaceTopography/requirements.txt @@ -4,6 +4,8 @@ # # pip-compile requirements.in # +adhesion==0.90.0 + # via -r requirements.in aiohttp==3.8.3 # via dtool-lookup-api aiosignal==1.3.1 @@ -62,7 +64,9 @@ click==8.1.3 click-plugins==1.1.1 # via dtool-cli contactmechanics==1.0.0 - # via -r requirements.in + # via + # -r requirements.in + # adhesion contourpy==1.0.6 # via matplotlib cryptography==38.0.3 @@ -220,7 +224,7 @@ joblib==1.2.0 # scikit-learn jupyter-client==7.4.4 # via ipykernel -jupyter-core==4.11.2 +jupyter-core==5.0.0 # via jupyter-client jupyterlab-widgets==3.0.3 # via @@ -260,6 +264,7 @@ msgpack==1.0.4 # via mmtf-python mufft==0.23.1 # via + # adhesion # contactmechanics # surfacetopography multidict==6.0.2 @@ -278,11 +283,13 @@ numkit==1.2.2 # via gromacswrapper numpi==0.3.1 # via + # adhesion # contactmechanics # surfacetopography numpy==1.23.4 # via # -r requirements.in + # adhesion # ase # biopython # contactmechanics @@ -351,6 +358,8 @@ pillow==9.3.0 # via # matplotlib # surfacetopography +platformdirs==2.5.3 + # via jupyter-core pluggy==1.0.0 # via pytest prompt-toolkit==3.0.32 @@ -445,7 +454,9 @@ six==1.16.0 stack-data==0.6.0 # via ipython surfacetopography==1.1 - # via contactmechanics + # via + # adhesion + # contactmechanics tabulate==0.9.0 # via fireworks threadpoolctl==3.1.0 From 076076996f3f1a6cf81b3912820b04dd0b3d62a9 Mon Sep 17 00:00:00 2001 From: Johannes Laurin Hoermann Date: Thu, 10 Nov 2022 17:04:30 +0100 Subject: [PATCH 13/14] WIP: An attempt to make this image independent on user 'jovyan' --- .../jupyterlab-SurfaceTopography/Dockerfile | 31 ++++++++++++------- .../jupyterlab-SurfaceTopography/README.md | 2 +- .../etc/fonts.conf | 2 +- .../start-wrapper.sh | 6 ++-- 4 files changed, 24 insertions(+), 17 deletions(-) diff --git a/docker/jupyterlab/jupyterlab-SurfaceTopography/Dockerfile b/docker/jupyterlab/jupyterlab-SurfaceTopography/Dockerfile index c60152f..50ecdfd 100644 --- a/docker/jupyterlab/jupyterlab-SurfaceTopography/Dockerfile +++ b/docker/jupyterlab/jupyterlab-SurfaceTopography/Dockerfile @@ -1,7 +1,9 @@ # Build from within repository root # # Modify conda enviornment running jupyter notebooks -FROM jupyter/scipy-notebook:latest +FROM jupyter/minimal-notebook:latest + +USER root COPY --chown=${NB_UID}:${NB_GID} jupyterlab-SurfaceTopography/conda-requirements.in "/home/${NB_USER}/" RUN pip install pip-tools @@ -12,7 +14,6 @@ RUN pip install --quiet --no-cache-dir --requirement "/home/${NB_USER}/conda-req # FROM imkteksim/dtool-jupyter:latest # Install from requirements.txt file -USER root RUN apt-get --yes update && \ apt-get --yes install \ clang cmake curl g++ gdb git m4 wget \ @@ -29,28 +30,34 @@ RUN apt-get --yes update && \ python3-netcdf4 && \ apt-get clean && \ rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/* -USER ${NB_UID} # Workaround for building packages and introducing an ipykernel outside of the jupyterlab conda environment RUN PATH=$(echo "$PATH" | sed -e 's|/opt/conda[^:]*:||g') && ( \ pip install --no-binary numpy SurfaceTopography && \ pip install ipykernel && \ - python3 -m ipykernel install --user --name SurfaceTopography --display-name "Python (SurfaceTopography)" && \ - echo "c.MultiKernelManager.default_kernel_name = 'SurfaceTopography'" >> ${HOME}/.jupyter/jupyter_notebook_config.py) && \ + python3 -m ipykernel install --name SurfaceTopography --display-name "Python (SurfaceTopography)") && \ fix-permissions "${CONDA_DIR}" && \ fix-permissions "/home/${NB_USER}" # Workaround for modifying system python outside of the jupyterlab conda environment COPY --chown=${NB_UID}:${NB_GID} jupyterlab-SurfaceTopography/requirements.txt "/home/${NB_USER}/" -RUN PATH="/home/${NB_USER}/.local/bin:$(echo "$PATH" | sed -e 's|/opt/conda[^:]*:||g')" && ( \ +RUN PATH="$(echo "$PATH" | sed -e 's|/opt/conda[^:]*:||g')" && ( \ pip install --quiet --no-cache-dir --requirement "/home/${NB_USER}/requirements.txt" ) -WORKDIR /home/jovyan/work +COPY jupyterlab-SurfaceTopography/start-wrapper.sh /usr/local/bin/ # Custom fonts config -COPY jupyterlab-SurfaceTopography/start-wrapper.sh /usr/local/bin/ -RUN mkdir -p /home/${NB_USER}/.config/fontconfig -COPY jupyterlab-SurfaceTopography/etc/fonts.conf /home/${NB_USER}/.config/fontconfig/fonts.conf -RUN mkdir -p /home/${NB_USER}/.fonts -RUN rm -rf /home/${NB_USER}/.cache/matplotlib +COPY jupyterlab-SurfaceTopography/etc/fonts.conf /etc/fonts/conf.avail/99-injected.conf +RUN ln -s /etc/fonts/conf.avail/99-injected.conf /etc/fonts/conf.d/99-injected.conf +RUN mkdir -p /fonts + +# Install from requirements.txt file +RUN apt-get --yes update && \ + apt-get --yes install fontconfig && \ + apt-get clean && \ + rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/* + +WORKDIR /home/${NB_USER}/work +USER ${NB_UID} + CMD ["start-wrapper.sh", "start-notebook.sh"] diff --git a/docker/jupyterlab/jupyterlab-SurfaceTopography/README.md b/docker/jupyterlab/jupyterlab-SurfaceTopography/README.md index 6e41b90..7af3aff 100644 --- a/docker/jupyterlab/jupyterlab-SurfaceTopography/README.md +++ b/docker/jupyterlab/jupyterlab-SurfaceTopography/README.md @@ -131,7 +131,7 @@ Run public Jupyter Lab on default https port with fixed password docker run -d --rm -p 443:443 \ -v ${WORKDIR}:/home/jovyan/work \ - -v ${FONTDIR}:/home/jovyan/.fonts \ + -v ${FONTDIR}:/fonts \ -v ${CERTDIR}/${HOSTNAME}:/etc/ssl/notebook \ imteksim/jupyterlab-surfacetopography \ start-notebook.sh \ diff --git a/docker/jupyterlab/jupyterlab-SurfaceTopography/etc/fonts.conf b/docker/jupyterlab/jupyterlab-SurfaceTopography/etc/fonts.conf index f8b8752..0a2f35e 100644 --- a/docker/jupyterlab/jupyterlab-SurfaceTopography/etc/fonts.conf +++ b/docker/jupyterlab/jupyterlab-SurfaceTopography/etc/fonts.conf @@ -2,5 +2,5 @@ -~/.fonts +/fonts diff --git a/docker/jupyterlab/jupyterlab-SurfaceTopography/start-wrapper.sh b/docker/jupyterlab/jupyterlab-SurfaceTopography/start-wrapper.sh index bfd6eef..3294f28 100755 --- a/docker/jupyterlab/jupyterlab-SurfaceTopography/start-wrapper.sh +++ b/docker/jupyterlab/jupyterlab-SurfaceTopography/start-wrapper.sh @@ -4,15 +4,15 @@ set -e # delete and rebuild matplotlib font cache rm -rf /home/${NB_USER}/.cache/matplotlib fc-cache --force -python3 -c 'import matplotlib.font_manager; matplotlib.font_manager._load_fontmanager(try_read_cache=False)' +PATH=$(echo "$PATH" | sed -e 's|/opt/conda[^:]*:||g') python3 -c 'import matplotlib.font_manager; matplotlib.font_manager._load_fontmanager(try_read_cache=False)' echo echo "matplotlib cache dir:" echo -python3 -c "import matplotlib; print(matplotlib.get_cachedir())" +PATH=$(echo "$PATH" | sed -e 's|/opt/conda[^:]*:||g') python3 -c "import matplotlib; print(matplotlib.get_cachedir())" echo echo "matplotlib fonts:" echo -python3 -c "import matplotlib.font_manager ; [print(f) for f in matplotlib.font_manager.findSystemFonts(fontpaths=None)]" +PATH=$(echo "$PATH" | sed -e 's|/opt/conda[^:]*:||g') python3 -c "import matplotlib.font_manager ; [print(f) for f in matplotlib.font_manager.findSystemFonts(fontpaths=None)]" echo exec "$@" From 1cc10caa4c7255c074931fc87e943bc314adcc56 Mon Sep 17 00:00:00 2001 From: Johannes Laurin Hoermann Date: Thu, 10 Nov 2022 21:43:54 +0100 Subject: [PATCH 14/14] MAINT: don't delete font cache --- docker/jupyterlab/jupyterlab-SurfaceTopography/start-wrapper.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docker/jupyterlab/jupyterlab-SurfaceTopography/start-wrapper.sh b/docker/jupyterlab/jupyterlab-SurfaceTopography/start-wrapper.sh index 3294f28..67c2320 100755 --- a/docker/jupyterlab/jupyterlab-SurfaceTopography/start-wrapper.sh +++ b/docker/jupyterlab/jupyterlab-SurfaceTopography/start-wrapper.sh @@ -2,7 +2,7 @@ set -e # delete and rebuild matplotlib font cache -rm -rf /home/${NB_USER}/.cache/matplotlib +# rm -rf /home/${NB_USER}/.cache/matplotlib fc-cache --force PATH=$(echo "$PATH" | sed -e 's|/opt/conda[^:]*:||g') python3 -c 'import matplotlib.font_manager; matplotlib.font_manager._load_fontmanager(try_read_cache=False)'