I am trying to install dolfinx from source inside the latest Docker dev-env image (fetched using docker pull dolfinx/dev-env:nightly).
Cloning and installing ufl, basix and ffcx works fine, but after subsequent cloning and trying to install dolfinx:
git clone https://github.com/FEniCS/dolfinx.git cd dolfinx/cpp && mkdir build && cd build cmake ..
I get
β SCOTCH could not be found. Be sure to set SCOTCH_ROOT. (missing: SCOTCH_LIBRARIES SCOTCH_INCLUDE_DIRS SCOTCH_TEST_RUNS) ** β ParMETIS could not be found/configured. (missing: PARMETIS_LIBRARIES PARMETIS_TEST_RUNS PARMETIS_INCLUDE_DIRS PARMETIS_VERSION PARMETIS_VERSION_OK) (Required is at least version β4.0.2β) CMake Error at CMakeLists.txt:359 (message):
** No graph partitioner found. SCOTCH, ParMETIS or KaHIP is required.
So, I understood that the dev-env Docker container already contains all PETSc and other related dependencies to install dolfinx. Do I see this wrong and would I need to install some of the other dependencies, too?
You need to set the PETSC_DIR and PETSC_ARCH as the dev-env does not set these (as it contains multiple installations of PETSc, real32, complex32 etc).
Thanks. This worked (setting PETSC_DIR=/usr/local/petsc and PETSC_ARCH=linux-gnu-real-64) and I could build according to the instructions.
Trying to run a demo/importing dolfinx in Python3 however yields
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/home/shared/work/codes/fenicsx/dolfinx/python/dolfinx/__init__.py", line 34, in <module>
from dolfinx.common import (TimingType, git_commit_hash, has_debug, has_kahip,
File "/home/shared/work/codes/fenicsx/dolfinx/python/dolfinx/common.py", line 11, in <module>
from dolfinx import cpp as _cpp
ImportError: cannot import name 'cpp' from partially initialized module 'dolfinx' (most likely due to a circular import) (/home/shared/work/codes/fenicsx/dolfinx/python/dolfinx/__init__.py)
I would need the output of the build-logs to be able to give any guidance on this, as this usually means that something failed during installation of the python bindings.
After calling cmake -DCMAKE_INSTALL_PREFIX=../build_install .. inside dolfinx/cpp/build, I get the following inside the CMakeError.log:
Determining if the PETSC_USE_COMPLEX exist failed with the following output:
Change Dir: /home/shared/work/codes/fenicsx/dolfinx/cpp/build/CMakeFiles/CMakeTmp
Run Build Command(s):/usr/bin/gmake -f Makefile cmTC_6e70f/fast && /usr/bin/gmake -f CMakeFiles/cmTC_6e70f.dir/build.make CMakeFiles/cmTC_6e70f.dir/build
gmake[1]: Entering directory '/home/shared/work/codes/fenicsx/dolfinx/cpp/build/CMakeFiles/CMakeTmp'
Building C object CMakeFiles/cmTC_6e70f.dir/CheckSymbolExists.c.o
/usr/bin/cc -I/usr/local/petsc/linux-gnu-real-64/include -I/usr/local/petsc/include -o CMakeFiles/cmTC_6e70f.dir/CheckSymbolExists.c.o -c /home/shared/work/codes/fenicsx/dolfinx/cpp/build/CMakeFiles/CMakeTmp/CheckSymbolExists.c
/home/shared/work/codes/fenicsx/dolfinx/cpp/build/CMakeFiles/CMakeTmp/CheckSymbolExists.c: In function 'main':
/home/shared/work/codes/fenicsx/dolfinx/cpp/build/CMakeFiles/CMakeTmp/CheckSymbolExists.c:8:19: error: 'PETSC_USE_COMPLEX' undeclared (first use in this function); did you mean 'PETSC_HAVE_COMPLEX'?
8 | return ((int*)(&PETSC_USE_COMPLEX))[argc];
| ^~~~~~~~~~~~~~~~~
| PETSC_HAVE_COMPLEX
/home/shared/work/codes/fenicsx/dolfinx/cpp/build/CMakeFiles/CMakeTmp/CheckSymbolExists.c:8:19: note: each undeclared identifier is reported only once for each function it appears in
gmake[1]: *** [CMakeFiles/cmTC_6e70f.dir/build.make:78: CMakeFiles/cmTC_6e70f.dir/CheckSymbolExists.c.o] Error 1
gmake[1]: Leaving directory '/home/shared/work/codes/fenicsx/dolfinx/cpp/build/CMakeFiles/CMakeTmp'
gmake: *** [Makefile:127: cmTC_6e70f/fast] Error 2
File /home/shared/work/codes/fenicsx/dolfinx/cpp/build/CMakeFiles/CMakeTmp/CheckSymbolExists.c:
/* */
#include <petscsystypes.h>
int main(int argc, char** argv)
{
(void)argv;
#ifndef PETSC_USE_COMPLEX
return ((int*)(&PETSC_USE_COMPLEX))[argc];
#else
(void)argc;
return 0;
#endif
}
Sure. So here is what Iβm doing after having pulled the container, docker pull dolfinx/dev-env:nightly.
Iβm launching the container with the following .env.list file:
Now, typing python3 and then in the command prompt import dolfinx yields the error
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/home/shared/work/codes/fenicsx/dolfinx/python/dolfinx/__init__.py", line 34, in <module>
from dolfinx.common import (TimingType, git_commit_hash, has_debug, has_kahip,
File "/home/shared/work/codes/fenicsx/dolfinx/python/dolfinx/common.py", line 11, in <module>
from dolfinx import cpp as _cpp
ImportError: cannot import name 'cpp' from partially initialized module 'dolfinx' (most likely due to a circular import) (/home/shared/work/codes/fenicsx/dolfinx/python/dolfinx/__init__.py)
Thanks, itβs working like this for me. Not sure what the cause of the problem was. Maybe that something got mixed up with install locations, as I used others than /usr/local.