Weggler / ngbem

MIT License
5 stars 5 forks source link

Installation of NGBem, CMAKE build failure. #5

Closed Horep closed 2 months ago

Horep commented 2 months ago

Hi, I'm attempting to install NGBem. I am using a fresh installation of Python (3.12.4), with the latest version of ngsolve (6.2.2404) from pip. I recently downloaded the Build Tools for Visual Studio 2022 as it was needed for using nmake. When I attempt to run the quick installation pip commands given on the README.md, I receive the following CMAKE errors (see the attached file or below, it is long) installattempt.txt, and I am unsure how to read the error, let alone fix it. Most of it simply reports that the requirements are already met, so it doesn't need to download anything. I have checked that ngsolve/netgen functions otherwise as expected.

**********************************************************************
** Visual Studio 2022 Developer PowerShell v17.10.3
** Copyright (c) 2022 Microsoft Corporation
**********************************************************************
PS C:\Program Files (x86)\Microsoft Visual Studio\2022\BuildTools> pip3 install --pre ngsolve
Requirement already satisfied: ngsolve in c:\users\horep\appdata\local\programs\python\python312\lib\site-packages (6.2.2404.post51)
Requirement already satisfied: netgen-mesher==6.2.2404.post16 in c:\users\horep\appdata\local\programs\python\python312\lib\site-packages (from ngsolve) (6.2.2404.post16)
Requirement already satisfied: mkl in c:\users\horep\appdata\local\programs\python\python312\lib\site-packages (from ngsolve) (2024.2.0)
Requirement already satisfied: netgen-occt==7.8.1 in c:\users\horep\appdata\local\programs\python\python312\lib\site-packages (from netgen-mesher==6.2.2404.post16->ngsolve) (7.8.1)
Requirement already satisfied: intel-openmp>=2023 in c:\users\horep\appdata\local\programs\python\python312\lib\site-packages (from mkl->ngsolve) (2024.2.0)
Requirement already satisfied: tbb==2021.* in c:\users\horep\appdata\local\programs\python\python312\lib\site-packages (from mkl->ngsolve) (2021.13.0)
Requirement already satisfied: intel-cmplr-lib-ur==2024.2.0 in c:\users\horep\appdata\local\programs\python\python312\lib\site-packages (from intel-openmp>=2023->mkl->ngsolve) (2024.2.0)

