Getting started

FEniCS is a finite element solver for PDEs that can be used with Python or C++. Here is how you can install FEniCS on different operating systems (more details at

On this page:


The easiest way to use FEniCS is by creating and activating a conda environment containing the FEniCS package:

conda create -n fenicsproject -c conda-forge fenics
source activate fenicsproject

Using Docker

Another way is to download the FEniCS Docker image and set up a Docker container. Please note that there are additional steps if you wish to use Jupyter Notebook inside a Docker container.

Installing Docker is pretty straightforward on MacOS:

After installing Docker, download the FEniCS Docker image from your terminal:

curl -s | bash

Using this image, create a container named fenics-container (or name it however you like) that shares files with your local directory:

docker run -ti -v $(pwd):/home/fenics/shared --name fenics-container -p

Navigate to your desired local directory and start the Docker container:

docker start fenics-container
docker exec -ti -u fenics fenics-container /bin/bash -l

This is what you can expect on your terminal. Notice that the shared directory in the container shares the same files as your local directory.

Run your python scripts normally using python3. When you are finished, first exit the container using exit, then stop the Docker container:

docker stop fenics-container


Using Docker

Docker for Windows requires Windows 10 Pro/Enterprise/Education or Home. After installation, follow the steps above to create a FEniCS container. Docker for Windows can be a bit finicky since it uses Hyper-V or WSL2 to run the Linux images. If you've tried this installation and failed, I would recommend using Ubuntu.

There are many ways to use Ubuntu on a Windows PC (via virtual machine, dual booting, cloud, etc.). If you don't have a preference, I would recommend setting up an Ubuntu virtual machine.

First install Virtualbox:

Then follow these instructions to set up a Ubuntu virtual machine:

Finally, install FEniCS on the Ubuntu VM using the instructions in the Ubuntu section.


Install FEniCS by running this on the terminal:

sudo apt-get install software-properties-common
sudo add-apt-repository ppa:fenics-packages/fenics
sudo apt-get update
sudo apt-get install --no-install-recommends fenics

If line 4 fails, try running lines 3 and 4 again.

Last updated