FEniCS / dolfinx

Next generation FEniCS problem solving environment
https://fenicsproject.org
GNU Lesser General Public License v3.0
731 stars 177 forks source link

[BUG]: fenics-basix #3101

Closed DieselDriver closed 6 months ago

DieselDriver commented 6 months ago

Summarize the issue

installation instructions does not work for Python

Defaulting to user installation because normal site-packages is not writeable
Processing /home/ubuntu/dolfinx/python
  Preparing metadata (pyproject.toml) ... done
Requirement already satisfied: numpy>=1.21 in /usr/lib/python3/dist-packages (from fenics-dolfinx==0.8.0.dev0) (1.24.2)
Requirement already satisfied: cffi in /usr/lib/python3/dist-packages (from fenics-dolfinx==0.8.0.dev0) (1.15.1)
Requirement already satisfied: petsc4py in /usr/lib/petsc/lib/python3/dist-packages (from fenics-dolfinx==0.8.0.dev0) (3.18.5)
Requirement already satisfied: mpi4py in /usr/lib/python3/dist-packages (from fenics-dolfinx==0.8.0.dev0) (3.1.4)
INFO: pip is looking at multiple versions of fenics-dolfinx to determine which version is compatible with other requirements. This could take a while.
ERROR: Could not find a version that satisfies the requirement fenics-basix<0.9.0,>=0.8.0.dev0 (from fenics-dolfinx) (from versions: 0.4.0, 0.4.2.post1, 0.5.0, 0.6.0, 0.7.0.post0)
ERROR: No matching distribution found for fenics-basix<0.9.0,>=0.8.0.dev0

I tried several distributions but on every the installation ends with with issue.

ERROR: Could not find a version that satisfies the requirement fenics-basix<0.9.0,>=0.8.0.dev0 (from fenics-dolfinx) (from versions: 0.4.0, 0.4.2.post1, 0.5.0, 0.6.0, 0.7.0.post0)
ERROR: No matching distribution found for fenics-basix<0.9.0,>=0.8.0.dev0

How to reproduce the bug

sudo add-apt-repository ppa:fenics-packages/fenics
sudo apt update
sudo apt install fenicsx
pip install -r build-requirements.txt --break-system-specification
pip install --check-build-dependencies --no-build-isolation .

Minimal Example (Python)

No response

Output (Python)

No response

Version

0.7.3

DOLFINx git commit

No response

Installation

No response

Additional information

No response

jorgensd commented 6 months ago

What are you trying to pip install on top of the apt packages?

Since you have installed FEniCSx through apt there is no need to install basix (or ffcx, ufl or dolfinx) with pip.

DieselDriver commented 6 months ago

Without fenics packages I get the same error.

But when I try to use dolfinx in python scripts, there occurs following issue.

PETSc Error --- Application was linked against both OpenMPI and MPICH based MPI libraries and will not run correctly
Traceback (most recent call last):
  File "/root/dolfinx_0.7.3/....py", line 17, in <module>
    from dolfinx import fem, mesh, io, plot
  File "/usr/lib/petsc/lib/python3/dist-packages/dolfinx/__init__.py", line 40, in <module>
    from dolfinx.generation import (IntervalMesh, BoxMesh, RectangleMesh,
  File "/usr/lib/petsc/lib/python3/dist-packages/dolfinx/generation.py", line 13, in <module>
    from dolfinx import cpp, fem
  File "/usr/lib/petsc/lib/python3/dist-packages/dolfinx/fem/__init__.py", line 10, in <module>
    from dolfinx.fem.assemble import (apply_lifting, apply_lifting_nest,
  File "/usr/lib/petsc/lib/python3/dist-packages/dolfinx/fem/assemble.py", line 12, in <module>
    from petsc4py import PETSc
  File "/usr/local/lib/python3.9/dist-packages/petsc4py/PETSc.py", line 4, in <module>
    PETSc._initialize()
  File "petsc4py/PETSc/PETSc.pyx", line 581, in petsc4py.PETSc._initialize
  File "petsc4py/PETSc/PETSc.pyx", line 474, in petsc4py.PETSc.initialize
*** The MPI_Comm_size() function was called before MPI_INIT was invoked.
*** This is disallowed by the MPI standard.
*** Your MPI job will now abort.

This is not solveable at moment. :-(

jorgensd commented 6 months ago

@drew-parsons do you know why PETSc is linked like the above?

PETSc Error --- Application was linked against both OpenMPI and MPICH based MPI libraries and will not run correctly

Does this indicate a non-apt installed petsc?

francesco-ballarin commented 6 months ago
  File "/usr/local/lib/python3.9/dist-packages/petsc4py/PETSc.py", line 4, in <module>

That's definitely a non-apt installed petsc4py. On ubuntu and debian petsc4py is shipped in /usr/lib/petsc/.

We are also suggesting that all installation questions should be asked on discourse, so we may want to wait for a further answer by @DieselDriver and then close this.

DieselDriver commented 6 months ago
Building wheels for collected packages: petsc
  Building wheel for petsc (setup.py) ... error
  error: subprocess-exited-with-error

  × python setup.py bdist_wheel did not run successfully.
  │ exit code: 1
  ╰─> [1 lines of output]
      petsc: this package cannot be built as a wheel
      [end of output]

  note: This error originates from a subprocess, and is likely not a problem with pip.
  ERROR: Failed building wheel for petsc
  Running setup.py clean for petsc
Failed to build petsc
ERROR: Could not build wheels for petsc, which is required to install pyproject.toml-based projects

If I try to install with your requirements-file, it also will not be installed.

francesco-ballarin commented 6 months ago

In general you must not mix packages installed by apt and those installed by pip. You have already destroyed the system petsc4py installation, and now you are trying to do so with petsc too.

Please uninstall any earlier pip install attempt, and then start back from installing basix (rather than dolfinx). I am going to close this down, if you get further errors please post at https://fenicsproject.discourse.group/