[notice] A new release of pip is available: 24.0 -> 24.1.1
[notice] To update, run: python.exe -m pip install --upgrade pip
PS C:\Program Files (x86)\Microsoft Visual Studio\2022\BuildTools> pip3 install cmake scikit-build-core pybind11_stubgen numpy webgui_jupyter_widgets
Requirement already satisfied: cmake in c:\users\horep\appdata\local\programs\python\python312\lib\site-packages (3.30.0)
Requirement already satisfied: scikit-build-core in c:\users\horep\appdata\local\programs\python\python312\lib\site-packages (0.9.8)
Requirement already satisfied: pybind11_stubgen in c:\users\horep\appdata\local\programs\python\python312\lib\site-packages (2.5.1)
Requirement already satisfied: numpy in c:\users\horep\appdata\local\programs\python\python312\lib\site-packages (2.0.0)
Requirement already satisfied: webgui_jupyter_widgets in c:\users\horep\appdata\local\programs\python\python312\lib\site-packages (0.2.35)
Requirement already satisfied: packaging>=21.3 in c:\users\horep\appdata\local\programs\python\python312\lib\site-packages (from scikit-build-core) (24.1)
Requirement already satisfied: pathspec>=0.10.1 in c:\users\horep\appdata\local\programs\python\python312\lib\site-packages (from scikit-build-core) (0.12.1)
Requirement already satisfied: ipywidgets>=7.0.0 in c:\users\horep\appdata\local\programs\python\python312\lib\site-packages (from webgui_jupyter_widgets) (8.1.3)
Requirement already satisfied: comm>=0.1.3 in c:\users\horep\appdata\local\programs\python\python312\lib\site-packages (from ipywidgets>=7.0.0->webgui_jupyter_widgets) (0.2.2)
Requirement already satisfied: ipython>=6.1.0 in c:\users\horep\appdata\local\programs\python\python312\lib\site-packages (from ipywidgets>=7.0.0->webgui_jupyter_widgets) (8.26.0)
Requirement already satisfied: traitlets>=4.3.1 in c:\users\horep\appdata\local\programs\python\python312\lib\site-packages (from ipywidgets>=7.0.0->webgui_jupyter_widgets) (5.14.3)
Requirement already satisfied: widgetsnbextension~=4.0.11 in c:\users\horep\appdata\local\programs\python\python312\lib\site-packages (from ipywidgets>=7.0.0->webgui_jupyter_widgets) (4.0.11)
Requirement already satisfied: jupyterlab-widgets~=3.0.11 in c:\users\horep\appdata\local\programs\python\python312\lib\site-packages (from ipywidgets>=7.0.0->webgui_jupyter_widgets) (3.0.11)
Requirement already satisfied: decorator in c:\users\horep\appdata\local\programs\python\python312\lib\site-packages (from ipython>=6.1.0->ipywidgets>=7.0.0->webgui_jupyter_widgets) (5.1.1)
Requirement already satisfied: jedi>=0.16 in c:\users\horep\appdata\local\programs\python\python312\lib\site-packages (from ipython>=6.1.0->ipywidgets>=7.0.0->webgui_jupyter_widgets) (0.19.1)
Requirement already satisfied: matplotlib-inline in c:\users\horep\appdata\local\programs\python\python312\lib\site-packages (from ipython>=6.1.0->ipywidgets>=7.0.0->webgui_jupyter_widgets) (0.1.7)
Requirement already satisfied: prompt-toolkit<3.1.0,>=3.0.41 in c:\users\horep\appdata\local\programs\python\python312\lib\site-packages (from ipython>=6.1.0->ipywidgets>=7.0.0->webgui_jupyter_widgets) (3.0.47)
Requirement already satisfied: pygments>=2.4.0 in c:\users\horep\appdata\local\programs\python\python312\lib\site-packages (from ipython>=6.1.0->ipywidgets>=7.0.0->webgui_jupyter_widgets) (2.18.0)
Requirement already satisfied: stack-data in c:\users\horep\appdata\local\programs\python\python312\lib\site-packages (from ipython>=6.1.0->ipywidgets>=7.0.0->webgui_jupyter_widgets) (0.6.3)
Requirement already satisfied: colorama in c:\users\horep\appdata\local\programs\python\python312\lib\site-packages (from ipython>=6.1.0->ipywidgets>=7.0.0->webgui_jupyter_widgets) (0.4.6)
Requirement already satisfied: parso<0.9.0,>=0.8.3 in c:\users\horep\appdata\local\programs\python\python312\lib\site-packages (from jedi>=0.16->ipython>=6.1.0->ipywidgets>=7.0.0->webgui_jupyter_widgets) (0.8.4)
Requirement already satisfied: wcwidth in c:\users\horep\appdata\local\programs\python\python312\lib\site-packages (from prompt-toolkit<3.1.0,>=3.0.41->ipython>=6.1.0->ipywidgets>=7.0.0->webgui_jupyter_widgets) (0.2.13)
Requirement already satisfied: executing>=1.2.0 in c:\users\horep\appdata\local\programs\python\python312\lib\site-packages (from stack-data->ipython>=6.1.0->ipywidgets>=7.0.0->webgui_jupyter_widgets) (2.0.1)
Requirement already satisfied: asttokens>=2.1.0 in c:\users\horep\appdata\local\programs\python\python312\lib\site-packages (from stack-data->ipython>=6.1.0->ipywidgets>=7.0.0->webgui_jupyter_widgets) (2.4.1)
Requirement already satisfied: pure-eval in c:\users\horep\appdata\local\programs\python\python312\lib\site-packages (from stack-data->ipython>=6.1.0->ipywidgets>=7.0.0->webgui_jupyter_widgets) (0.2.2)
Requirement already satisfied: six>=1.12.0 in c:\users\horep\appdata\local\programs\python\python312\lib\site-packages (from asttokens>=2.1.0->stack-data->ipython>=6.1.0->ipywidgets>=7.0.0->webgui_jupyter_widgets) (1.16.0)

[notice] A new release of pip is available: 24.0 -> 24.1.1
[notice] To update, run: python.exe -m pip install --upgrade pip
PS C:\Program Files (x86)\Microsoft Visual Studio\2022\BuildTools> python3 -m pip install --no-build-isolation git+https://github.com/Weggler/ngbem.git
Python was not found; run without arguments to install from the Microsoft Store, or disable this shortcut from Settings > Manage App Execution Aliases.
PS C:\Program Files (x86)\Microsoft Visual Studio\2022\BuildTools> py -m pip install --no-build-isolation git+https://github.com/Weggler/ngbem.git
Collecting git+https://github.com/Weggler/ngbem.git
  Cloning https://github.com/Weggler/ngbem.git to c:\users\horep\appdata\local\temp\pip-req-build-j3mvnxav
  Running command git clone --filter=blob:none --quiet https://github.com/Weggler/ngbem.git 'C:\Users\Horep\AppData\Local\Temp\pip-req-build-j3mvnxav'
  Resolved https://github.com/Weggler/ngbem.git to commit a8d387b1e8700d8718653e6516fa901b2edd0716
  Preparing metadata (pyproject.toml) ... done
