Conda installation, adios2 causing problems

Hi, I’ve been trying to re-install dolfinx with a lower python version (3.9) to use adios4dolfinx, which relies on adios2, which relies on numba, which I can’t seem to install for python 3.11 despite the recent merge that supposedly allows numba on python 3.11.

Anyways, I’ve tried creating a new conda environment and reinstalling dolfinx but after installing ufl, basix, and ffcx I run

git clone https://github.com/FEniCS/dolfinx
cd cpp
mkdir build
cd build
cmake -DCMAKE_INSTALL_PREFIX=$ENV_PATH ../
make install
cd ../../python
pip install .

but at the cmake step, with the new environment it can’t detect adios2. I follow the steps to make adios2 from source (here) and this is the error I get

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

I also tried downgrading my python on my existing environment, which was a bad idea as that also erased dolfinx. Now attempting to reinstall dolfinx throws the following error

CMake Error at dolfinx/CMakeLists.txt:115 (target_link_libraries):
  Target "dolfinx" links to:

    adios2::cxx11_mpi

  but the target was not found.  Possible reasons include:

    * There is a typo in the target name.
    * A find_package call is missing for an IMPORTED target.
    * An ALIAS target is missing.

Please let me know if there’s any way around this, I can’t seem to use my old install of dolfinx anymore. I’m unfortunately stuck with an old version of conda, so that doesn’t include a fix of a problem which sometimes points python 3.10 to python 3.1. I also can’t use docker.

I seem to also have a problem installing without specifying the python version (i.e. python 3.11, with basically the same shell script I used 2 months ago), again at the cmake step. Below is my output

-- The following REQUIRED packages have been found:

 * MPI (required version >= 3)
 * pugixml
 * boost_chrono (required version == 1.80.0)
 * boost_headers (required version == 1.80.0)
 * boost_timer (required version == 1.80.0)
 * Boost (required version >= 1.70), Boost C++ libraries, <http://www.boost.org>
 * Basix (required version >= 0.6)
 * PETSc, Portable, Extensible Toolkit for Scientific Computation (PETSc), <https://www.mcs.anl.gov/petsc/>
   PETSc linear algebra backend
 * HDF5, Hierarchical Data Format 5 (HDF5), <https://www.hdfgroup.org/HDF5>
 * Python3
 * UFCx (required version >= 0.6), Interface for form-compilers (part of FFCx), <https://github.com/fenics/ffcx>
 * PkgConfig

-- The following features have been disabled:

 * DOLFINX_SKIP_BUILD_TESTS, Skip build tests for testing usability of dependency packages.

-- The following OPTIONAL packages have not been found:

 * ADIOS2 (required version >= 2.8.1), Adaptable Input/Output (I/O) System., <https://adios2.readthedocs.io/en/latest/>
   IO, including in parallel

-- 
-- Copying demo and test data to build directory.
-- ----------------------------------------------
-- Configuring done (10.1s)
CMake Error in dolfinx/CMakeLists.txt:
  Imported target "hdf5::hdf5" includes non-existent path

    "/home/conda/feedstock_root/build_artifacts/hdf5_1678272894226/work/src/H5FDsubfiling"

  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.

Mixing conda and source installation can be quite tricky, as you need to make certain that you are using the cmake provided by the conda environment (same for pip).

It would be good if you could list what you have installed in the conda environment (using conda install -c conda-forge .....) and what has been installed in other ways (for instance with cmake and pip).

I don’t know how to be certain of that, so here is a condensed stripped-down version of my shell script. I realised that I had actually commented out the source install of adios2 and instead used the conda install to get those error messages above.

ENV_PATH=hmmak/conda/envs/fx-real
BUILD_PATH=hmmak/build-tmp
conda create --prefix $ENV_PATH
conda activate $ENV_PATH

conda install -c conda-forge cxx-compiler cmake python
conda install -c conda-forge xtensor xtl numpy pybind11

git clone https://github.com/FEniCS/basix basix
cd cpp
cmake -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=$ENV_PATH -B build -S .
cmake --build build
cmake --install build
cd ../python
pip install .

cd $BUILD_PATH
git clone https://github.com/FEniCS/ufl ufl
cd ufl
pip install .

cd $BUILD_PATH
git clone https://github.com/FEniCS/ffcx ffcx
pip install .

