Skip to content

Commit 8b607b4

Browse files
authored
use vtk with osmesa and improve image build (#7)
* use vtk with osmesa * remove unused extensions * cleanup pyvista test * use main branch of vtk wheels repo
1 parent edbc075 commit 8b607b4

11 files changed

+154
-1020
lines changed

Dockerfile

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,22 @@
1-
FROM jupyter/base-notebook:hub-1.5.0
1+
FROM jupyter/base-notebook:hub-2.0.1
22

33
MAINTAINER PyAnsys Maintainers "[email protected]"
44

55
USER root
66

77
RUN apt-get update \
8-
&& DEBIAN_FRONTEND="noninteractive" apt-get install -yq --no-install-recommends \
8+
&& DEBIAN_FRONTEND="noninteractive" apt-get install -yq --no-install-recommends \
99
libgl1-mesa-glx \
1010
libglu1-mesa \
1111
libsm6 \
12-
xvfb \
1312
libopengl0 \
1413
libegl1 \
1514
software-properties-common \
1615
keyboard-configuration \
1716
kmod \
1817
libglvnd-dev \
1918
pkg-config \
19+
libosmesa6 \
2020
&& apt-get clean && rm -rf /var/lib/apt/lists/*
2121

2222
USER jovyan
@@ -25,10 +25,13 @@ USER jovyan
2525
RUN conda update -n base conda
2626
RUN conda install mamba -n base -c conda-forge
2727

28-
# install extensions
29-
COPY environment.yml labextensions.txt /tmp/
28+
# install enviornment
29+
COPY environment.yml /tmp/
3030
RUN mamba env update -n base --file /tmp/environment.yml
31-
RUN conda run jupyter labextension install $(cat /tmp/labextensions.txt)
31+
32+
# override vtk with custom VTK with OSMesa
33+
# 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
34+
RUN pip install https://github.com/pyvista/pyvista-wheels/raw/main/vtk-osmesa-9.1.0-cp39-cp39-linux_x86_64.whl --ignore-installed
3235

3336
# make jovyan sudo
3437
USER root

build_and_run_image.sh

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,4 +10,5 @@ docker run -it --rm \
1010
-v /home/$USER/python:/mnt/python \
1111
-v /tmp:/mnt/tmp \
1212
-v `pwd`/test_notebooks:/home/jovyan/test_notebooks \
13+
-e JUPYTER_ENABLE_LAB=yes \
1314
-p 8888:8888 "$IMAGE"

environment.yml

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -11,17 +11,16 @@ dependencies:
1111
- ipycanvas=0.10.2
1212
- ipyevents=2.0.1
1313
- ipygany=0.5.0
14-
- ipympl=0.8.4
14+
- ipympl=0.8.5
1515
- ipyvtklink==0.2.1
1616
- ipywidgets=7.6.5
17-
- jupyter-dash=0.4.0
18-
- jupyterlab=3.2.5
17+
- jupyterlab=3.2.6
1918
- networkx=2.6.3
2019
- pandas=1.3.5
2120
- panel=0.12.6
2221
- pip=21.3
23-
- plotly=5.4.0
24-
- pyvista=0.32.1
22+
- plotly=5.5.0
23+
- pyvista=0.33.0
2524
- pythreejs=2.3.0
2625
- pip:
2726
- jupyter-cadquery==2.2.1

labextensions.txt

Lines changed: 0 additions & 3 deletions
This file was deleted.

test_notebooks/cadquery.ipynb

Lines changed: 6 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -2,18 +2,10 @@
22
"cells": [
33
{
44
"cell_type": "code",
5-
"execution_count": 3,
5+
"execution_count": null,
66
"id": "streaming-trinity",
77
"metadata": {},
8-
"outputs": [
9-
{
10-
"name": "stdout",
11-
"output_type": "stream",
12-
"text": [
13-
"Overwriting auto display for cadquery Workplane and Shape\n"
14-
]
15-
}
16-
],
8+
"outputs": [],
179
"source": [
1810
"import warnings\n",
1911
"warnings.filterwarnings(\"ignore\")\n",
@@ -77,35 +69,10 @@
7769
},
7870
{
7971
"cell_type": "code",
80-
"execution_count": 4,
72+
"execution_count": null,
8173
"id": "agricultural-blend",
8274
"metadata": {},
83-
"outputs": [
84-
{
85-
"data": {
86-
"application/vnd.jupyter.widget-view+json": {
87-
"model_id": "69757b311cce40d2b6bf5d02764171e5",
88-
"version_major": 2,
89-
"version_minor": 0
90-
},
91-
"text/plain": [
92-
"HBox(children=(VBox(children=(HBox(children=(Checkbox(value=False, description='Axes', indent=False, _dom_clas…"
93-
]
94-
},
95-
"metadata": {},
96-
"output_type": "display_data"
97-
},
98-
{
99-
"data": {
100-
"text/plain": [
101-
"<jupyter_cadquery.cad_display.CadqueryDisplay at 0x7fa806d74a60>"
102-
]
103-
},
104-
"execution_count": 4,
105-
"metadata": {},
106-
"output_type": "execute_result"
107-
}
108-
],
75+
"outputs": [],
10976
"source": [
11077
"block = make_block(2, 2, True)\n",
11178
"show(block)"
@@ -114,7 +81,7 @@
11481
],
11582
"metadata": {
11683
"kernelspec": {
117-
"display_name": "Python 3",
84+
"display_name": "Python 3 (ipykernel)",
11885
"language": "python",
11986
"name": "python3"
12087
},
@@ -128,7 +95,7 @@
12895
"name": "python",
12996
"nbconvert_exporter": "python",
13097
"pygments_lexer": "ipython3",
131-
"version": "3.8.5"
98+
"version": "3.9.7"
13299
}
133100
},
134101
"nbformat": 4,

test_notebooks/import-all.ipynb

Lines changed: 35 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -3,41 +3,54 @@
33
{
44
"cell_type": "code",
55
"execution_count": null,
6+
"metadata": {},
7+
"outputs": [],
68
"source": [
79
"# Import all the packages from environment.yml\n",
8-
"import jupyterlab\n",
9-
"import ipywidgets\n",
10-
"import pandas\n",
11-
"import ipygany\n",
12-
"import pyvista\n",
13-
"import panel\n",
14-
"import plotly\n",
1510
"import cadquery\n",
16-
"import networkx\n",
1711
"import colour\n",
18-
"import ipympl\n",
19-
"import ipyevents\n",
20-
"import ipycanvas\n",
2112
"import dash\n",
2213
"import dash_bootstrap_components\n",
23-
"import pip\n",
14+
"import dash_treeview_antd\n",
15+
"import dash_vtk\n",
16+
"import ipycanvas\n",
17+
"import ipyevents\n",
18+
"import ipygany\n",
19+
"import ipympl\n",
2420
"import ipyvtklink\n",
21+
"import ipywidgets\n",
2522
"import jupyter_cadquery\n",
26-
"import dash_vtk\n",
27-
"import dash_treeview_antd\n",
23+
"import jupyterlab\n",
24+
"import networkx\n",
25+
"import pandas\n",
26+
"import panel\n",
27+
"import pip\n",
28+
"import plotly\n",
29+
"import pyvista\n",
2830
"\n",
29-
"# Uncovered: jupyter-dash, cairo"
30-
],
31-
"outputs": [],
32-
"metadata": {}
31+
"# Uncovered: cairo"
32+
]
3333
}
3434
],
3535
"metadata": {
36-
"orig_nbformat": 4,
36+
"kernelspec": {
37+
"display_name": "Python 3 (ipykernel)",
38+
"language": "python",
39+
"name": "python3"
40+
},
3741
"language_info": {
38-
"name": "python"
42+
"codemirror_mode": {
43+
"name": "ipython",
44+
"version": 3
45+
},
46+
"file_extension": ".py",
47+
"mimetype": "text/x-python",
48+
"name": "python",
49+
"nbconvert_exporter": "python",
50+
"pygments_lexer": "ipython3",
51+
"version": "3.9.7"
3952
}
4053
},
4154
"nbformat": 4,
42-
"nbformat_minor": 2
43-
}
55+
"nbformat_minor": 4
56+
}

0 commit comments

Comments
 (0)