Requirement already satisfied: ngsolve==6.2.2404.post51 in c:\users\horep\appdata\local\programs\python\python312\lib\site-packages (from ngbem==1.0.0) (6.2.2404.post51)
Requirement already satisfied: netgen-mesher==6.2.2404.post16 in c:\users\horep\appdata\local\programs\python\python312\lib\site-packages (from ngsolve==6.2.2404.post51->ngbem==1.0.0) (6.2.2404.post16)
Requirement already satisfied: mkl in c:\users\horep\appdata\local\programs\python\python312\lib\site-packages (from ngsolve==6.2.2404.post51->ngbem==1.0.0) (2024.2.0)
Requirement already satisfied: netgen-occt==7.8.1 in c:\users\horep\appdata\local\programs\python\python312\lib\site-packages (from netgen-mesher==6.2.2404.post16->ngsolve==6.2.2404.post51->ngbem==1.0.0) (7.8.1)
Requirement already satisfied: intel-openmp>=2023 in c:\users\horep\appdata\local\programs\python\python312\lib\site-packages (from mkl->ngsolve==6.2.2404.post51->ngbem==1.0.0) (2024.2.0)
Requirement already satisfied: tbb==2021.* in c:\users\horep\appdata\local\programs\python\python312\lib\site-packages (from mkl->ngsolve==6.2.2404.post51->ngbem==1.0.0) (2021.13.0)
Requirement already satisfied: intel-cmplr-lib-ur==2024.2.0 in c:\users\horep\appdata\local\programs\python\python312\lib\site-packages (from intel-openmp>=2023->mkl->ngsolve==6.2.2404.post51->ngbem==1.0.0) (2024.2.0)
Building wheels for collected packages: ngbem
  Building wheel for ngbem (pyproject.toml) ... error
  error: subprocess-exited-with-error

  × Building wheel for ngbem (pyproject.toml) did not run successfully.
  │ exit code: 1
  ╰─> [44 lines of output]
      *** scikit-build-core 0.9.8 using CMake 3.30.0 (wheel)
      *** Configuring CMake...
      2024-07-04 18:22:01,717 - scikit_build_core - WARNING - Can't find a Python library, got libdir=None, ldlibrary=None, multiarch=None, masd=None
      loading initial cache file C:\Users\Horep\AppData\Local\Temp\tmpley3zqcp\build\CMakeInit.txt
      -- Building for: Visual Studio 17 2022
      -- Selecting Windows SDK version 10.0.22621.0 to target Windows 10.0.19045.
      -- The C compiler identification is MSVC 19.40.33811.0
      -- The CXX compiler identification is MSVC 19.40.33811.0
      -- Detecting C compiler ABI info
      -- Detecting C compiler ABI info - done
      -- Check for working C compiler: C:/Program Files (x86)/Microsoft Visual Studio/2022/BuildTools/VC/Tools/MSVC/14.40.33807/bin/Hostx64/x86/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 (x86)/Microsoft Visual Studio/2022/BuildTools/VC/Tools/MSVC/14.40.33807/bin/Hostx64/x86/cl.exe - skipped
      -- Detecting CXX compile features
      -- Detecting CXX compile features - done
      -- Found Python3: C:\Users\Horep\AppData\Local\Programs\Python\Python312\python.exe (found version "3.12.4") found components: Interpreter Development.Module
      -- Found Netgen: C:/Users/Horep/AppData/Local/Programs/Python/Python312/Lib/site-packages/netgen/cmake
      -- Install dir: C:/Users/Horep/AppData/Local/Temp/tmpley3zqcp/wheel/platlib
      -- Configuring done (10.7s)
      -- Generating done (0.1s)
      -- Build files have been written to: C:/Users/Horep/AppData/Local/Temp/tmpley3zqcp/build
      *** Building project with Visual Studio 17 2022...
      MSBuild version 17.10.4+10fbfbf2e for .NET Framework

      C:\Program Files (x86)\Microsoft Visual Studio\2022\BuildTools\MSBuild\Microsoft\VC\v170\Microsoft.CppBuild.targets(541,5): warning MSB8029: The Intermediate directory or Output directory cannot reside under the Temporary directory as it could lead to issues with incremental build. [C:\Users\Horep\AppData\Local\Temp\tmpley3zqcp\build\ZERO_CHECK.vcxproj]
        1>Checking Build System
      C:\Program Files (x86)\Microsoft Visual Studio\2022\BuildTools\MSBuild\Microsoft\VC\v170\Microsoft.CppBuild.targets(541,5): warning MSB8029: The Intermediate directory or Output directory cannot reside under the Temporary directory as it could lead to issues with incremental build. [C:\Users\Horep\AppData\Local\Temp\tmpley3zqcp\build\_ngbem.vcxproj]
        Building Custom Rule C:/Users/Horep/AppData/Local/Temp/pip-req-build-j3mvnxav/CMakeLists.txt
        ngbem.cpp
        python_bem.cpp
      C:\Users\Horep\AppData\Local\Programs\Python\Python312\Lib\site-packages\netgen\include\core\utils.hpp(78,1): error C1021: invalid preprocessor command 'warning' [C:\Users\Horep\AppData\Local\Temp\tmpley3zqcp\build\_ngbem.vcxproj]
      C:\Users\Horep\AppData\Local\Programs\Python\Python312\Lib\site-packages\netgen\include\core\utils.hpp(78,1): error C1021: invalid preprocessor command 'warning' [C:\Users\Horep\AppData\Local\Temp\tmpley3zqcp\build\_ngbem.vcxproj]
        hmat.cpp
      C:\Users\Horep\AppData\Local\Programs\Python\Python312\Lib\site-packages\netgen\include\core\utils.hpp(78,1): error C1021: invalid preprocessor command 'warning' [C:\Users\Horep\AppData\Local\Temp\tmpley3zqcp\build\_ngbem.vcxproj]
        intrules.cpp
      C:\Users\Horep\AppData\Local\Programs\Python\Python312\Lib\site-packages\netgen\include\core\utils.hpp(78,1): error C1021: invalid preprocessor command 'warning' [C:\Users\Horep\AppData\Local\Temp\tmpley3zqcp\build\_ngbem.vcxproj]
        test_compression.cpp
      C:\Users\Horep\AppData\Local\Programs\Python\Python312\Lib\site-packages\netgen\include\core\utils.hpp(78,1): error C1021: invalid preprocessor command 'warning' [C:\Users\Horep\AppData\Local\Temp\tmpley3zqcp\build\_ngbem.vcxproj]
        Generating Code...

      *** 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 ngbem
