"pip install xfem --pre" fails for ngsolve==6.2.2405

Dear community,
I have problems to pip install xfem for ngsolve version 6.2.2405. I am working on Windows. Two colleagues of mine encounter the same problem. We get this error:

ERROR: Failed building wheel for xfem
Failed to build xfem
ERROR: ERROR: Failed to build installable wheels for some pyproject.toml based projects (xfem)

A few month ago, I installed xfem without problems. However, they were different versions. I had ngsolve==6.2.2404.post51 xfem==2.1.2404.

Now, I am wondering whether xfem is not yet compatible with the new ngsolve. The lib and dll files, which I found for example in ‘site_packages/netgen’ look quite different between the two ngsolve versions.

Any idea what a possible solution might be? Is there a possibility to pip-install older versions of ngsolve (I am only able to install 6.2.2405)?

Thank you for your help.
Best,
Michael Loibl

yes, we haven’t had released ngsxfem for quite a while.
Please retry again now.

Best,
Christoph

Hi,

I just retried, but I still obtain the same error. I get the message below (please excuse that there are parts in German within the message due to a German version of Visual Studio). Are there any further prerequisites which you would have in mind? I had for example Visual Studio 2019 on my first computer, where the installation worked a few months ago, whereas on the second computer, where I try now, I have Visual Studio 2022. I don’t dare to reinstall it on my first computer because at least I have a running version there at the moment.

Let me know if I should send you more details which might help solving this issue.

C:\Users\Loibl>pip install xfem
Collecting xfem
  Downloading xfem-2.1.2405.tar.gz (2.2 MB)
     ---------------------------------------- 2.2/2.2 MB 8.3 MB/s eta 0:00:00
  Installing build dependencies ... done
  Getting requirements to build wheel ... done
  Preparing metadata (pyproject.toml) ... done