# only tried for python < 3.11
cd $BUILD_PATH
conda install -c conda-forge adios2
# building from source below seems to cause other problems if I remember correctly
#git clone https://github.com/ornladios/ADIOS2.git ADIOS2
#mkdir adios2-build
#cd adios2-build
#cmake ../ADIOS2
#make -j 16
#make install

conda install -c conda-forge boost mpich hdf5=*=mpi* petsc=*=*real* slepc=*=*real*
cd $BUILD_PATH
git clone https://github.com/FEniCS/dolfinx dolfinx
cd dolfinx
cd cpp
mkdir build
cd build
cmake -DCMAKE_INSTALL_PREFIX=$ENV_PATH ../
make install
echo 'Install dolfinx'
cd ../../python
pip install .

You should start by calling:
which cmake and which pip.
This should return a path that points to inside the conda env.

By looking at your script, you are installing several packages that shouldn’t be needed (xtl and xtensor) and you are missing important ones such as petsc, to be able to compile dolfinx.

Is there a motivation for not using the DOLFINx docker images, which is the recommended and easiest way of using the main branches (if you dont want to install alot from source)?

The cmake and pip seem to be within the env

which cmake
/hmmak/conda/envs/fx-real/bin/cmake
which pip
/hmmak/conda/envs/fx-real/bin/pip

The lack of petsc is my fault; I missed a part when condensing the script, apologies. The conda install before cloning dolfinx should’ve read

conda install -c conda-forge boost mpich hdf5=*=mpi* petsc=*=*real* slepc=*=*real* mpi4py petsc4py slepc4py pyvista

I agree with the simpleness of docker images; I have it on my personal computer. Unfortunately, our lab’s computing policies don’t seem to allow the use of docker on their clusters.

I think I was able to work-around this by installing dolfinx with spack instead of conda. However, just as a note that only worked with dolfinx@0.6.0 and not dolfinx@main as there was a problem with installing basix at the main branch. See logs below:

==> py-fenics-basix: Executing phase: 'install'
==> Error: ProcessError: Command exited with status 1:
    '/stck/hmmak/spack-tools/spack/opt/spack/linux-rhel8-broadwell/gcc-10.2.0/python-3.10.10-wgceiyvff5fu3yafcqn3vyzq5r55z6qs/bin/python3.10' '-m' 'pip' '-vvv' '--no-input' '--no-cache-dir' '--disable-pip-version-check' 'install' '--no-deps' '--ignore-installed' '--no-build-isolation' '--no-warn-script-location' '--no-index' '--prefix=/stck/hmmak/spack-tools/spack/opt/spack/linux-rhel8-broadwell/gcc-10.2.0/py-fenics-basix-main-rfhg4ywv2eoxon6hugcy33ituqdcmupi' '.'

