Ngsxfem installation problem


I am trying to use ngsxfem but I have a problem with the installation.

I am on Ubuntu 22.04.2 and I have installed NGSolve-6.2.2302.
I am running NGSolve using a virtual environment:
python3 -m venv ngvirtual

Then I installed ngsxfem using:
pip3 install xfem

Running from the demos in ngsxfem I get the following error:

Traceback (most recent call last):
File “/home/antoine/ngsolve/”, line 66, in
from xfem import *
File “/home/antoine/ngsolve/ngvirtual/lib/python3.10/site-packages/xfem/”, line 23, in
from xfem.ngsxfem_py import *
ImportError: cannot open shared object file: No such file or directory

Indeed I can find the file but not

Any idea on how I should proceed to solve this problem? Thank you.

Hi Antoine,

it looks like you have a different mkl version compared to the one used to build the binaries for pypi. The quickest solution is probably for you to build ngsxfem from sources locally. If you have installed cmake and git, this should be doable just with the command

pip3 install git+

Otherwise, checkout the instructions to build from the sources here.

Best wishes,

Alternatively you could try if installing ngsolve and mkl through pip helps (both recent versions should be compatible with ngsxfem).



Thank you. I tried to install mkl through pip and it was installing mkl 2022.2.1. The latest version of mkl is 2023.1.0, so I installed it but then I get the following message:

ERROR: pip’s dependency resolver does not currently take into account all the packages that are installed. This behaviour is the source of the following dependency conflicts.
ngsolve 6.2.2302 requires mkl==2022.*, but you have mkl 2023.1.0 which is incompatible.

Is it the correct version of ngsolve?

I think I will try to install from source then.