Legacy FEniCS 2019 on Apple Silicon

Has anyone had success running the legacy FEniCS 2019.1.0 on Apple Silicon? This discussion seems to be about FEniCSx, but I still use the legacy FEniCS for a project that has not been (and would be quite hard to) update to FEniCSx.

If anyone knows that FEniCS 2019 cannot run on Apple Silicon or has other advice, that would be welcome.

1 Like

There shouldn’t be a problem. A coworker has built the old dolfin docker images on his M1 Mac so it’s definitely possible. Perhaps you could try the same.


Very glad to hear that it’s been done successfully. I don’t have an Apple Silicon machine on which to test yet, but as my current ones age out, I am going to make the transition. If I couldn’t run legacy dolfin, that would perhaps change my purchase plans.

I just bought a Mac Studio with M1 Max. I searched for fenics using conda but did not find any fenics from conda-forge. It is good to know that fenics 2019 works on M1 and can get a docker image from the web link. However, is it possible for an author of the web link to produce a version of fenics for conda-forge? Doing so will be highly appreciated by many fenics users like me.

Maybe not ideal, but you can create a x64 env in conda and run fenics 2019 with Rosetta:

CONDA_SUBDIR=osx-64 conda create -n myenv_x64 python=3.9
conda activate myenv_x64
conda config --env --set subdir osx-64

conda create -n fenics2019 -c conda-forge mshr=2019.1.0=py38h2af9582_2
1 Like

Thanks, Paulms. I installed fenics on my Mac Studio. It works!

Did you use the Paulms’ way?

Yes. I did exactly. But, Paulms’ way may cause new problems. For example, I got an error of an incompatible architecture (have ‘arm64’, need 'x86_64’) when using f2py since gfortran was run on Apple Silicon (Paulms, can you have a way to fix this issue? This issue is common since f2py is often used). Hence, it is still important for someone to generate a binary of fenics 2019 for Apple Silicon.

I’m afraid that I don’t use f2py myself. The method above will certainly fail if the package tries to interface with external executables (not installed by conda itself) due to mixed architectures.

conda create -n fenics2019
conda activate fenics2019
conda config --env --set subdir osx-64

Running the following commands will create a conda environment named fenics2019 that’s set to be an x64 environment permanently, so anything installed should be installed for x64.

Confirming, Paulms solutions is functional for me. I was suffering from “catastrophic performance degradation” using the usual fenics2019 docker container. I couldn’t quite piece together how to build my own for that, but thankfully your conda solution works great. I really appreciate it.

I would love to just migrate to fenicsx, since it seems to have better apple silicon support, but I’m bound to hippylib which depends on the 2019 version. I need to put in some time to try and implement the features I need from it in dolfinx.

use this command install fenics and mshr , how to install matplotlib?

As matplotlib is on conda you can call conda install -c conda-forge matplotlib, see: Matplotlib :: Anaconda.org

Hi Paulms, thank you for the solution. I am trying to install Fenics 2019 on my Mac Pro with M1 chip and it keeps showing the package is not available from current channels as shown in the screenshot. Any idea about this issue?

I installed that specific version since, at that time, the latest build gave me problems with the ‘mshr’ package. Maybe that build has been replaced with more recent ones in the conda repository. You can omit the version (==2019.1…), and try the latest builds. Perhaps it works now, or you can check the available versions at this link: Files :: Anaconda.org

Thank you, Paulms. Let me try it.

Additional details, in case you find them useful.
What I have done in November 2023 to make it run on M1:

conda update -n base -c defaults conda
CONDA_SUBDIR=osx-64 conda create -n myenv_x64 python=3.9
conda activate myenv_x64
conda config --env --set subdir osx-64
conda create -n fenics2019 -c conda-forge fenics
conda activate fenics2019 
pip install meshio   
pip install h5py
pip install matplotlib