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)?
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
>>> 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'
>>>
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.