Error when trying to reproduce tutorial example

Hello,

I am trying to reproduce the second Navier Stokes example described in the dolfinx tutorial Test problem 2: Flow past a cylinder (DFG 2D-3 benchmark) — FEniCSx tutorial
I am working in a docker container.

My script is simply

import gmsh

print(f"DOLFINx version: {dolfinx.version} is installed")
gmsh.initialize()

And I got the following error message

Traceback (most recent call last):
File “/home/fenicsx/shared/tutorial.py”, line 1, in
import gmsh
File “/home/fenicsx/shared/gmsh.py”, line 3, in
mesh, cell_markers, facet_markers = io.gmshio.read_from_msh(“mesh.msh”, MPI.COMM_WORLD, gdim=2)
AttributeError: module ‘dolfinx.io’ has no attribute ‘gmshio’

I tried to fix this issue by typing

pip install gmsh

in my docker container
which produced

Collecting gmsh
Downloading gmsh-4.10.5-py2.py3-none-manylinux1_x86_64.whl (38.3 MB)
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 38.3/38.3 MB 6.0 MB/s eta 0:00:00
Installing collected packages: gmsh
Successfully installed gmsh-4.10.5
WARNING: Running pip as the ‘root’ user can result in broken permissions and conflicting behaviour with the system package manager. It is recommended to use a virtual environment instead: 12. Virtual Environments and Packages — Python 3.10.6 documentation

But it did not solved the problem.

The dolfinx release is 0.4.2.0

What am I doing wrong?

Thank you.

X

What docker image are you using? Please Remember to pull the latest version, as described in:
https://jorgensd.github.io/dolfinx-tutorial/fem.html#tutorial-compatible-docker-images

Good morning Jorgen,

I uploaded the latest version you mention in the tutorial and it works well.
I was not using the version you recommend in the tutorial because I dont want to use jupyter.
I will check if I can modify my docker image to use your last version.

Thank you for the quick answer.

X

You can easily do that by modifying the entrypoint as explained in: