CMake looking for python2 version of petsc4py when running script with python3

58 views
Skip to first unread message

Fabrice Silva

unread,
Apr 13, 2018, 8:27:59 AM4/13/18
to fenics-support
I recently installed fenics from debian sid repository. The packages are :
python3-dijitso (2017.2.0.0-2)
python3-dolfin (2017.2.0.post0-3)
python3-ffc (2017.2.0.post0-2)
python3-fiat (2017.2.0.0-2)
python3-instant (2017.2.0.0-2)
python3-mpi4py (2.0.0-3)
python3-petsc4py (3.8.1-3)
python3-slepc4py (3.8.0-3)
python3-ufl (2017.2.0.0-2)
libdolfin-dev (2017.2.0.post0-3)
libdolfin2017.2 (2017.2.0.post0-3)
libslepc-real3.8 (3.8.2+dfsg1-4)
libslepc-real3.8-dev (3.8.2+dfsg1-4)
libpetsc-real3.8 (3.8.4+dfsg1-1)
libpetsc-real3.8-dev (3.8.4+dfsg1-1)

Yet, when I running the following line in the python3 interpreter :
>>> fenics.Expression("1/x[0]")

I get the next messsages and traceback

Calling DOLFIN just-in-time (JIT) compiler, this may take some time.
--- Instant: compiling --- In instant.recompile: The module did not compile with command 'cmake -DDEBUG=TRUE .', see '/home/fab/.cache/instant/python3.6/error/dolfin_4bedd8911ad2fa3696d85d184d02a288d3294659/compile.log' Traceback (most recent call last): File "test_fenics.py", line 57, in <module> aux_invr = fe.Expression("1/x[0]") File "/usr/lib/python3/dist-packages/dolfin/functions/expression.py", line 679, in __new__ mpi_comm=kwargs.get("mpi_comm")) File "/usr/lib/python3/dist-packages/dolfin/compilemodules/expressions.py", line 266, in compile_expressions mpi_comm=mpi_comm) File "/usr/lib/python3/dist-packages/dolfin/compilemodules/expressions.py", line 183, in compile_expression_code mpi_comm=mpi_comm) File "/usr/lib/python3/dist-packages/dolfin/compilemodules/jit.py", line 70, in mpi_jit return local_jit(*args, **kwargs) File "/usr/lib/python3/dist-packages/dolfin/compilemodules/compilemodule.py", line 603, in compile_extension_module **instant_kwargs) File "/usr/lib/python3/dist-packages/instant/build.py", line 577, in build_module build_system) File "/usr/lib/python3/dist-packages/instant/build.py", line 158, in recompile instant_error(msg % (cmd, compile_log_filename_dest)) File "/usr/lib/python3/dist-packages/instant/output.py", line 96, in instant_error raise RuntimeError(text) RuntimeError: In instant.recompile: The module did not compile with command 'cmake -DDEBUG=TRUE .', see '/home/fab/.cache/instant/python3.6/error/dolfin_4bedd8911ad2fa3696d85d184d02a288d3294659/compile.log
 
The mentioned compile.log is :

-- The C compiler identification is GNU 7.3.0
-- The CXX compiler identification is GNU 7.3.0
-- Check for working C compiler: /usr/bin/cc
-- Check for working C compiler: /usr/bin/cc -- works
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Detecting C compile features
-- Detecting C compile features - done
-- Check for working CXX compiler: /usr/bin/c++
-- Check for working CXX compiler: /usr/bin/c++ -- works
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- Found PythonInterp: /usr/bin/python3 (found version "3.6.5")
-- Found PkgConfig: /usr/bin/pkg-config (found version "0.29")
-- Checking for one of the modules 'craypetsc_real;PETSc'
-- Looking for sys/types.h
-- Looking for sys/types.h - found
-- Looking for stdint.h
-- Looking for stdint.h - found
-- Looking for stddef.h
-- Looking for stddef.h - found
-- Check size of PetscInt
-- Check size of PetscInt - failed
-- Checking for one of the modules 'crayslepc_real;SLEPc'
-- Found SWIG: /usr/bin/swig (found version "3.0.12")
CMake Deprecation Warning at /usr/share/cmake-3.10/Modules/UseSWIG.cmake:231 (message):
  SWIG_ADD_MODULE
is deprecated.  Use SWIG_ADD_LIBRARY instead.
Call Stack (most recent call first):
 
CMakeLists.txt:77 (swig_add_module)


-- Configuring done
CMake Error in CMakeLists.txt:
 
Imported target "dolfin" includes non-existent path

   
"/usr/lib/python2.7/dist-packages/petsc4py/include"

 
in its INTERFACE_INCLUDE_DIRECTORIES.  Possible reasons include:

 
* The path was deleted, renamed, or moved to another location.

 
* An install or uninstall procedure did not complete successfully.

 
* The installation package was faulty and references files it does not
  provide