Requirement already satisfied: ngsolve==6.2.2405 in c:\users\loibl\appdata\local\programs\python\python313\lib\site-packages (from xfem) (6.2.2405)
Requirement already satisfied: netgen-mesher==6.2.2405 in c:\users\loibl\appdata\local\programs\python\python313\lib\site-packages (from ngsolve==6.2.2405->xfem) (6.2.2405)
Requirement already satisfied: mkl in c:\users\loibl\appdata\local\programs\python\python313\lib\site-packages (from ngsolve==6.2.2405->xfem) (2024.2.2)
Requirement already satisfied: netgen-occt==7.8.1 in c:\users\loibl\appdata\local\programs\python\python313\lib\site-packages (from netgen-mesher==6.2.2405->ngsolve==6.2.2405->xfem) (7.8.1)
Requirement already satisfied: intel-openmp>=2023 in c:\users\loibl\appdata\local\programs\python\python313\lib\site-packages (from mkl->ngsolve==6.2.2405->xfem) (2024.2.1)
Requirement already satisfied: tbb==2021.* in c:\users\loibl\appdata\local\programs\python\python313\lib\site-packages (from mkl->ngsolve==6.2.2405->xfem) (2021.13.1)
Requirement already satisfied: intel-cmplr-lib-ur==2024.2.1 in c:\users\loibl\appdata\local\programs\python\python313\lib\site-packages (from intel-openmp>=2023->mkl->ngsolve==6.2.2405->xfem) (2024.2.1)
Building wheels for collected packages: xfem
  Building wheel for xfem (pyproject.toml) ... error
  error: subprocess-exited-with-error

  × Building wheel for xfem (pyproject.toml) did not run successfully.
  │ exit code: 1
  ╰─> [78 lines of output]
      2024-11-06 17:32:03,183 - scikit_build_core - WARNING - cmake should not be in build-system.requires - scikit-build-core will inject it as needed
      *** scikit-build-core 0.10.7 using CMake 3.30.5 (wheel)
      *** Configuring CMake...
      loading initial cache file C:\Users\Loibl\AppData\Local\Temp\tmp6x6tg5d8\build\CMakeInit.txt
      -- Building for: Visual Studio 17 2022
      -- The C compiler identification is MSVC 19.41.34123.0
      -- The CXX compiler identification is MSVC 19.41.34123.0
      -- Detecting C compiler ABI info
      -- Detecting C compiler ABI info - done
      -- Check for working C compiler: C:/Program Files/Microsoft Visual Studio/2022/Community/VC/Tools/MSVC/14.41.34120/bin/Hostx64/x64/cl.exe - skipped
      -- Detecting C compile features
      -- Detecting C compile features - done
      -- Detecting CXX compiler ABI info
      -- Detecting CXX compiler ABI info - done
      -- Check for working CXX compiler: C:/Program Files/Microsoft Visual Studio/2022/Community/VC/Tools/MSVC/14.41.34120/bin/Hostx64/x64/cl.exe - skipped
      -- Detecting CXX compile features
      -- Detecting CXX compile features - done
      -- Found Python3: C:\Users\Loibl\AppData\Local\Programs\Python\Python313\python.exe (found version "3.13.0") found components: Interpreter Development.Module
      -- Found Netgen: C:/Users/Loibl/AppData/Local/Temp/pip-build-env-h7a4fs81/overlay/Lib/site-packages/netgen/cmake
      -- Install dir: C:/Users/Loibl/AppData/Local/Temp/tmp6x6tg5d8/wheel/platlib
      -- NGSXFEM_VERSION: 2.1.2405
      -- Configuring done (10.5s)
      -- Generating done (0.5s)
      -- Build files have been written to: C:/Users/Loibl/AppData/Local/Temp/tmp6x6tg5d8/build
      *** Building project with Visual Studio 17 2022...
      MSBuild-Version 17.11.9+a69bbaaf5 für .NET Framework

      C:\Program Files\Microsoft Visual Studio\2022\Community\MSBuild\Microsoft\VC\v170\Microsoft.CppBuild.targets(541,5): warning MSB8029: Das Zwischenverzeichnis oder das Ausgabeverzeichnis darf nicht im temporären Verzeichnis enthalten sein, da dies zu Problemen mit dem inkrementellen Build führen kann. [C:\Users\Loibl\AppData\Local\Temp\tmp6x6tg5d8\build\ZERO_CHECK.vcxproj]
        1>Checking Build System
      C:\Program Files\Microsoft Visual Studio\2022\Community\MSBuild\Microsoft\VC\v170\Microsoft.CppBuild.targets(541,5): warning MSB8029: Das Zwischenverzeichnis oder das Ausgabeverzeichnis darf nicht im temporären Verzeichnis enthalten sein, da dies zu Problemen mit dem inkrementellen Build führen kann. [C:\Users\Loibl\AppData\Local\Temp\tmp6x6tg5d8\build\xfem.vcxproj]
        Building Custom Rule C:/Users/Loibl/AppData/Local/Temp/pip-install-_jlzxrst/xfem_98759f24600744b1a160b4025b187c90/CMakeLists.txt
        python_ngsxfem.cpp
        lsetintdomain.cpp
        fieldeval.cpp
        spacetimecutrule.cpp
        straightcutrule.cpp
        xdecompose.cpp
        mlsetintegration.cpp
        xintegration.cpp
        cutintegral.cpp
        calcpointshift.cpp
        lsetrefine.cpp
        projshift.cpp
        shiftedevaluate.cpp
        shiftintegrators.cpp
        diffopDt.cpp
        SpaceTimeFE.cpp
        SpaceTimeFESpace.cpp
      C:\Users\Loibl\AppData\Local\Temp\pip-build-env-h7a4fs81\overlay\Lib\site-packages\netgen\include\bdbequations.hpp(34,1): error C1001: Interner Compilerfehler. [C:\Users\Loibl\AppData\Local\Temp\tmp6x6tg5d8\build\xfem.vcxproj]
      C:\Users\Loibl\AppData\Local\Temp\pip-build-env-h7a4fs81\overlay\Lib\site-packages\netgen\include\bdbequations.hpp(34,1): error C1001: (Compilerdatei "D:\a\_work\1\s\src\vctools\Compiler\CxxFE\sl\p1\c\lambdas.cpp", Zeile 6578) [C:\Users\Loibl\AppData\Local\Temp\tmp6x6tg5d8\build\xfem.vcxproj]
      C:\Users\Loibl\AppData\Local\Temp\pip-build-env-h7a4fs81\overlay\Lib\site-packages\netgen\include\bdbequations.hpp(34,1): error C1001:  Um dieses Problem zu umgehen, vereinfachen oder ändern Sie das Programm im Umfeld der oben aufgeführten Positionen. [C:\Users\Loibl\AppData\Local\Temp\tmp6x6tg5d8\build\xfem.vcxproj]
      C:\Users\Loibl\AppData\Local\Temp\pip-build-env-h7a4fs81\overlay\Lib\site-packages\netgen\include\bdbequations.hpp(34,1): error C1001: Geben Sie nach Möglichkeit hier Reproduktionsschritte an: https://developercommunity.visualstudio.com  [C:\Users\Loibl\AppData\Local\Temp\tmp6x6tg5d8\build\xfem.vcxproj]
      C:\Users\Loibl\AppData\Local\Temp\pip-build-env-h7a4fs81\overlay\Lib\site-packages\netgen\include\bdbequations.hpp(34,1): error C1001: Wählen Sie im Menü "Hilfe" von Visual C++ den Befehl "Technischer Support", [C:\Users\Loibl\AppData\Local\Temp\tmp6x6tg5d8\build\xfem.vcxproj]
      C:\Users\Loibl\AppData\Local\Temp\pip-build-env-h7a4fs81\overlay\Lib\site-packages\netgen\include\bdbequations.hpp(34,1): error C1001:  oder öffnen Sie die Hilfedatei des technischen Supports, um weitere Informationen zu erhalten. [C:\Users\Loibl\AppData\Local\Temp\tmp6x6tg5d8\build\xfem.vcxproj]
        timecf.cpp
        (Quelldatei „../../pip-install-_jlzxrst/xfem_98759f24600744b1a160b4025b187c90/spacetime/SpaceTimeFESpace.cpp“ wird kompiliert)

        spacetime_vtk.cpp
        bitarraycf.cpp
        Code wird generiert...
        Kompilieren...
        ngsxstd.cpp
        p1interpol.cpp
        restrictedblf.cpp
        restrictedfespace.cpp
        xprolongation.cpp
        cutinfo.cpp
        ghostpenalty.cpp
        sFESpace.cpp
        symboliccutbfi.cpp
        symboliccutlfi.cpp
        xfemdiffops.cpp
        xFESpace.cpp
        xfiniteelement.cpp
        aggregates.cpp
        Code wird generiert...

      *** CMake build failed
      [end of output]

  note: This error originates from a subprocess, and is likely not a problem with pip.
  ERROR: Failed building wheel for xfem
Failed to build xfem

Dear Michael,

I have to admit that we don’t have Windows user in the xfem dev team so that we are not as experienced with the Windows cases.

First question: He seems to try to build xfem from sources in your case. We have binaries on PyPi. Do you see why the binaries are not used? Which version of python are you using? It seems that we are shipping the windows binaries only for one python version (3.11). I will have a look into that.

For the build wheel: I don’t understand what is going wrong here and “internal compiler error” seems to require some further debugging, but I would prefer rather not to dig into that a.t.m. :).

So, either we add the windows binaries that suit your python version or you try again with the older MSVSC compiler.

Best,
Christoph

The binaries on PyPi after the 2405-release are available for more python versions on Windows.
One thing that you could hence directly try is “pip install xfem==2.1.2406.dev3” (which also pulls a more recent ngsolve version; “ngsolve==6.2.2405.post22.dev1” is necessary and sufficent).

Best,
Christoph

Hi Christoph,
that was helpful. The installation works again without problems with the new version in combination with Python 3.13.
Thank you!