Problem with installation

Hello,
I’m currently struggling to install FenicsX. I ran

conda create -n fenicsx-env
conda activate fenicsx-env
conda install -c conda-forge fenics-dolfinx mpich pyvista

but when running

import dolfinx

in python I get the error

Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/home/eloi/anaconda3/envs/fenicsx-env/lib/python3.10/site-packages/dolfinx/__init__.py", line 31, in <module>
    from dolfinx import fem, geometry, graph, io, jit, la, log, mesh, nls, plot
  File "/home/eloi/anaconda3/envs/fenicsx-env/lib/python3.10/site-packages/dolfinx/io/__init__.py", line 10, in <module>
    from dolfinx.io import gmshio  # noqa: F401
  File "/home/eloi/anaconda3/envs/fenicsx-env/lib/python3.10/site-packages/dolfinx/io/gmshio.py", line 68, in <module>
    def extract_topology_and_markers(model: gmsh.model, name: typing.Optional[str] = None):
AttributeError: module 'gmsh' has no attribute 'model'

I have no idea why it happens, I would really like your help.
Have a good day,
Eloi.

You should install gmsh with conda as well, at the time of installation of DOLFINx.

Thank you, I thought it would be downloaded automatically. I tried some things and it didn’t work so a deleted and re-installed Miniconda. Now when trying to

conda install -c conda-forge fenics-dolfinx

I get

Found conflicts! Looking for incompatible packages.
This can take several minutes.  Press CTRL-C to abort.
failed                                                                                                                                  

UnsatisfiableError: The following specifications were found
to be incompatible with the existing python installation in your environment:

Specifications:

  - fenics-dolfinx -> python[version='2.7.*|3.5.*|3.6.*|3.6.12|3.6.12|3.7.10|3.7.10|3.7.12|3.8.12|3.8.16|3.9.16|>=3.11,<3.12.0a0|3.9.10|>=3.6,<3.7.0a0|3.7.9|3.6.9|3.6.9|3.6.9|>=2.7,<2.8.0a0|3.6.9|>=3.5,<3.6.0a0|3.4.*|>=3.7|3.10.*|3.9.*|3.8.*|3.7.*',build='0_73_pypy|1_73_pypy|3_73_pypy|4_73_pypy|5_73_pypy|5_73_pypy|1_73_pypy|0_73_pypy|0_73_pypy|2_73_pypy']
  - fenics-dolfinx -> python[version='>=3.10,<3.11.0a0|>=3.9,<3.10.0a0|>=3.8,<3.9.0a0|>=3.7,<3.8.0a0']

Your python: python=3.11

If python is on the left-most side of the chain, that's the version you've asked for.
When python appears to the right, that indicates that the thing on the left is somehow
not available for the python version you are constrained to. Note that conda will not
change your python version to a different minor version unless you explicitly specify
that.

The following specifications were found to be incompatible with your system:

  - feature:/linux-64::__glibc==2.31=0
  - python=3.11 -> libgcc-ng[version='>=11.2.0'] -> __glibc[version='>=2.17']

Your installed version is: 2.31

Is dolfinx not compatible with Python 3.11 ? Or libgcc causes the problem ?

The release of Dolfinx that is on conda (0.6.0) is not compatible with 3.11. This has been fixed in the main branch if dolfinx

Ok now dolfinx is installed but I get back the gmsh problem. I did

conda install -c conda-forge gmsh

and when I do

conda list | grep gmsh

I do get

gmsh                      4.2.2                h0f49446_0    conda-forge

However, I still got the error

AttributeError: module 'gmsh' has no attribute 'model'

When uninstalling it and re-installing it with pip

pip install --upgrade gmsh

it finally works. Apparently, the version of gmsh on conda (4.2) isn’t the right one (4.11).

Bye.

Hi Eloi. I have a similar issue. I can not import gmsh. I have installed gmsh 4.11 but the proble still exists. Does gmsh need to be installed before installing dolfinx?

If you want to use dolflnx.io.gmshio Gmsh has to be installed prior to DOLFINx

Thank you very much. I reinstalled it now and it solved the issue :slight_smile: