Weggler / ngbem

MIT License
5 stars 5 forks source link

ngbem building errors #7

Closed Horep closed 1 day ago

Horep commented 2 months ago

Hi, back again on a new machine, with a new installation problem. I repeated all the previous steps in my other post, including using x64 Native Tools. When attempting to run the installation sequence, I receive a CMake syntax error:

C:\Program Files\Microsoft Visual Studio\2022\Community>py -m pip install --no-build-isolation git+https://github.com/Weggler/ngbem.git
Defaulting to user installation because normal site-packages is not writeable
Collecting git+https://github.com/Weggler/ngbem.git
  Cloning https://github.com/Weggler/ngbem.git to c:\users\USER\appdata\local\temp\pip-req-build-vqkcfa32
  Running command git clone --filter=blob:none --quiet https://github.com/Weggler/ngbem.git 'C:\Users\USER\AppData\Local\Temp\pip-req-build-vqkcfa32'
  Resolved https://github.com/Weggler/ngbem.git to commit a8d387b1e8700d8718653e6516fa901b2edd0716
  Preparing metadata (pyproject.toml) ... done
Requirement already satisfied: ngsolve==6.2.2404.post16 in c:\users\USER\appdata\roaming\python\python312\site-packages (from ngbem==1.0.0) (6.2.2404.post16)
Requirement already satisfied: netgen-mesher==6.2.2404.post3.dev in c:\users\USER\appdata\roaming\python\python312\site-packages (from ngsolve==6.2.2404.post16->ngbem==1.0.0) (6.2.2404.post3.dev0)
Requirement already satisfied: mkl in c:\users\USER\appdata\roaming\python\python312\site-packages (from ngsolve==6.2.2404.post16->ngbem==1.0.0) (2024.2.0)
Requirement already satisfied: intel-openmp>=2023 in c:\users\USER\appdata\roaming\python\python312\site-packages (from mkl->ngsolve==6.2.2404.post16->ngbem==1.0.0) (2024.2.0)
Requirement already satisfied: tbb==2021.* in c:\users\USER\appdata\roaming\python\python312\site-packages (from mkl->ngsolve==6.2.2404.post16->ngbem==1.0.0) (2021.13.0)
Requirement already satisfied: intel-cmplr-lib-ur==2024.2.0 in c:\users\USER\appdata\roaming\python\python312\site-packages (from intel-openmp>=2023->mkl->ngsolve==6.2.2404.post16->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
  ╰─> [85 lines of output]
      *** scikit-build-core 0.9.8 using CMake 3.29.6 (wheel)
      *** Configuring CMake...
      2024-07-11 18:14:20,575 - 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\USER\AppData\Local\Temp\tmpsq9zbi1p\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.33812.0
      -- The CXX compiler identification is MSVC 19.40.33812.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.40.33807/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.40.33807/bin/Hostx64/x64/cl.exe - skipped
      -- Detecting CXX compile features
      -- Detecting CXX compile features - done
      -- Found Python3: C:\Program Files\Python312\python.exe (found version "3.12.4") found components: Interpreter Development.Module
      -- Found Netgen: C:/Users/USER/AppData/Roaming/Python/Python312/site-packages/netgen/cmake
      -- Install dir: C:/Users/USER/AppData/Local/Temp/tmpsq9zbi1p/wheel/platlib
      -- Configuring done (6.2s)
      -- Generating done (0.1s)
      -- Build files have been written to: C:/Users/USER/AppData/Local/Temp/tmpsq9zbi1p/build
      *** Building project with Visual Studio 17 2022...
      MSBuild version 17.10.4+10fbfbf2e for .NET Framework

      C:\Program Files\Microsoft Visual Studio\2022\Community\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\USER\AppData\Local\Temp\tmpsq9zbi1p\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: The Intermediate directory or Output directory cannot reside under the Temporary directory as it could lead to issues with incremental build. [C:\Users\USER\AppData\Local\Temp\tmpsq9zbi1p\build\_ngbem.vcxproj]
        Building Custom Rule C:/Users/USER/AppData/Local/Temp/pip-req-build-vqkcfa32/CMakeLists.txt
        ngbem.cpp
        python_bem.cpp
        hmat.cpp
        intrules.cpp
        test_compression.cpp
        Generating Code...
           Creating library C:/Users/USER/AppData/Local/Temp/tmpsq9zbi1p/build/Release/_ngbem.lib and object C:/Users/USER/AppData/Local/Temp/tmpsq9zbi1p/build/Release/_ngbem.exp
        _ngbem.vcxproj -> C:\Users\USER\AppData\Local\Temp\tmpsq9zbi1p\build\Release\_ngbem.pyd
      C:\Program Files\Microsoft Visual Studio\2022\Community\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\USER\AppData\Local\Temp\tmpsq9zbi1p\build\ALL_BUILD.vcxproj]
        Building Custom Rule C:/Users/USER/AppData/Local/Temp/pip-req-build-vqkcfa32/CMakeLists.txt
      *** Installing project into wheel...
      -- Installing: C:/Users/USER/AppData/Local/Temp/tmpsq9zbi1p/wheel/platlib/ngbem/_ngbem.lib
      -- Installing: C:/Users/USER/AppData/Local/Temp/tmpsq9zbi1p/wheel/platlib/ngbem/_ngbem.pyd
      -- Installing: C:/Users/USER/AppData/Local/Temp/tmpsq9zbi1p/wheel/platlib/ngbem/__init__.py
      CMake Warning (dev) at C:/Users/USER/AppData/Local/Temp/tmpsq9zbi1p/build/cmake_install.cmake:148 (execute_process):
        Syntax error in cmake code at

          C:/Users/USER/AppData/Local/Temp/tmpsq9zbi1p/build/cmake_install.cmake:148

        when parsing string

          C:\Program

        Invalid escape sequence \P

        Policy CMP0010 is not set: Bad variable reference syntax is an error.  Run
        "cmake --help-policy CMP0010" for policy details.  Use the cmake_policy
        command to set the policy and suppress this warning.
      This warning is for project developers.  Use -Wno-dev to suppress it.

      CMake Warning (dev) at C:/Users/USER/AppData/Local/Temp/tmpsq9zbi1p/build/cmake_install.cmake:148 (execute_process):
        Syntax error in cmake code at

          C:/Users/USER/AppData/Local/Temp/tmpsq9zbi1p/build/cmake_install.cmake:148

        when parsing string

          Files\Python312\python.exe

        Invalid escape sequence \P

        Policy CMP0010 is not set: Bad variable reference syntax is an error.  Run
        "cmake --help-policy CMP0010" for policy details.  Use the cmake_policy
        command to set the policy and suppress this warning.
      This warning is for project developers.  Use -Wno-dev to suppress it.

      CMake Error at C:/Users/USER/AppData/Local/Temp/tmpsq9zbi1p/build/cmake_install.cmake:160 (file):
        file INSTALL cannot find
        "C:/Users/USER/AppData/Local/Temp/tmpsq9zbi1p/build/stubs/ngbem": File
        exists.

      *** CMake install 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: ERROR: Failed to build installable wheels for some pyproject.toml based projects (ngbem)