6 errors found in build log:
     72          Python3_LIBRARIES
     73    
     74    
     75      -- Build files have been written to: /tmp/hmmak/spack-stage/spack-stage-
           py-fenics-basix-main-rfhg4ywv2eoxon6hugcy33ituqdcmupi/spack-src/python/bui
           ld/temp.linux-x86_64-cpython-310
     76      [ 50%] Building CXX object CMakeFiles/_basixcpp.dir/wrapper.cpp.o
     77      /tmp/hmmak/spack-stage/spack-stage-py-fenics-basix-main-rfhg4ywv2eoxon6h
           ugcy33ituqdcmupi/spack-src/python/wrapper.cpp: In function ‘void pybind11_
           init__basixcpp(pybind11::module_&)’:
  >> 78    /tmp/hmmak/spack-stage/spack-stage-py-fenics-basix-main-rfhg4ywv2eoxon6hug
           cy33ituqdcmupi/spack-src/python/wrapper.cpp:482:62: error: ‘dof_ordering’ 
           is not a member of ‘basix::FiniteElement’
     79        482 |       .def_property_readonly("dof_ordering", &FiniteElement::dof
           _ordering);
     80            |                                                              ^~~
           ~~~~~~~~~
     81      /tmp/hmmak/spack-stage/spack-stage-py-fenics-basix-main-rfhg4ywv2eoxon6h
           ugcy33ituqdcmupi/spack-src/python/wrapper.cpp: In lambda function:
  >> 82      /tmp/hmmak/spack-stage/spack-stage-py-fenics-basix-main-rfhg4ywv2eoxon6h
           ugcy33ituqdcmupi/spack-src/python/wrapper.cpp:575:75: error: too many argu
           ments to function ‘basix::FiniteElement basix::create_element(basix::eleme
           nt::family, basix::cell::type, int, basix::element::lagrange_variant, basi
           x::element::dpc_variant, bool)’
     83        575 |                                      dvariant, discontinuous, do
           f_ordering);
     84            |                                                                 
                     ^
     85      In file included from /tmp/hmmak/spack-stage/spack-stage-py-fenics-basix
           -main-rfhg4ywv2eoxon6hugcy33ituqdcmupi/spack-src/python/wrapper.cpp:8:
     86      /stck/hmmak/spack-tools/spack/opt/spack/linux-rhel8-broadwell/gcc-10.2.0
           /fenics-basix-main-6tbbzldvqnrqzdc23fznmsr553ceoowa/include/basix/finite-e
           lement.h:1256:15: note: declared here
     87       1256 | FiniteElement create_element(element::family family, cell::type 
           cell,
     88            |               ^~~~~~~~~~~~~~
     89      /tmp/hmmak/spack-stage/spack-stage-py-fenics-basix-main-rfhg4ywv2eoxon6h
           ugcy33ituqdcmupi/spack-src/python/wrapper.cpp: In function ‘void pybind11_
           init__basixcpp(pybind11::module_&)’:
  >> 90    /tmp/hmmak/spack-stage/spack-stage-py-fenics-basix-main-rfhg4ywv2eoxon6hug
           cy33ituqdcmupi/spack-src/python/wrapper.cpp:582:25: error: ‘create_element
           ’ is not a member of ‘basix::docstring’; did you mean ‘create_custom_eleme
           nt’?
     91        582 |       basix::docstring::create_element.c_str());
     92            |                         ^~~~~~~~~~~~~~
     93            |                         create_custom_element
  >> 94      gmake[2]: *** [CMakeFiles/_basixcpp.dir/build.make:76: CMakeFiles/_basix
           cpp.dir/wrapper.cpp.o] Error 1
  >> 95      gmake[1]: *** [CMakeFiles/Makefile2:83: CMakeFiles/_basixcpp.dir/all] Er
           ror 2
  >> 96      gmake: *** [Makefile:91: all] Error 2
     97      Traceback (most recent call last):
     98        File "/stck/hmmak/spack-tools/spack/opt/spack/linux-rhel8-broadwell/gc
           c-10.2.0/py-pip-23.0-hz337tzaxsgzwq2zjxkkce2zfymjxsqs/lib/python3.10/site-
           packages/pip/_vendor/pyproject_hooks/_in_process/_in_process.py", line 353
           , in <module>
     99          main()
     100       File "/stck/hmmak/spack-tools/spack/opt/spack/linux-rhel8-broadwell/gc
           c-10.2.0/py-pip-23.0-hz337tzaxsgzwq2zjxkkce2zfymjxsqs/lib/python3.10/site-
           packages/pip/_vendor/pyproject_hooks/_in_process/_in_process.py", line 335
           , in main
     101         json_out['return_val'] = hook(**hook_input['kwargs'])
     102       File "/stck/hmmak/spack-tools/spack/opt/spack/linux-rhel8-broadwell/gc
           c-10.2.0/py-pip-23.0-hz337tzaxsgzwq2zjxkkce2zfymjxsqs/lib/python3.10/site-
           packages/pip/_vendor/pyproject_hooks/_in_process/_in_process.py", line 251
           , in build_wheel

I’ll take a look at this build error and see if I can fix it this week

This is weird. I was recently able to install dolfinx@main with spack (which installs basix@main). Here’s what my environment looks like

