This is a read only copy of the old FEniCS QA forum. Please visit the new QA forum to ask questions

Building dolfin - ImportError: No module named 'ffc'

+1 vote

Hello, I'm trying to install dolfin for Python 3.5. I already installed FEniCS following the instructions for "FEniCS on Ubuntu":

sudo add-apt-repository ppa:fenics-packages/fenics
sudo apt-get update
sudo apt-get install --no-install-recommends fenics
sudo apt-get dist-upgrade

On Python 2.7 everything is fine now:

$ python -c "import dolfin; print dolfin.__version__"
2016.2.0

Because it's not clear to me how to install the dolfin package for Python 3 I tried building it from source:

mkdir build
cd build
cmake ..
make install

Without specifying a specific Python version the cmake .. command already raised an error:

-- Generating form files in demo, test and bench directories. May take some time...
-- ----------------------------------------------------------------------------------------
CMake Error at CMakeLists.txt:924 (message):
  Generation of form files failed:

  Traceback (most recent call last):

    File "/home/dominik/Downloads/dolfin/cmake/scripts/generate-form-files.py", line 22, in <module>
      import ffc

  ImportError: No module named 'ffc'

How can I install this package? Also before that it already complained about a missing package ply which I could install from pypi. Is there a way to install all the requirements for dolfin? The repo doesn't contain a requirements.txt nor a setup.py. Note that I have installed FEniCS on Ubuntu already.

asked May 6, 2017 by Dominik1123 FEniCS Novice (190 points)

1 Answer

+1 vote

You can try pip3 install ffc - you will probably also need ufl, instant, fiat and dijitso.

answered May 6, 2017 by chris_richardson FEniCS Expert (31,740 points)

I can't install it via pip:

$ pip3 install ffc
Collecting ffc
  Could not find a version that satisfies the requirement ffc (from versions: )
No matching distribution found for ffc

I see that FFC is registered on pypi but there is nothing uploaded, so I can't install via pip. The same holds for DOLFIN and that's why I started building from source at all. On the pypi page there is a link to the latest snapshot of the repo so I could go ahead and also build FFC from source (and probably continue the same for any other dependency, ufl, instant, fiat and dijitso you mentioned). Isn't there a way to install them automatically all at once?

You can install via pip, but it is not as straightforward as it should be. This should work:

pip3 install https://bitbucket.org/fenics-project/fiat/downloads/fiat-2016.2.0.tar.gz
pip3 install -i https://pypi.python.org/pypi dijitso instant ufl ffc

Installing with pip will work better with the next release, except for FIAT, which we unfortunately do not own on pypi (yet).

...