The problem appears to be in how Windows writes the path, as seen in this post. They link a solution using file(TO_CMAKE_PATH "<path>" <variable>), but I am unsure how to actually use this since I am using pip.

Horep commented 3 days ago

Hi,

When I try the alternative route, on the github.io site, the following occurs. The first part is just me moving from the visual studio area into my own user area. Again, I'm not sure what to do to have ngbem properly install. As far as I can tell, it should function. I clearly have a C compiler, it recognises the python installation, it can find netgen, so I am quite confused.


** Visual Studio 2022 Developer Command Prompt v17.10.4
** Copyright (c) 2022 Microsoft Corporation
**********************************************************************
[vcvarsall.bat] Environment initialized for: 'x64'

C:\Program Files\Microsoft Visual Studio\2022\Community>cd..

C:\Program Files\Microsoft Visual Studio\2022>cd..

C:\Program Files\Microsoft Visual Studio>cd..

C:\Program Files>cd..

C:\>cd users

C:\Users>cd gpb22197

C:\Users\gpb22197>cd python
The system cannot find the path specified.

C:\Users\gpb22197>cd ngbemstuff
The system cannot find the path specified.

C:\Users\gpb22197>cd ngbemstuff

C:\Users\gpb22197\ngbemstuff>git clone https://github.com/Weggler/ngbem.git
Cloning into 'ngbem'...
remote: Enumerating objects: 2871, done.
remote: Counting objects: 100% (806/806), done.
remote: Compressing objects: 100% (287/287), done.
remote: Total 2871 (delta 491), reused 745 (delta 458), pack-reused 2065 (from 1)
Receiving objects: 100% (2871/2871), 40.38 MiB | 27.06 MiB/s, done.
Resolving deltas: 100% (1657/1657), done.

C:\Users\gpb22197\ngbemstuff>cd ngbem

C:\Users\gpb22197\ngbemstuff\ngbem>mkdir build

C:\Users\gpb22197\ngbemstuff\ngbem>cd build

