Error when importing some functions

Hi all,

I am trying to reproduce the tutorial Test problem 2: Flow past a cylinder (DFG 2D-3 benchmark) — FEniCSx tutorial to learn how to load the mesh and boundary markers in Dolfinx.

from dolfinx.io import distribute_entity_data, cell_perm_gmsh
from dolfinx.graph import create_adjacencylist

For the first line, the error that I am getting is:

ImportError: cannot import name ‘distribute_entity_data’ from ‘dolfinx.io’ (/usr/local/dolfinx-real/lib/python3.8/dist-packages/dolfinx/io.py)
ImportError: cannot import name ‘distribute_entity_data’ from ‘dolfinx.io’ (/usr/local/dolfinx-real/lib/python3.8/dist-packages/dolfinx/io.py)

and for the second line:

ModuleNotFoundError: No module named ‘dolfinx.graph’

I guess that the functions have been deleted or moved to other directories.
Does anyone know where these functions have been located?

Thanks in advance.

Which version of dolfinx are you running?
Could you run the following:

python3 -c "import dolfinx; import dolfinx.common; print(dolfinx.__version__, dolfinx.common.git_commit_hash)"

The output is:
0.3.1.0 3a937bac30f3cce1bff2f36be8be3d4c0b1081d5

This commit is from october (Minor MPI improvements (#1760) · FEniCS/dolfinx@3a937ba · GitHub)

Thus you Need to update your installation of DOLFINx, as the tutorial is updated to match the API as of Sort imports (#1914) · FEniCS/dolfinx@01c7e47 · GitHub

1 Like

I see. Thank you very much!