Closed fghoussen closed 1 year ago
How are you starting the docker container? Are you forwarding the necessary ports for a graphical user interface? Are you using a Python script or a notebook?
This does work: I have a GUI that pops up and I can navigate the into the colored mesh
>> cd /tmp
>> wget https://docs.fenicsproject.org/dolfinx/main/python/_downloads/b94ac7be61dc3726ca331afd20f195d2/demo_poisson.py
>> xhost +
>> sudo docker run --rm -it -e DISPLAY="$DISPLAY" -v /tmp/.X11-unix:/tmp/.X11-unix -v /tmp:/root --name fenics_tuto dolfinx/dolfinx:stable
root@6ed4aea976a6:~# ls *.py
demo_poisson.py
root@6ed4aea976a6:~# apt update
root@6ed4aea976a6:~# apt install libgl1-mesa-glx xvfb
root@6ed4aea976a6:~# python3 -m pip install pyvista
root@6ed4aea976a6:~# python3 demo_poisson.py
But this doesn't work: the visualization stalls
>> cd /tmp
>> git clone https://github.com/jorgensd/dolfinx-tutorial
>> xhost +
>> sudo docker run --rm -it -e DISPLAY="$DISPLAY" -v /tmp/.X11-unix:/tmp/.X11-unix -v /tmp:/root --name fenics_tuto dolfinx/dolfinx:stable
root@3f7f2f14821f:~# ls dolfinx-tutorial/
Changelog.md README.md _toc.yml chapter1 chapter3 docker fenics_logo.png index.ipynb references.bib tox.ini
Dockerfile _config.yml binder.png chapter2 chapter4 fem.md git.png jupyter_book.code-workspace save.png
root@3f7f2f14821f:~# apt-get update
root@3f7f2f14821f:~# apt install libgl1-mesa-glx xvfb
root@3f7f2f14821f:~# python3 -m pip install pyvista
root@3f7f2f14821f:~# cd dolfinx-tutorial/chapter2/
root@3f7f2f14821f:~/dolfinx-tutorial/chapter2# python3 linearelasticity_code.py
^C
Loguru caught a signal: SIGINT
Stack trace:
23 0x55592eb8c245 _start + 37
22 0x7fce699bbe40 __libc_start_main + 128
21 0x7fce699bbd90 /lib/x86_64-linux-gnu/libc.so.6(+0x29d90) [0x7fce699bbd90]
20 0x55592eb8c34d Py_BytesMain + 45
19 0x55592ebb60ae Py_RunMain + 702
18 0x55592ebc4e33 _PyRun_AnyFileObject + 67
17 0x55592ebc5138 _PyRun_SimpleFileObject + 424
16 0x55592ebc5c55 python3(+0x265c55) [0x55592ebc5c55]
15 0x55592ebbed5b python3(+0x25ed5b) [0x55592ebbed5b]
14 0x55592ebc5f08 python3(+0x265f08) [0x55592ebc5f08]
13 0x55592eb99456 PyEval_EvalCode + 134
12 0x55592eaa1766 python3(+0x141766) [0x55592eaa1766]
11 0x55592eaa514a _PyEval_EvalFrameDefault + 2058
10 0x55592eabc3ac _PyFunction_Vectorcall + 124
9 0x55592eaa514a _PyEval_EvalFrameDefault + 2058
8 0x55592eabc3ac _PyFunction_Vectorcall + 124
7 0x55592eaab48e _PyEval_EvalFrameDefault + 27470
6 0x55592eab27db _PyObject_MakeTpCall + 603
5 0x55592eabbb88 python3(+0x15bb88) [0x55592eabbb88]
4 0x7fce470e68ed /usr/local/lib/python3.10/dist-packages/vtkmodules/vtkRenderingCore.cpython-310-x86_64-linux-gnu.so(+0x15c8ed) [0x7fce470e68ed]
3 0x7fce43ebc8a4 vtkXRenderWindowInteractor::StartEventLoop() + 68
2 0x7fce43ec048f vtkXRenderWindowInteractor::ProcessEvents() + 1039
1 0x7fce69aad7ed __select + 349
0 0x7fce699d4520 /lib/x86_64-linux-gnu/libc.so.6(+0x42520) [0x7fce699d4520]
2023-05-27 14:44:07.110 ( 37.145s) [main ] :0 FATL| Signal: SIGINT
Did I miss something?
How are you starting the docker container?
Yes
Are you forwarding the necessary ports for a graphical user interface?
Yes
Are you using a Python script or a notebook?
python script
Any clue so far?
Any clue so far?
Please note that is the weekend, and it doesn't help adding extra posts here.
Try removing pyvista.start_xvfb()
.
Sorry didn't meant to disturb. As I work, I can only deal with that topic by the week-end.
Try removing pyvista.start_xvfb().
Worked, thanks! Do you want me to PR this change?
Sorry didn't meant to disturb. As I work, I can only deal with that topic by the week-end.
Try removing pyvista.start_xvfb().
Worked, thanks! Do you want me to PR this change?
No, as it stands, most pyvista visualization needs xvfb (for instance in jupyter notebook or for screenshots). As the tutorial is based on the ipynb scripts (to render the webpage) I need start_xvfb() to run and render plots there.
What you could do is to add a comment or separate section about plotting in chapter1, where one goes through what is needed for various plotting methods.
Using docker image as explained here https://github.com/FEniCS/dolfinx/blob/main/README.md#installation.
Following https://jsdokken.com/dolfinx-tutorial/chapter2/linearelasticity_code.html, I end up with pyvista freezing (no GUI + stall => compelled to ctrl-C):
Any clue?