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

Issue installing dolfin: ufc cannot be imported

+1 vote

Hi All,
I am a newcomer to Fenics. I am trying to install Fenics from source. I have managed to install all other components and now stuck on Dolfin. I successfully ran cmake/scripts/generate-all under the Dolfin installation directory, but now on running the the foll cmake command

cmake -DCMAKE_INSTALL_PREFIX=/brashear/anirban/DealII/FEniCS/dolfin -DCMAKE_CXX_COMPILER=icpc -DCMAKE_CXX_FLAGS="-O3" -DCMAKE_C_COMPILER=icc -DCMAKE_C_FLAGS="-O3" -DCMAKE_FORTRAN_COMPILER=ifort -DCMAKE_FORTRAN_FLAGS="-O3" -DCMAKE_VERBOSE_MAKEFILE=ON -DARMADILLO_INCLUDE_DIRS=${ARMADILLO_DIR}/include -DARMADILLO_LIBRARIES=${ARMADILLO_DIR}/lib/libarmadillo.so -DSWIG_DIR=${SWIG_DIR} -DSWIG_EXECUTABLE=${SWIG_DIR}/bin/swig -DUFC_DIR=${UFC_DIR}

I get the foll error:

Traceback (most recent call last):
  File "<string>", line 1, in <module>
ImportError: No module named ufc
CMake Warning at dolfin/CMakeLists.txt:325 (message):
  Unable to import UFC.  Install latest UFC or check that PYTHONPATH is set
  appropriately.  Python will be disabled.

