What is the correct way to install NGSolve with ngsPETSc on Ubuntu 24.04? I have it installed on Ubuntu 22.04 following the instructions from https://ngspetsc.readthedocs.io/en/latest/install.html . However, these don’t work on Ubuntu 24.04.
I found installation instructions using a virtual environment at https://docu.ngsolve.org/ngs24/intro.html#
I can run python -m ngsolve.demos.intro.poisson
but then python -i -c "import netgen.gui; import ngsolve.demos.intro.poisson"
will give me an error:
ModuleNotFoundError: No module named 'tkinter'
Assuming this isn’t an issue, I continue with python -m pip install -i https://pypi.anaconda.org/mpi4py/simple openmpi
but I get an error:
ERROR: Could not find a version that satisfies the requirement openmpi (from versions: none)
Also, python -m pip install git git+https://github.com/NGSolve/ngsPETSc.git
gives me the following output:
Collecting git+https://github.com/NGSolve/ngsPETSc.git
Cloning https://github.com/NGSolve/ngsPETSc.git to /tmp/pip-req-build-7wh7oqy_
Running command git clone --filter=blob:none --quiet https://github.com/NGSolve/ngsPETSc.git /tmp/pip-req-build-7wh7oqy_
Resolved https://github.com/NGSolve/ngsPETSc.git to commit 5c794146e426529242dd64bb58852dbf32f66bf5
Installing build dependencies ... done
Getting requirements to build wheel ... done
Preparing metadata (pyproject.toml) ... done
ERROR: Could not find a version that satisfies the requirement git (from versions: none)
ERROR: No matching distribution found for git
I had to update a few packages and then following the installation steps from https://docu.ngsolve.org/ngs24/intro.html (except for the last step where I had to replace
python -m pip install git git+https://github.com/NGSolve/ngsPETSc.git
with
python -m pip install gitpython git+https://github.com/NGSolve/ngsPETSc.git
I now have it installed:
Collecting git+https://github.com/NGSolve/ngsPETSc.git
Cloning https://github.com/NGSolve/ngsPETSc.git to /tmp/pip-req-build-sdn21h7j
Running command git clone --filter=blob:none --quiet https://github.com/NGSolve/ngsPETSc.git /tmp/pip-req-build-sdn21h7j
Resolved https://github.com/NGSolve/ngsPETSc.git to commit 5c794146e426529242dd64bb58852dbf32f66bf5
Installing build dependencies ... done
Getting requirements to build wheel ... done
Preparing metadata (pyproject.toml) ... done
Requirement already satisfied: gitpython in ./ngs24-c/lib/python3.12/site-packages (3.1.44)
Requirement already satisfied: gitdb<5,>=4.0.1 in ./ngs24-c/lib/python3.12/site-packages (from gitpython) (4.0.12)
Requirement already satisfied: netgen-mesher<7.0,>=6.2 in ./ngs24-c/lib/python3.12/site-packages (from ngsPETSc==0.1.0) (6.2.2505)
Requirement already satisfied: netgen-occt<8.0,>=7.8 in ./ngs24-c/lib/python3.12/site-packages (from ngsPETSc==0.1.0) (7.8.1)
Requirement already satisfied: numpy<3,>=2 in ./ngs24-c/lib/python3.12/site-packages (from ngsPETSc==0.1.0) (2.3.1)
Requirement already satisfied: petsc4py<4.0,>=3.22.1 in ./ngs24-c/lib/python3.12/site-packages (from ngsPETSc==0.1.0) (3.23.4)
Requirement already satisfied: scipy<2,>=1 in ./ngs24-c/lib/python3.12/site-packages (from ngsPETSc==0.1.0) (1.16.0)
Requirement already satisfied: smmap<6,>=3.0.1 in ./ngs24-c/lib/python3.12/site-packages (from gitdb<5,>=4.0.1->gitpython) (5.0.2)
Requirement already satisfied: petsc<3.24,>=3.23 in ./ngs24-c/lib/python3.12/site-packages (from petsc4py<4.0,>=3.22.1->ngsPETSc==0.1.0) (3.23.4)
Building wheels for collected packages: ngsPETSc
Building wheel for ngsPETSc (pyproject.toml) ... done
Created wheel for ngsPETSc: filename=ngspetsc-0.1.0-py3-none-any.whl size=26607 sha256=1416ec0f174848ffb2650523f65028db3eeab5a1d6ad8b5a98f26e6f48859fb3
Stored in directory: /tmp/pip-ephem-wheel-cache-mh7hdhj9/wheels/f8/c7/b1/078f337d77c2ed2fde47ba3a4b0b1f9f7aa8e899a8df223c3e
Successfully built ngsPETSc
Installing collected packages: ngsPETSc
Successfully installed ngsPETSc-0.1.0
However, if I run the following
from ngsolve import *
from netgen.geom2d import unit_square
from mpi4py.MPI import COMM_WORLD
from ngsPETSc import KrylovSolver
def test():
'''
to do
'''
test()
I get a segmentation error:
YOUR APPLICATION TERMINATED WITH THE EXIT STRING: Segmentation fault (signal 11)
If I comment out the line from ngsPETSc import KrylovSolver
the code runs, so I’m assuming something with ngsPETSc is not correctly installed. Any idea?