Error installing ngsxfem using pip

Hi,

I’ve tried installing ngsxfem in a million different ways now on my Silicon mac.

I’m now using virtual environments using micromamba (like conda), and install ngsolve successfully using pip install ngsolve.

However, when I then try to install ngsxfem by writing pip3 install xfem, I get the following cmake error message

CMake Error at CMakeLists.txt:74 (find_package):
     Could not find a package configuration file provided by "NGSolve" with any
     of the following names:
      
          NGSolveConfig.cmake
          ngsolve-config.cmake

Does anyone know how to fix this?

lets try installation #1.000.002:

pip3 install --pre xfem

with this I get xfem-2.1.2303.post64.dev0-cp312-cp312-macosx_10_15_universal2.whl installed

Thank you for your reply Joachim, unfortunately this gives me the same error message.

From

pip3 install --pre xfem

I get:

Collecting xfem

Using cached xfem-2.1.2303.post64.dev0-cp312-cp312-macosx_10_15_universal2.whl.metadata (645 bytes)

Collecting ngsolve>=6.2.2307.post90 (from xfem)

Using cached ngsolve-6.2.2402.post27.dev0-cp312-cp312-macosx_10_15_universal2.whl.metadata (199 bytes)

Collecting netgen-mesher==6.2.2402.post31.dev (from ngsolve>=6.2.2307.post90->xfem)

Using cached netgen_mesher-6.2.2402.post31.dev0-cp312-cp312-macosx_10_15_universal2.whl.metadata (174 bytes)

Using cached xfem-2.1.2303.post64.dev0-cp312-cp312-macosx_10_15_universal2.whl (1.2 MB)

Using cached ngsolve-6.2.2402.post27.dev0-cp312-cp312-macosx_10_15_universal2.whl (33.8 MB)

Using cached netgen_mesher-6.2.2402.post31.dev0-cp312-cp312-macosx_10_15_universal2.whl (43.1 MB)

Installing collected packages: netgen-mesher, ngsolve, xfem

Successfully installed netgen-mesher-6.2.2402.post31.dev0 ngsolve-6.2.2402.post27.dev0 xfem-2.1.2303.post64.dev0

Uninstall all you netgen-mesher and ngsolve packages, and show us what you get (from the beginning up to the problem)

Joachim

Attached, you find the complete output after uninstalling ngsolve using pip, and then redoing the installations.

output.pdf (68.6 KB)

there are only xfem binary packages for Apple Silicon for Python 3.11 and 3.12 (universal.whl), see xfem · PyPI

your options are

  • swtich to Py 3.11 or 3.12
  • ask the xfem developers for universal wheels also for elder Py versions
  • compile yourself

Hi,

I created a clean virtual environment with no packages installed, and did the following:

  1. Install python3.12 using micromamba install python=3.12.
  2. Install xfem by writing pip3 install --pre xfem.

This succeeds with the output

Collecting xfem
  Using cached xfem-2.1.2303.post64.dev0-cp312-cp312-macosx_10_15_universal2.whl.metadata (645 bytes)
Collecting ngsolve>=6.2.2307.post90 (from xfem)
  Using cached ngsolve-6.2.2402.post34.dev0-cp312-cp312-macosx_10_15_universal2.whl.metadata (199 bytes)
Collecting netgen-mesher==6.2.2402.post37.dev (from ngsolve>=6.2.2307.post90->xfem)
  Using cached netgen_mesher-6.2.2402.post37.dev0-cp312-cp312-macosx_10_15_universal2.whl.metadata (174 bytes)
Using cached xfem-2.1.2303.post64.dev0-cp312-cp312-macosx_10_15_universal2.whl (1.2 MB)
Using cached ngsolve-6.2.2402.post34.dev0-cp312-cp312-macosx_10_15_universal2.whl (33.8 MB)
Using cached netgen_mesher-6.2.2402.post37.dev0-cp312-cp312-macosx_10_15_universal2.whl (43.1 MB)
Installing collected packages: netgen-mesher, ngsolve, xfem
Successfully installed netgen-mesher-6.2.2402.post37.dev0 ngsolve-6.2.2402.post34.dev0 xfem-2.1.2303.post64.dev0

However, if I enter python3 and type from xfem import *, I get the following error message, indicating that xfem was not installed for the ARM architecture. What am I doing wrong then?

>>> from xfem import *
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/Users/sebastianmyrback/y/envs/ngenv/lib/python3.12/site-packages/xfem/__init__.py", line 23, in <module>
    from xfem.ngsxfem_py import *
ImportError: dlopen(/Users/sebastianmyrback/y/envs/ngenv/lib/python3.12/site-packages/xfem/ngsxfem_py.so, 0x0002): tried: '/Users/sebastianmyrback/y/envs/ngenv/lib/python3.12/site-packages/xfem/ngsxfem_py.so' (mach-o file, but is an incompatible architecture (have 'x86_64', need 'arm64e' or 'arm64')), '/System/Volumes/Preboot/Cryptexes/OS/Users/sebastianmyrback/y/envs/ngenv/lib/python3.12/site-packages/xfem/ngsxfem_py.so' (no such file), '/Users/sebastianmyrback/y/envs/ngenv/lib/python3.12/site-packages/xfem/ngsxfem_py.so' (mach-o file, but is an incompatible architecture (have 'x86_64', need 'arm64e' or 'arm64'))

The exact same thing happens if I try to do it with python3.11. I’m using macOS 14.4.1.

Hey,

We just updated the pip-packages for xfem and tried to support more Mac configurations. Please have another try.

Best,
Christoph

Hi,

Now I’m getting a segmentation fault instead:

(ngenv) sebastianmyrback@n168-p199 ~ % pip3 install --pre xfem
Collecting xfem
  Using cached xfem-2.1.2303.post70.dev0-cp312-cp312-macosx_10_15_universal2.whl.metadata (645 bytes)
Collecting ngsolve>=6.2.2307.post90 (from xfem)
  Using cached ngsolve-6.2.2402.post34.dev0-cp312-cp312-macosx_10_15_universal2.whl.metadata (199 bytes)
Collecting netgen-mesher==6.2.2402.post37.dev (from ngsolve>=6.2.2307.post90->xfem)
  Using cached netgen_mesher-6.2.2402.post37.dev0-cp312-cp312-macosx_10_15_universal2.whl.metadata (174 bytes)
Using cached xfem-2.1.2303.post70.dev0-cp312-cp312-macosx_10_15_universal2.whl (2.2 MB)
Using cached ngsolve-6.2.2402.post34.dev0-cp312-cp312-macosx_10_15_universal2.whl (33.8 MB)
Using cached netgen_mesher-6.2.2402.post37.dev0-cp312-cp312-macosx_10_15_universal2.whl (43.1 MB)
Installing collected packages: netgen-mesher, ngsolve, xfem
Successfully installed netgen-mesher-6.2.2402.post37.dev0 ngsolve-6.2.2402.post34.dev0 xfem-2.1.2303.post70.dev0
(ngenv) sebastianmyrback@n168-p199 ~ % python3 -V
Python 3.12.2
(ngenv) sebastianmyrback@n168-p199 ~ % python3   
Python 3.12.2 | packaged by conda-forge | (main, Feb 16 2024, 20:54:21) [Clang 16.0.6 ] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> from xfem import *
zsh: segmentation fault  python3