How to install dolfin 2019.1.0 when I have dolfin 2019.2.0.dev0

I am running fenics legacy on Ubuntu 20.04. I need the 2019.1.0 version of dolfin/fenics so my prof’s code will work on my computer. Installed using code from website:

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

import fenics as fe
from dolfin import *
from dolfin_adjoint import *


Traceback (most recent call last):
File “”, line 1, in
import fenics as fe
File “/usr/lib/python3/dist-packages/fenics/”, line 7, in
from dolfin import *
File “/usr/lib/petsc/lib/python3/dist-packages/dolfin/”, line 138, in
from . import parameter
File “/usr/lib/petsc/lib/python3/dist-packages/dolfin/parameter/”, line 11, in
from ffc import default_jit_parameters
File “/usr/lib/python3/dist-packages/ffc/”, line 24, in
from ffc.compiler import compile_form, compile_element
File “/usr/lib/python3/dist-packages/ffc/”, line 129, in
from ffc.codegeneration import generate_code
File “/usr/lib/python3/dist-packages/ffc/”, line 37, in
import ffc.uflacs.language.cnodes as L
File “/usr/lib/python3/dist-packages/ffc/uflacs/”, line 23, in
from ffc.uflacs.uflacsrepresentation import compute_integral_ir
File “/usr/lib/python3/dist-packages/ffc/uflacs/”, line 26, in
from ffc.representationutils import initialize_integral_ir
File “/usr/lib/python3/dist-packages/ffc/”, line 28, in
from ufl.cell import cellname2facetname
ImportError: cannot import name ‘cellname2facetname’ from ‘ufl.cell’ (/usr/lib/python3/dist-packages/ufl/

My programming skills are low. Been a hot minute since I was programming (early 1990s) and a lot has changed since then.

To better understand the problem you’re trying to solve, can you say why you specifically require dolfin 2019.1.0 rather than dolfin 2019.2.0.dev0? dolfin 2019.2dev is code compatible with dolfin 2019.1.0, I would recommend using the newer version. There’s no reason I can think of that code written for 2019.1 wouldn’t work for 2019.2dev.

The error you showed here comes from an incompatibility in the ffc component triggered by an update in the ufl component. But the problem has been addressed and fixed in the packages on the PPA and in the packages provided by Ubuntu. It shouldn’t be showing up on an updated installation of Ubuntu 20.04 focal. Try updating your system fully with

sudo apt update
sudo apt upgrade
sudo apt dist-upgrade

Note also that Ubuntu 20.04 is a few years out of date. You’ll generally get more stability if you can upgrade to the current Ubuntu LTS release, Ubuntu 22.04 jammy.

Found the culprit, didn’t have dolfin-adjoint. Did update as suggested.
Scared to change anything else, as program is functioning now!

Thank you!!!

1 Like