Problem with cmake when installing dolfinx_mpc

Hello, I am trying to install dolfinx_mpc on my computer (Ubuntu) using the instruction from the dockerfile (dolfinx_mpc/Dockerfile at dokken/v0.5.1 · jorgensd/dolfinx_mpc · GitHub). When i run cmake:

cmake -G Ninja -DCMAKE_BUILD_TYPE=Developer -B build-dir cpp/

I get the following error:

Traceback (most recent call last):
  File "<string>", line 1, in <module>
ModuleNotFoundError: No module named 'ffcx'
Traceback (most recent call last):
  File "<string>", line 1, in <module>
ModuleNotFoundError: No module named 'ffcx'
-- UFC could not be found. (missing: UFC_INCLUDE_DIRS UFC_VERSION UFC_VERSION_OK UFC_SIGNATURE) 
CMake Error at CMakeLists.txt:93 (find_package):
  By not providing "FindDOLFINX.cmake" in CMAKE_MODULE_PATH this project has
  asked CMake to find a package configuration file provided by "DOLFINX", but
  CMake did not find one.

  Could not find a package configuration file provided by "DOLFINX"
  (requested version 0.5.1) with any of the following names:

    DOLFINXConfig.cmake
    dolfinx-config.cmake

  Add the installation prefix of "DOLFINX" to CMAKE_PREFIX_PATH or set
  "DOLFINX_DIR" to a directory containing one of the above files.  If
  "DOLFINX" provides a separate development package or SDK, be sure it has
  been installed.


-- Configuring incomplete, errors occurred!

I am not sure how to proceed further. Many thanks in advance for your help!

Claire

As the error message states, do you have DOLFINx and FFCx installed on your system?
These are prerequisites for DOLFINx_mpc, as stated in: GitHub - jorgensd/dolfinx_mpc at dokken/v0.5.1
The dockerfile is based on the dolfinx docker images, which already has DOLFINx installed.

Thanks for your answer @dokken! I do have dolfinx installed on my computer (using anaconda, I am not sure whether this might be the problem). I don’t know about FFCx, I did not realize this was a requirement. I will look into it!

FFCx is a requirement of DOLFINx. It does not seem like your cmake picks up the fact that you have installed DOLFINx in the conda enviroment. Could you try calling python3 -c "import ffcx; print('ffcx.__version__')" and python3 -c "import dolfinx; print('dolfinx.__version__')"

I installed FFCx by running

pip install fenics-ffcx

now cmake yields another error:

-- Configuring done
CMake Error at CMakeLists.txt:137 (add_library):
  Target "dolfinx_mpc" links to target "hdf5::hdf5" but the target was not
  found.  Perhaps a find_package() call is missing for an IMPORTED target, or
  an ALIAS target is missing?


CMake Error at CMakeLists.txt:137 (add_library):
  Target "dolfinx_mpc" links to target "hdf5::hdf5" but the target was not
  found.  Perhaps a find_package() call is missing for an IMPORTED target, or
  an ALIAS target is missing?


-- Generating done
CMake Generate step failed.  Build files cannot be regenerated correctly.

I did define the environment variables as in the dockerfile though

echo $HDF5_DIR
/usr/local
echo $CC
/home/claire/anaconda3/envs/fenicsx-0.5.1/bin/x86_64-conda-linux-gnu-cc
echo $HDF5_MPI
ON

python3 -c "import ffcx; print('ffcx.__version__')" and python3 -c "import dolfinx; print('dolfinx.__version__')" returns ffcx.__version__

Typo on my end, I meant
python3 -c "import ffcx; print(ffcx.__version__)"
python3 -c "import dolfinx; print(dolfinx.__version__)"

python3 -c "import ffcx; print(ffcx.__version__)"
0.5.0
python3 -c "import dolfinx; print(dolfinx.__version__)"
hwloc/linux: Ignoring PCI device with non-16bit domain.
Pass --enable-32bits-pci-domain to configure to support such devices
(warning: it would break the library ABI, don't enable unless really needed).
0.5.1