Failed to build ngbem
ERROR: Could not build wheels for ngbem, which is required to install pyproject.toml-based projects

[notice] A new release of pip is available: 24.0 -> 24.1.1
[notice] To update, run: python.exe -m pip install --upgrade pip

For completeness, here is the version of python, along with the list of installed packages.

PS C:\Program Files (x86)\Microsoft Visual Studio\2022\BuildTools> py -0
 -V:3.12 *        Python 3.12 (64-bit)
PS C:\Program Files (x86)\Microsoft Visual Studio\2022\BuildTools> pip list
Package                Version
---------------------- ---------------
asttokens              2.4.1
cmake                  3.30.0
colorama               0.4.6
comm                   0.2.2
contourpy              1.2.1
cycler                 0.12.1
debugpy                1.8.2
decorator              5.1.1
executing              2.0.1
fonttools              4.53.0
intel-cmplr-lib-ur     2024.2.0
intel-openmp           2024.2.0
ipaddress              1.0.23
ipykernel              6.29.5
ipython                8.26.0
ipywidgets             8.1.3
jedi                   0.19.1
Jinja2                 3.1.4
jupyter_client         8.6.2
jupyter_core           5.7.2
jupyterlab_widgets     3.0.11
kiwisolver             1.4.5
MarkupSafe             2.1.5
matplotlib             3.9.1
matplotlib-inline      0.1.7
mkl                    2024.2.0
nest-asyncio           1.6.0
netgen-mesher          6.2.2404.post16
netgen_occt            7.8.1
ngsolve                6.2.2404.post51
numpy                  2.0.0
packaging              24.1
parso                  0.8.4
pathspec               0.12.1
pillow                 10.4.0
pip                    24.0
platformdirs           4.2.2
prompt_toolkit         3.0.47
psutil                 6.0.0
pure-eval              0.2.2
pybind11-stubgen       2.5.1
Pygments               2.18.0
pyparsing              3.1.2
python-dateutil        2.9.0.post0
pywin32                306
PyYAML                 6.0.1
pyzmq                  26.0.3
scikit_build_core      0.9.8
scipy                  1.14.0
setuptools             70.2.0
six                    1.16.0
stack-data             0.6.3
tbb                    2021.13.0
tornado                6.4.1
traitlets              5.14.3
voluptuous             0.15.2
wcwidth                0.2.13
webgui_jupyter_widgets 0.2.35
widgetsnbextension     4.0.11
mhochsteger commented 2 months ago

Hi!

I think you are running the 32bit compiler development shell. Try to build the code by running the instructions in the Dev shell called x64 / native (I don't know the full name).

Best, Matthias

Horep commented 2 months ago

Hi Matthias!

That worked! Clarifying for future users, in my case (relevant stack exchange post):

  1. Open windows search bar
  2. Type "x64"
  3. I see "x64 Native Tools Command Prompt for VS 2022" and open that.
  4. Input the quick install code, specifically the one for installing NGBem.

I then receive a message saying ngbem has successfully installed, and when loading into the python shell I can perform import ngbem perfectly fine.

Thank you so much!