FeniCs on Apple silicon M1

Greetings community, I wish to know if FeniCs (or FeniCS-X) can be installed to run natively on the new Apple silicon M1 processor based on the arm64 architecture. Thanks.

I don’t think that should be any issue with FeniCS-X.
But I’m not sure if it’s currently being tested in this architecture.

1 Like

Did you manage to make it work yet?

arm64 in general is known to work. The Debian and Ubuntu linux packages build for arm64.


Ok I’ve just been able to test it, the docker version of dolphinx does seem to work flawlessly.

Actually I might have spoken a bit too quickly… Trying to import dolfinx using the dolfinx/lab docker image available on docker hub on a MacBook Air M1 causes the kernel to crash and restart.
Is there any way to fix this?
Note that non-X version of Fenics (quay.io/fenicsproject/stable:latest) is working properly.

Are you using the docker version for apple silicon m1 ?

I am a developer of FEniCS. Today we introduced experimental native ARM64 builds of our Docker images.

From the end users point of view nothing changes, i.e.:

docker run -ti dolfinx/dolfinx

The lab image should also work.

Feedback here or on our Slack in #fenicsx would be much appreciated from Mac M1 users.


Is there a native ARM64 build for FeniCS 2019.1.0 to test on a Mac M1 ? I am still using that version. Thanks.

No… You are welcome to try building from the original Dockerfiles on ARM. You will certainly need to modify/adapt them but it will put you on the right path.


I can’t really provide support, FEniCS 2019.1.0 is ‘legacy’ now.

1 Like

I installed the ARM build of FenicsX on a Mac M1 using

docker run -ti dolfinx/dolfinx

However, I see that some demos are not working since this docker image does not include packages such as PyVista, PyVistaqt and Gmsh. Can I install them inside the docker container ?

You can install both packages.
Gmsh is installed on amd systems by unzipping a binary: dolfinx/Dockerfile at main · FEniCS/dolfinx · GitHub
so you might have to install gmsh from source (gmsh is pip installable, but does not always work out of the box). For more info on gmsh see: Gmsh: a three-dimensional finite element mesh generator with built-in pre- and post-processing facilities

For pyvista, see: Plot functions in dolfinx - #5 by dokken

Pyvistaqt requires some extra packages:

apt-get install -y --no-install-recommends python3-pyqt5 libgl1-mesa-glx  # pyvistaqt
pip3 install pyvista pyvistaqt

I tried to install PyVista on a Mac M1 by using your suggestions in

However I get the errors:

ERROR: Could not find a version that satisfies the requirement vtk (from pyvista) (from versions: none)

ERROR: No matching distribution found for vtk (from pyvista)

Is there any way to fix this ?

Unfortunately VTK has not published wheels for python 3.9 yet, see:

You might have to install VTK manually

Can Matplotlib still be used with FeniCX ?

Sorry for the delay but yes I’m using the latest Apple Silicon version.

I tried running the newly updated Jupyter Lab dolfinx environment and faced this error:

~ % docker run -ti dolfinx/lab:latest 
Traceback (most recent call last):
  File "/usr/local/bin/jupyter-lab", line 5, in <module>
    from jupyterlab.labapp import main
  File "/usr/local/lib/python3.8/dist-packages/jupyterlab/__init__.py", line 7, in <module>
    from .labapp import LabApp
  File "/usr/local/lib/python3.8/dist-packages/jupyterlab/labapp.py", line 15, in <module>
    from jupyterlab_server import slugify, WORKSPACE_EXTENSION
  File "/usr/local/lib/python3.8/dist-packages/jupyterlab_server/__init__.py", line 4, in <module>
    from .app import LabServerApp
  File "/usr/local/lib/python3.8/dist-packages/jupyterlab_server/app.py", line 7, in <module>
    from jupyter_server.extension.application import ExtensionApp, ExtensionAppJinjaMixin
  File "/usr/local/lib/python3.8/dist-packages/jupyter_server/__init__.py", line 15, in <module>
    from ._version import version_info, __version__
  File "/usr/local/lib/python3.8/dist-packages/jupyter_server/_version.py", line 5, in <module>
    from jupyter_packaging import get_version_info
  File "/usr/local/lib/python3.8/dist-packages/jupyter_packaging/__init__.py", line 7, in <module>
    from .setupbase import *
  File "/usr/local/lib/python3.8/dist-packages/jupyter_packaging/setupbase.py", line 38, in <module>
    from setuptools.config import StaticModule
ImportError: cannot import name 'StaticModule' from 'setuptools.config' (/usr/lib/python3/dist-packages/setuptools/config.py)
~ % 

This issue seem to have been fixed in the latest release.

Did anyone manage to install gmsh? I tried installing it using pip on the latest build of dolfinx/lab (18b29689a687) without any success (see Can't start gmsh after installing via pip (#1023) · Issues · gmsh / gmsh · GitLab).
Additionally the procedure for the installation from source detailed here Gmsh compilation · Wiki · gmsh / gmsh · GitLab led me to the following error when running the make command:

root@fad3fabceb5c:~/gmsh/build# make
Scanning dependencies of target gmsh
[  0%] Building CXX object CMakeFiles/gmsh.dir/Common/Main.cpp.o
[  0%] Building CXX object CMakeFiles/gmsh.dir/Common/GmshGlobal.cpp.o


[ 13%] Building CXX object CMakeFiles/gmsh.dir/Geo/GVertex.cpp.o
[ 13%] Building CXX object CMakeFiles/gmsh.dir/Geo/GEdge.cpp.o
[ 13%] Building CXX object CMakeFiles/gmsh.dir/Geo/GFace.cpp.o
c++: fatal error: Killed signal terminated program cc1plus
compilation terminated.
make[2]: *** [CMakeFiles/gmsh.dir/build.make:1194: CMakeFiles/gmsh.dir/Geo/GFace.cpp.o] Error 1
make[1]: *** [CMakeFiles/Makefile2:1355: CMakeFiles/gmsh.dir/all] Error 2
make: *** [Makefile:163: all] Error 2

Am I doing anything wrong? Any help would be appreciated.

The gmsh and vtk developers are not yet publishing binary packages for ARM. You can see that we skip these on ARM in the Dockerfile:

I think it is only a matter of time before this is fixed upstream, so I’d rather not manually compile gmsh/vtk etc. for now. If the situation hasn’t improved in three months then we can revisit the decision.

@Tomaubier Your error looks typical of a compiler being killed due by the kernel due to using all of the available memory. Try increasing the amount of memory allocated to Docker?