C:\Users\gpb22197\ngbemstuff\ngbem\build>cmake ..
-- 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.33812.0
-- The CXX compiler identification is MSVC 19.40.33812.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.40.33807/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.40.33807/bin/Hostx64/x64/cl.exe - skipped
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- Found Python3: C:/Program Files/Python312/python.exe (found version "3.12.5") found components: Interpreter Development.Module
-- Found Netgen: C:/Users/gpb22197/AppData/Roaming/Python/Python312/site-packages/netgen/cmake
-- Install dir: C:/Users/gpb22197/AppData/Roaming/Python/Python312/site-packages
-- Configuring done (6.1s)
-- Generating done (0.0s)
-- Build files have been written to: C:/Users/gpb22197/ngbemstuff/ngbem/build

C:\Users\gpb22197\ngbemstuff\ngbem\build>make -j4 install
make: *** No rule to make target 'install'.  Stop.

C:\Users\gpb22197\ngbemstuff\ngbem\build>```
mhochsteger commented 3 days ago

Try

cmake --build . --config RelWithDebInfo --target install

instead of make -j 4 install (this only works with gnu make installed, like on Linux and MacOS).

Horep commented 3 days ago

This attempt also failed, but it at least ran a bit more this time. I don't see the stubs folder it references during C:/Users/gpb22197/ngbemstuff/ngbem/build/stubs/ngbem in my build folder buildfolder

Note that I do not have admin access on this machine, in case that is important.


** Visual Studio 2022 Developer Command Prompt v17.10.4
** Copyright (c) 2022 Microsoft Corporation
**********************************************************************
[vcvarsall.bat] Environment initialized for: 'x64'

C:\Program Files\Microsoft Visual Studio\2022\Community>cd ..

C:\Program Files\Microsoft Visual Studio\2022>cd ..

C:\Program Files\Microsoft Visual Studio>cd ..

C:\Program Files>cd .

C:\Program Files>cd ..

C:\>cd users

C:\Users>cd gpb22197

C:\Users\gpb22197>cd ngbemstuff

C:\Users\gpb22197\ngbemstuff>git clone https://github.com/Weggler/ngbem.git
Cloning into 'ngbem'...
remote: Enumerating objects: 2871, done.
remote: Counting objects: 100% (806/806), done.
remote: Compressing objects: 100% (287/287), done.
remote: Total 2871 (delta 491), reused 745 (delta 458), pack-reused 2065 (from 1)
Receiving objects: 100% (2871/2871), 40.38 MiB | 23.16 MiB/s, done.

Resolving deltas: 100% (1657/1657), done.

C:\Users\gpb22197\ngbemstuff>cd ngbem

C:\Users\gpb22197\ngbemstuff\ngbem>mkdir build

C:\Users\gpb22197\ngbemstuff\ngbem>cd build

C:\Users\gpb22197\ngbemstuff\ngbem\build>cmake ..
-- 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.33812.0
-- The CXX compiler identification is MSVC 19.40.33812.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.40.33807/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.40.33807/bin/Hostx64/x64/cl.exe - skipped
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- Found Python3: C:/Program Files/Python312/python.exe (found version "3.12.5") found components: Interpreter Development.Module
-- Found Netgen: C:/Users/gpb22197/AppData/Roaming/Python/Python312/site-packages/netgen/cmake
-- Install dir: C:/Users/gpb22197/AppData/Roaming/Python/Python312/site-packages
-- Configuring done (7.1s)
-- Generating done (0.1s)
-- Build files have been written to: C:/Users/gpb22197/ngbemstuff/ngbem/build

C:\Users\gpb22197\ngbemstuff\ngbem\build>cmake --build . --config RelWithDebInfo --target install
MSBuild version 17.10.4+10fbfbf2e for .NET Framework

  1>Checking Build System
  Building Custom Rule C:/Users/gpb22197/ngbemstuff/ngbem/CMakeLists.txt
  ngbem.cpp
  python_bem.cpp
  hmat.cpp
  intrules.cpp
  test_compression.cpp
  Generating Code...
     Creating library C:/Users/gpb22197/ngbemstuff/ngbem/build/RelWithDebInfo/_ngbem.lib and object C
  :/Users/gpb22197/ngbemstuff/ngbem/build/RelWithDebInfo/_ngbem.exp
  _ngbem.vcxproj -> C:\Users\gpb22197\ngbemstuff\ngbem\build\RelWithDebInfo\_ngbem.pyd
  Building Custom Rule C:/Users/gpb22197/ngbemstuff/ngbem/CMakeLists.txt
  1>
  -- Install configuration: "RelWithDebInfo"
  -- Installing: C:/Users/gpb22197/AppData/Roaming/Python/Python312/site-packages/Lib/site-packages/n
  gbem/_ngbem.lib
  -- Installing: C:/Users/gpb22197/AppData/Roaming/Python/Python312/site-packages/Lib/site-packages/n
  gbem/_ngbem.pyd
  -- Installing: C:/Users/gpb22197/AppData/Roaming/Python/Python312/site-packages/Lib/site-packages/n
  gbem/__init__.py
  CMake Warning (dev) at cmake_install.cmake:80 (file):
    Syntax error in cmake code at

      C:/Users/gpb22197/ngbemstuff/ngbem/build/cmake_install.cmake:80

    when parsing string

      ${CMAKE_INSTALL_PREFIX}/Lib\site-packages/ngbem

    Invalid escape sequence \s

    Policy CMP0010 is not set: Bad variable reference syntax is an error.  Run
    "cmake --help-policy CMP0010" for policy details.  Use the cmake_policy
    command to set the policy and suppress this warning.
  This warning is for project developers.  Use -Wno-dev to suppress it.

  CMake Error at cmake_install.cmake:80 (file):
    file INSTALL cannot find
    "C:/Users/gpb22197/ngbemstuff/ngbem/build/stubs/ngbem": File exists.

C:\Program Files\Microsoft Visual Studio\2022\Community\MSBuild\Microsoft\VC\v170\Microsoft.CppCommon
.targets(166,5): error MSB3073: The command "setlocal [C:\Users\gpb22197\ngbemstuff\ngbem\build\insta
ll.vcxproj]
C:\Program Files\Microsoft Visual Studio\2022\Community\MSBuild\Microsoft\VC\v170\Microsoft.CppCommon
.targets(166,5): error MSB3073: C:\Users\gpb22197\AppData\Roaming\Python\Python37\site-packages\cmake
\data\bin\cmake.exe -DBUILD_TYPE=RelWithDebInfo -P cmake_install.cmake [C:\Users\gpb22197\ngbemstuff\
ngbem\build\install.vcxproj]
C:\Program Files\Microsoft Visual Studio\2022\Community\MSBuild\Microsoft\VC\v170\Microsoft.CppCommon
.targets(166,5): error MSB3073: if %errorlevel% neq 0 goto :cmEnd [C:\Users\gpb22197\ngbemstuff\ngbem
\build\install.vcxproj]
C:\Program Files\Microsoft Visual Studio\2022\Community\MSBuild\Microsoft\VC\v170\Microsoft.CppCommon
.targets(166,5): error MSB3073: :cmEnd [C:\Users\gpb22197\ngbemstuff\ngbem\build\install.vcxproj]
C:\Program Files\Microsoft Visual Studio\2022\Community\MSBuild\Microsoft\VC\v170\Microsoft.CppCommon
.targets(166,5): error MSB3073: endlocal & call :cmErrorLevel %errorlevel% & goto :cmDone [C:\Users\g
pb22197\ngbemstuff\ngbem\build\install.vcxproj]
C:\Program Files\Microsoft Visual Studio\2022\Community\MSBuild\Microsoft\VC\v170\Microsoft.CppCommon
.targets(166,5): error MSB3073: :cmErrorLevel [C:\Users\gpb22197\ngbemstuff\ngbem\build\install.vcxpr
oj]
C:\Program Files\Microsoft Visual Studio\2022\Community\MSBuild\Microsoft\VC\v170\Microsoft.CppCommon
.targets(166,5): error MSB3073: exit /b %1 [C:\Users\gpb22197\ngbemstuff\ngbem\build\install.vcxproj]
C:\Program Files\Microsoft Visual Studio\2022\Community\MSBuild\Microsoft\VC\v170\Microsoft.CppCommon
.targets(166,5): error MSB3073: :cmDone [C:\Users\gpb22197\ngbemstuff\ngbem\build\install.vcxproj]
C:\Program Files\Microsoft Visual Studio\2022\Community\MSBuild\Microsoft\VC\v170\Microsoft.CppCommon
.targets(166,5): error MSB3073: if %errorlevel% neq 0 goto :VCEnd [C:\Users\gpb22197\ngbemstuff\ngbem
\build\install.vcxproj]
C:\Program Files\Microsoft Visual Studio\2022\Community\MSBuild\Microsoft\VC\v170\Microsoft.CppCommon
.targets(166,5): error MSB3073: :VCEnd" exited with code 1. [C:\Users\gpb22197\ngbemstuff\ngbem\build
\install.vcxproj]

C:\Users\gpb22197\ngbemstuff\ngbem\build>```
Horep commented 1 day ago

I have instead opted to use WSL to build ngbem, using WSL with Ubuntu. This seems to have worked without any trouble at all, so may be the way forward.