Skip to content

Commit

Permalink
use vtk with osmesa and improve image build (#7)
Browse files Browse the repository at this point in the history
* use vtk with osmesa

* remove unused extensions

* cleanup pyvista test

* use main branch of vtk wheels repo
  • Loading branch information
akaszynski authored Jan 11, 2022
1 parent edbc075 commit 8b607b4
Show file tree
Hide file tree
Showing 11 changed files with 154 additions and 1,020 deletions.
15 changes: 9 additions & 6 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,22 +1,22 @@
FROM jupyter/base-notebook:hub-1.5.0
FROM jupyter/base-notebook:hub-2.0.1

MAINTAINER PyAnsys Maintainers "pyansys.maintainers@ansys.com"

USER root

RUN apt-get update \
&& DEBIAN_FRONTEND="noninteractive" apt-get install -yq --no-install-recommends \
&& DEBIAN_FRONTEND="noninteractive" apt-get install -yq --no-install-recommends \
libgl1-mesa-glx \
libglu1-mesa \
libsm6 \
xvfb \
libopengl0 \
libegl1 \
software-properties-common \
keyboard-configuration \
kmod \
libglvnd-dev \
pkg-config \
libosmesa6 \
&& apt-get clean && rm -rf /var/lib/apt/lists/*

USER jovyan
Expand All @@ -25,10 +25,13 @@ USER jovyan
RUN conda update -n base conda
RUN conda install mamba -n base -c conda-forge

# install extensions
COPY environment.yml labextensions.txt /tmp/
# install enviornment
COPY environment.yml /tmp/
RUN mamba env update -n base --file /tmp/environment.yml
RUN conda run jupyter labextension install $(cat /tmp/labextensions.txt)

# override vtk with custom VTK with OSMesa
# don't uninstall VTK as cadquery depends on some of the libraries, but ignore it so we can keep then while getting the benefits for osmesa
RUN pip install https://github.com/pyvista/pyvista-wheels/raw/main/vtk-osmesa-9.1.0-cp39-cp39-linux_x86_64.whl --ignore-installed

# make jovyan sudo
USER root
Expand Down
1 change: 1 addition & 0 deletions build_and_run_image.sh
Original file line number Diff line number Diff line change
Expand Up @@ -10,4 +10,5 @@ docker run -it --rm \
-v /home/$USER/python:/mnt/python \
-v /tmp:/mnt/tmp \
-v `pwd`/test_notebooks:/home/jovyan/test_notebooks \
-e JUPYTER_ENABLE_LAB=yes \
-p 8888:8888 "$IMAGE"
9 changes: 4 additions & 5 deletions environment.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,17 +11,16 @@ dependencies:
- ipycanvas=0.10.2
- ipyevents=2.0.1
- ipygany=0.5.0
- ipympl=0.8.4
- ipympl=0.8.5
- ipyvtklink==0.2.1
- ipywidgets=7.6.5
- jupyter-dash=0.4.0
- jupyterlab=3.2.5
- jupyterlab=3.2.6
- networkx=2.6.3
- pandas=1.3.5
- panel=0.12.6
- pip=21.3
- plotly=5.4.0
- pyvista=0.32.1
- plotly=5.5.0
- pyvista=0.33.0
- pythreejs=2.3.0
- pip:
- jupyter-cadquery==2.2.1
Expand Down
3 changes: 0 additions & 3 deletions labextensions.txt

This file was deleted.

45 changes: 6 additions & 39 deletions test_notebooks/cadquery.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -2,18 +2,10 @@
"cells": [
{
"cell_type": "code",
"execution_count": 3,
"execution_count": null,
"id": "streaming-trinity",
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"Overwriting auto display for cadquery Workplane and Shape\n"
]
}
],
"outputs": [],
"source": [
"import warnings\n",
"warnings.filterwarnings(\"ignore\")\n",
Expand Down Expand Up @@ -77,35 +69,10 @@
},
{
"cell_type": "code",
"execution_count": 4,
"execution_count": null,
"id": "agricultural-blend",
"metadata": {},
"outputs": [
{
"data": {
"application/vnd.jupyter.widget-view+json": {
"model_id": "69757b311cce40d2b6bf5d02764171e5",
"version_major": 2,
"version_minor": 0
},
"text/plain": [
"HBox(children=(VBox(children=(HBox(children=(Checkbox(value=False, description='Axes', indent=False, _dom_clas…"
]
},
"metadata": {},
"output_type": "display_data"
},
{
"data": {
"text/plain": [
"<jupyter_cadquery.cad_display.CadqueryDisplay at 0x7fa806d74a60>"
]
},
"execution_count": 4,
"metadata": {},
"output_type": "execute_result"
}
],
"outputs": [],
"source": [
"block = make_block(2, 2, True)\n",
"show(block)"
Expand All @@ -114,7 +81,7 @@
],
"metadata": {
"kernelspec": {
"display_name": "Python 3",
"display_name": "Python 3 (ipykernel)",
"language": "python",
"name": "python3"
},
Expand All @@ -128,7 +95,7 @@
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.8.5"
"version": "3.9.7"
}
},
"nbformat": 4,
Expand Down
57 changes: 35 additions & 22 deletions test_notebooks/import-all.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -3,41 +3,54 @@
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"# Import all the packages from environment.yml\n",
"import jupyterlab\n",
"import ipywidgets\n",
"import pandas\n",
"import ipygany\n",
"import pyvista\n",
"import panel\n",
"import plotly\n",
"import cadquery\n",
"import networkx\n",
"import colour\n",
"import ipympl\n",
"import ipyevents\n",
"import ipycanvas\n",
"import dash\n",
"import dash_bootstrap_components\n",
"import pip\n",
"import dash_treeview_antd\n",
"import dash_vtk\n",
"import ipycanvas\n",
"import ipyevents\n",
"import ipygany\n",
"import ipympl\n",
"import ipyvtklink\n",
"import ipywidgets\n",
"import jupyter_cadquery\n",
"import dash_vtk\n",
"import dash_treeview_antd\n",
"import jupyterlab\n",
"import networkx\n",
"import pandas\n",
"import panel\n",
"import pip\n",
"import plotly\n",
"import pyvista\n",
"\n",
"# Uncovered: jupyter-dash, cairo"
],
"outputs": [],
"metadata": {}
"# Uncovered: cairo"
]
}
],
"metadata": {
"orig_nbformat": 4,
"kernelspec": {
"display_name": "Python 3 (ipykernel)",
"language": "python",
"name": "python3"
},
"language_info": {
"name": "python"
"codemirror_mode": {
"name": "ipython",
"version": 3
},
"file_extension": ".py",
"mimetype": "text/x-python",
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.9.7"
}
},
"nbformat": 4,
"nbformat_minor": 2
}
"nbformat_minor": 4
}
Loading

0 comments on commit 8b607b4

Please sign in to comment.