Installation issue M1 macOS

Hi, I tried to install ngsxfem on my M1 macOS 12.4 by first installing ngsolve from source, following Build on Mac OS X. — NGS-Py 6.2.2402 documentation. I did exactly as the steps said, except in my python path I have python3.10 instead of python3.8. I got an error with tkinter, but if I comment “import netgen.gui” I can run the poisson.ipynb file.

Next, I want to install ngsxfem from source by following ngsxfem/ at master · ngsxfem/ngsxfem · GitHub “Installation steps on MacOS”.

Since I have the successfully installed I put INSTLOCATION to /Applications/ as recommended. However, when I run

cmake \
 -DNGSolve_DIR=/Applications/ \

I get the following error message:

– Found PythonInterp: /opt/homebrew/bin/python3 (found suitable version “3.12.2”, minimum required is “3”)
CMake Error at /Applications/ (message):
(Required is at least version “3”)
Call Stack (most recent call first):
CMakeLists.txt:67 (find_package)

It seems like it doesn’t find the correct python paths, but when I run “echo $PYTHONPATH” I get “:/Applications/”

Does anyone know what I am doing wrong?


Try to set -DPython3_EXECUTABLE=path_to_your_python_exe when calling CMake. This should let CMake choose the correct python 3 version.

(Although there seem to be problems in cmake specify specific python3 version when multiple versions are installed (prefer command line parameters) (#23139) · Issues · CMake / CMake · GitLab ).

I tested this on a MacM1 with multiple python versions installed and got following Output during configuration:

-- Found Python3: /Library/Frameworks/Python.framework/Versions/3.12/include/python3.12 (found version "3.12.0") found components: Development.Module 
-- Found Python3: /Library/Frameworks/Python.framework/Versions/3.10/bin/python3.10 (found version "3.10.2") found components: Interpreter Development.Embed 
-- Found Python3: /Library/Frameworks/Python.framework/Versions/3.10/bin/python3.10 (found version "3.10.2") found components: Interpreter

Note that although the first line seems wrong, it still set the correct include path while building. (You can verify that by looking at the generated CMakeCache.txt)


After instead writing

-DPYTHON_EXECUTABLE =/opt/homebrew/Cellar/python@3.10/3.10.9/bin

I was able to configure the project with the following warnings:

Traceback (most recent call last):
File “”, line 1, in
File “/Users/sebastianmyrback/Documents/ngsxfem/src-xfem/python/”, line 7, in check_if_ngsolve_newer_than
import ngsolve
ModuleNotFoundError: No module named ‘ngsolve’
– Found Netgen: /Applications/


WARNING: Target “ngsxfem_py” requests linking to directory “/opt/homebrew/opt/python@3.12/Frameworks/Python.framework/Versions/3.10/lib”. Targets may link only to libraries. CMake is dropping the item.
– Generating done

Then, when I write “make” I get the following error, following by many other errors:

[100%] Linking CXX shared library
Undefined symbols for architecture arm64:
“_PyBaseObject_Type”, referenced from:
pybind11::detail::make_object_base_type(_typeobject*) in python_ngsxfem.cpp.o