I have already installed UFC via cmake and make install ( make didn't seem to do anything for UFC). I did not see any error in installing UFC. But I don't see any ufc module (seems to me it should be a python module). I have ufc_utils which is already on PYTHONPATH. Am I missing some step here?

Below are the contents of my installed UFC directory:

ufc/2.2.0> ls -lR .
.:
total 16
-rw-r--r-- 1 anirban staff  192 2013-06-10 16:01 cmake.log.2
drwxr-xr-x 2 anirban staff 4096 2013-06-08 01:17 include
drwxr-xr-x 4 anirban staff 4096 2013-06-08 01:17 lib
drwxr-xr-x 3 anirban staff 4096 2013-06-08 01:17 share

./include:
total 48
-rw-r--r-- 1 anirban staff 30860 2013-05-01 12:52 ufc_geometry.h
-rw-r--r-- 1 anirban staff 15633 2013-05-01 12:52 ufc.h

./lib:
total 8
drwxr-xr-x 2 anirban staff 4096 2013-06-08 01:17 pkgconfig
drwxr-xr-x 3 anirban staff 4096 2013-06-08 01:17 python2.7

./lib/pkgconfig:
total 4
-rw-r--r-- 1 anirban staff 129 2013-06-08 01:10 ufc-1.pc

./lib/python2.7:
total 4
drwxr-xr-x 3 anirban staff 4096 2013-06-08 01:17 site-packages

./lib/python2.7/site-packages:
total 4
drwxr-xr-x 2 anirban staff 4096 2013-06-08 01:23 ufc_utils

./lib/python2.7/site-packages/ufc_utils:
total 132
-rw-r--r-- 1 anirban staff  3757 2013-05-01 12:52 build.py
-rw-r--r-- 1 anirban staff  4350 2013-06-08 01:23 build.pyc
-rw-r--r-- 1 anirban staff  8470 2013-05-01 12:52 dofmap.py
-rw-r--r-- 1 anirban staff  8466 2013-06-08 01:23 dofmap.pyc
-rw-r--r-- 1 anirban staff 14550 2013-05-01 12:52 finite_element.py
-rw-r--r-- 1 anirban staff 14555 2013-06-08 01:23 finite_element.pyc
-rw-r--r-- 1 anirban staff 10698 2013-05-01 12:52 form.py
-rw-r--r-- 1 anirban staff 10692 2013-06-08 01:23 form.pyc
-rw-r--r-- 1 anirban staff  1706 2013-05-01 12:52 function.py
-rw-r--r-- 1 anirban staff  1705 2013-06-08 01:23 function.pyc
-rw-r--r-- 1 anirban staff  3511 2013-05-01 12:52 __init__.py
-rw-r--r-- 1 anirban staff  2736 2013-06-08 01:23 __init__.pyc
-rw-r--r-- 1 anirban staff  9365 2013-05-01 12:52 integrals.py
-rw-r--r-- 1 anirban staff  9410 2013-06-08 01:23 integrals.pyc

./share:
total 4
drwxr-xr-x 2 anirban staff 4096 2013-06-10 15:59 ufc

./share/ufc:
total 12
-rw-r--r-- 1 anirban staff 759 2013-06-08 01:10 UFCConfig.cmake
-rw-r--r-- 1 anirban staff 720 2013-06-08 01:10 UFCConfigVersion.cmake
-rw-r--r-- 1 anirban staff 390 2013-06-08 01:10 UseUFC.cmake

I tried to set both

/brashear/anirban/TBI-Pkgs/fenics/ufc/2.2.0

and

/brashear/anirban/TBI-Pkgs/fenics/ufc/2.2.0/share/ufc 

for UFC_DIR, but both result in the same error.

Thanks

asked Jun 10, 2013 by janzz2k FEniCS Novice (160 points)
retagged Jun 12, 2013 by chris_richardson

There should be a ufc directory under ./lib/python2.7. Try reinstalling UFC from scratch, pay attention to any error messages you get when installing and check that the ufc Python module is installed.

Hi logg,
Thanks... you are right. I needed to enable UFC Python. After I did that, the python module ufc is created and the previous error is gone. For the benefit of other beginners, below are my exact set of commands that worked:

unzip ../downloads/fenics-project-ufc-aac419bbb8ea.zi
cd fenics-project-ufc-aac419bbb8ea
 cmake -DCMAKE_INSTALL_PREFIX=/brashear/anirban/TBI-Pkgs/fenics/ufc/2.2.0 -DCMAKE_CXX_COMPILER=icpc -DCMAKE_CXX_FLAGS="-O3" -DCMAKE_C_COMPILER=icc -DCMAKE_C_FLAGS="-O3" -DUFC_ENABLE_PYTHON:BOOL=ON . 2>&1 | tee cmake.log.1 
Edit CMakeCache.txt to make sure CMAKE_INSTALL_PREFIX is correct and UFC_ENABLE_PYTHON:BOOL=ON
cmake . 2>&1 | tee cmake.log.2 ( Rerun cmake without options in case you had to update CMakeCache.txt in the last step, to capture those changes)
 make 2>&1 | tee make.log.1
 make install >& make-install.log.1 &
  export PYTHONPATH=/brashear/anirban/TBI-Pkgs/fenics/ufc/2.2.0/lib/python2.7/site-packages:$PYTHONPATH 

I still have one error configuring Dolfin with cmake. It looks like the only error now is the foll:

CMake Error at /brashear/anirban/TBI-Pkgs/cmake/2.8.11/share/cmake-2.8/Modules/FindBoost.cmake:1096 (message):
  Unable to find the requested Boost libraries.

  Boost version: 1.53.0

  Boost include path: /brashear/anirban/TBI-Pkgs/boost/1.53.0/include

  The following Boost libraries could not be found:

          boost_mpi

  Some (but not all) of the required Boost libraries were found.  You may
  need to install these additional Boost libraries.  Alternatively, set
  BOOST_LIBRARYDIR to the directory containing Boost libraries or BOOST_ROOT
  to the location of Boost.
Call Stack (most recent call first):
  CMakeLists.txt:248 (find_package)

Is it not possible to build Dolfin without BOOST MPI library? It seems to me that should be optional.

I also have some Failed messages. But I am not sure if those are fatal:

-- Performing Test HAVE_PEDANTIC
-- Performing Test HAVE_PEDANTIC - Failed
-- Performing Test HAVE_STD
-- Performing Test HAVE_STD - Failed
-- Try OpenMP C flag = [-openmp]
-- Performing Test OpenMP_FLAG_DETECTED
-- Performing Test OpenMP_FLAG_DETECTED - Success
-- Try OpenMP CXX flag = [-openmp]
-- Performing Test OpenMP_FLAG_DETECTED
-- Performing Test OpenMP_FLAG_DETECTED - Success
-- Found OpenMP: -openmp
-- Performing Test OPENMP_UINT_TEST_RUNS
-- Performing Test OPENMP_UINT_TEST_RUNS - Faile

Thanks in advance for the help
Anirban

I don't think it is a good idea to ask a question in you answer. Posting a new question would have been better. That said, setting -DDOLFIN_ENABLE_MPI:BOOL=FALSE should build DOLFIN without the Boost MPI library.

...