.



CMake Error in CMakeLists.txt:
 
Imported target "dolfin" includes non-existent path

   
"/usr/lib/python2.7/dist-packages/petsc4py/include"

 
in its INTERFACE_INCLUDE_DIRECTORIES.  Possible reasons include:

 
* The path was deleted, renamed, or moved to another location.

 
* An install or uninstall procedure did not complete successfully.

 
* The installation package was faulty and references files it does not
  provide
.



-- Generating done
CMake Warning:
 
Manually-specified variables were not used by the project:

    DEBUG


-- Build files have been written to: /tmp/tmplebo5h602018-4-10-23-31_instant_9a055f5695950645a7c30ba0853c233847079145/dolfin_4bedd8911ad2fa3696d85d184d02a288d3294659


It seems that cmake is trying to grab petsc4py from python2 and not python3.
Grepping for the incorrect path, I find it in cMakeFiles/_dolfin_somehash/build.make where the dolfin_somehash_wrap.cxx target (highlighting weird options):

/usr/bin/swig -python -module dolfin_somehash -shadow -modern -modernargs -fastdispatch -fvirtual
   
-nosafecstrings -noproxydel -fastproxy -fastinit -fastunpack -fastquery -nobuildnone -DDOLFIN_VERSION="2017.2.0" -DDOLFIN_LA_INDEX_SIZE=4
   
-DHAS_SLEPC -DHAS_PETSC -DHAS_PETSC4PY -DHAS_SLEPC4PY -DHAS_MPI
   
-DNUMPY_VERSION_MAJOR=1 -DNUMPY_VERSION_MINOR=13 -DNUMPY_VERSION_MICRO=3 -DNPY_NO_DEPRECATED_API=NPY_1_13_API_VERSION
   
-c++ -fcompact -O -I. -small -py3
   
-outdir /tmpfolder/dolfin_somehash
   
-c++
   
-I/usr/include
   
-I/usr/include/eigen3
   
-I/usr/include/hdf5/openmpi
    -I/usr/lib/python2.7/dist-packages/petsc4py/include
   
-I/usr/lib/x86_64-linux-gnu/openmpi/include/openmpi
   
-I/usr/lib/x86_64-linux-gnu/openmpi/include/openmpi/opal/mca/event/libevent2022/libevent
   
-I/usr/lib/x86_64-linux-gnu/openmpi/include/openmpi/opal/mca/event/libevent2022/libevent/include
   
-I/usr/lib/x86_64-linux-gnu/openmpi/include
   
-I/usr/lib/petscdir/petsc3.8/x86_64-linux-gnu-real/include
   
-I/usr/include/superlu-dist
   
-I/usr/include/hypre
   
-I/usr/include/suitesparse
   
-I/usr/include/superlu
   
-I/usr/include/scotch
   
-I/tmpfolder/dolfin_somehash/.
   
-I/usr/lib/python3/dist-packages/numpy/core/include
   
-I/usr/include/python3.6m
    -I/usr/lib/python3/dist-packages/petsc4py/include
   
-I/usr/lib/python3/dist-packages/slepc4py/include
   
-I/tmpfolder/dolfin_somehash
   
-o /tmpfolder/dolfin_somehash/dolfin_somehashPYTHON_wrap.cxx
   
/tmpfolder/dolfin_somehash/dolfin_somehash.i

Johannes Ring

unread,
Apr 13, 2018, 9:17:02 AM4/13/18
to Fabrice Silva, fenics-support
The problem is that the path to petsc4py is included in /usr/share/dolfin/cmake/DOLFINConfig.cmake and /usr/share/dolfin/cmake/DOLFINTargets.cmake, while it should only have been included in /usr/share/dolfin/cmake/DOLFINPython27.cmake and /usr/share/dolfin/cmake/DOLFINPython36.cmake. The quick fix would be to either install python-petsc4py (the petsc4py include files are the same for python2 and python3) or to remove the path to petsc4py from DOLFINConfig.cmake and DOLFINTargets.cmake.

For getting this fixed in the Debian package, you should report this as a bug for the Debian package.

Johannes 

--
You received this message because you are subscribed to the Google Groups "fenics-support" group.
To unsubscribe from this group and stop receiving emails from it, send an email to fenics-support+unsubscribe@googlegroups.com.
To post to this group, send email to fenics-support@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/fenics-support/73bddb87-99c5-4cbb-95b1-1eed2264e2c4%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Fabrice Silva

unread,
Apr 13, 2018, 10:50:47 AM4/13/18
to fenics-support
Thanks for the hint: it does solve the problem. Patch is proposed to debian package
https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=895419
Reply all
Reply to author
Forward
0 new messages