==> Installed packages
-- linux-rhel7-broadwell / gcc@11.3.0 ---------------------------
autoconf@2.69                       libiconv@1.17           py-fenics-dolfinx@main
autoconf-archive@2023.02.20         libmd@1.0.4             py-fenics-ffcx@main
automake@1.16.5                     libsigsegv@2.14         py-fenics-ufl@main
berkeley-db@18.1.40                 libtool@2.4.7           py-mpi4py@3.1.4
bison@3.8.2                         libxcrypt@4.4.33        py-numpy@1.24.2
boost@1.81.0                        libxml2@2.10.3          py-petsc4py@3.18.3
bzip2@1.0.8                         m4@1.4.19               py-pip@23.0
ca-certificates-mozilla@2023-01-10  metis@5.1.0             py-pybind11@2.10.1
cmake@3.25.2                        mpfr@4.2.0              py-pycparser@2.21
diffutils@3.9                       mumps@5.5.1             py-setuptools@63.0.0
expat@2.5.0                         ncurses@6.4             py-wheel@0.37.1
fenics-basix@main                   netlib-scalapack@2.2.0  python@3.10.10
fenics-dolfinx@main                 ninja@1.11.1            re2c@2.2
fenics-ufcx@main                    openblas@develop        readline@8.2
findutils@4.9.0                     openmpi@4.1.0           scotch@7.0.1
flex@2.6.4                          openssl@1.1.1t          sqlite@3.40.1
gdbm@1.23                           parmetis@4.0.3          suite-sparse@5.13.0
gettext@0.21.1                      perl@5.36.0             superlu-dist@8.1.2
gmake@4.4.1                         petsc@3.18.3            tar@1.34
gmp@6.2.1                           pigz@2.7                texinfo@7.0
hdf5@1.14.0                         pkgconf@1.8.0           util-linux-uuid@2.38.1
help2man@1.49.3                     pugixml@1.11.4          xz@5.4.1
hypre@2.28.0                        py-cffi@1.15.1          zlib@1.2.13
libbsd@0.11.7                       py-cython@0.29.33       zstd@1.5.4
libffi@3.4.4                        py-fenics-basix@main
==> 74 installed packages

I started completely from scratch (with a new git clone of spack). I don’t know if it was the commits today and yesterday with basix, but I retried it and the spack install now runs smoothly. However, running import dolfinx after the install now has a error that seems to be related to Rename ufl_wrapper -> ufl, and simplify functions in UFL wrapper (#655) · FEniCS/basix@b86f0d5 · GitHub as follows

>>> import dolfinx
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/stck/hmmak/test-spack/spack/var/spack/environments/fenicsx-real/.spack-env/view/lib/python3.10/site-packages/dolfinx/__init__.py", line 31, in <module>
    from dolfinx import fem, geometry, graph, io, jit, la, log, mesh, nls, plot
  File "/stck/hmmak/test-spack/spack/var/spack/environments/fenicsx-real/.spack-env/view/lib/python3.10/site-packages/dolfinx/fem/__init__.py", line 12, in <module>
    from dolfinx.fem import petsc
  File "/stck/hmmak/test-spack/spack/var/spack/environments/fenicsx-real/.spack-env/view/lib/python3.10/site-packages/dolfinx/fem/petsc.py", line 25, in <module>
    from dolfinx.fem import assemble
  File "/stck/hmmak/test-spack/spack/var/spack/environments/fenicsx-real/.spack-env/view/lib/python3.10/site-packages/dolfinx/fem/assemble.py", line 22, in <module>
    from dolfinx.fem.forms import FormMetaClass, form_types
  File "/stck/hmmak/test-spack/spack/var/spack/environments/fenicsx-real/.spack-env/view/lib/python3.10/site-packages/dolfinx/fem/forms.py", line 13, in <module>
    from dolfinx.fem.function import FunctionSpace
  File "/stck/hmmak/test-spack/spack/var/spack/environments/fenicsx-real/.spack-env/view/lib/python3.10/site-packages/dolfinx/fem/function.py", line 18, in <module>
    import basix.ufl_wrapper
ModuleNotFoundError: No module named 'basix.ufl_wrapper'
>>>

GitHub’s merge queue features seems like it was playing up today, so the changes to DOLFINx to match these FFCx and Basix changes didn’t get merged. They’re merged now (Replace UFL elements with Basix elements in tests and demos (#2381) · FEniCS/dolfinx@d99b790 · GitHub) so it should work again if you pull DOLFINx

2 Likes

I see. Maybe try rebuilding after a while since https://github.com/FEniCS/dolfinx/pull/2381 has been merged? My commit hash is likely older than yours and hence I didn’t face this issue.

2 Likes

Great, it works now with spack! I will abandon trying with conda.

hello, I met the same question,can you tell me how to solve it? I try to update the dolfinx but without any results.