Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Not able to install the library on windows 11 #133

Open
guckuck opened this issue Oct 24, 2024 · 4 comments
Open

Not able to install the library on windows 11 #133

guckuck opened this issue Oct 24, 2024 · 4 comments

Comments

@guckuck
Copy link

guckuck commented Oct 24, 2024

I tried to install the library as described:
pip install "intel-npu-acceleration-library @ git+https://github.com/intel/intel-npu-acceleration-library.git"

I get the following output from pip/compiler:
output.txt

I installed MSYS2 as descriped here: https://code.visualstudio.com/docs/cpp/config-mingw#_installing-the-mingww64-toolchain

I also installed the Visual Studio Build Tools (version 2022 not version 2019). I didn't found the old version.

Best regards
Kay

@alessandropalla
Copy link
Contributor

It looks like you are getting some issues during compilation. From the error trace, it appears there’s an issue with the Visual Studio C++ compiler configuration.

The main cause seems to be that cl.exe can't compile a simple test program. A few things to try:

Verify Visual Studio Build Tools: Ensure that the C++ build tools are installed for Visual Studio 2022, and confirm that you’re using the correct MSVC version. Check that all dependencies for C++ compilation are properly configured in the environment.

Permissions on Temp Directories: Some of the file tracking errors are coming from the temporary directory paths (C:\Users\kaypa\AppData\Local\Temp). Sometimes build tools struggle with write permissions in the temp folders. Try clearing the temp folder or redirecting the build process to a non-temp directory with full write access.

CMake and Python Environment: Make sure you’re using a compatible CMake version (>=3.15) and a compatible Python environment. Running cmake --version and python --version will confirm.

Let me know if any of these steps help or if you need further assistance debugging this!

@guckuck
Copy link
Author

guckuck commented Oct 26, 2024

Thanks for your answer. Sorry, it is long ago that I developed with C++. And it is not long ago that I switched from MacOS to Windows.

The first time I installed everything for "Build desktop with c++" or simular (german: "Desktopentwicklung mit C++"). Same problem.
Then I installed only two components:
winget install Microsoft.VisualStudio.2022.BuildTools --force --override "--wait --passive --add Microsoft.VisualStudio.Component.VC.Tools.x86.x64 --add Microsoft.VisualStudio.Component.Windows11SDK.22621"

Now I installed C++/CLI-Unterstützung für v143-Buildtools (v14.41-17.11). Same problem.

I use the PowerShell. A simple "helloworld"-app compiles perfect.

I added C:\msys64\ucrt64\bin to path. Do I have to use a Microsoft Compiler?

cmake version is 3.30.5

I also found this: https://stackoverflow.com/questions/53633705/cmake-the-c-compiler-is-not-able-to-compile-a-simple-test-program?newreg=12fa3861577d4e24815af309d66f03b1

There are several hints but I'm not sure what can I do. How to shorten the path?

Thanks again for your help.

@guckuck
Copy link
Author

guckuck commented Nov 5, 2024

So, I now fix the problem. I had to add the following line in the file C:\Users\kaypa\anaconda3\envs\pytorch_intel\Lib\site-packages\cmake\data\share\cmake-3.30\Modules\CMakeTestCCompiler.cmake as described at stackoverflow: set(CMAKE_TRY_COMPILE_TARGET_TYPE STATIC_LIBRARY)

Now, everything is installed but I'am not able to run the examples. See here:
#108

@firejake308
Copy link

I ran into the same problem and figued out a solution, so I wanted to document it for the benefit of others Googling the same error. So the important part of the error is this:

The C compiler

          "C:/Program Files (x86)/Microsoft Visual Studio/2022/BuildTools/VC/Tools/MSVC/14.43.34808/bin/Hostx64/x64/cl.exe"

        is not able to compile a simple test program.

        It fails with the following output:

...

Build FAILED.

          "C:\Users\seand\AppData\Local\Temp\pip-install-6z4pfe_z\intel-npu-acceleration-library_eadf2a9821aa4d469dad66541d2a5dfd\build\temp.win-amd64-cpython-313\Release\CMakeFiles\CMakeScratch\TryCompile-hgrqxg\cmTC_4c3aa.vcxproj" (default target) (1) ->
          (Link target) ->
            FileTracker : error FTK1011: could not create the new file tracking log file: C:\Users\seand\AppData\Local\Temp\pip-install-6z4pfe_z\intel-npu-acceleration-library_eadf2a9821aa4d469dad66541d2a5dfd\build\temp.win-amd64-cpython-313\Release\CMakeFiles\CMakeScratch\TryCompile-hgrqxg\cmTC_4c3aa.dir\Debug\cmTC_4c3aa.tlog\link-cvtres.read.1.tlog. The system cannot find the path specified. [C:\Users\seand\AppData\Local\Temp\pip-install-6z4pfe_z\intel-npu-acceleration-library_eadf2a9821aa4d469dad66541d2a5dfd\build\temp.win-amd64-cpython-313\Release\CMakeFiles\CMakeScratch\TryCompile-hgrqxg\cmTC_4c3aa.vcxproj]
            FileTracker : error FTK1011: could not create the new file tracking log file: C:\Users\seand\AppData\Local\Temp\pip-install-6z4pfe_z\intel-npu-acceleration-library_eadf2a9821aa4d469dad66541d2a5dfd\build\temp.win-amd64-cpython-313\Release\CMakeFiles\CMakeScratch\TryCompile-hgrqxg\cmTC_4c3aa.dir\Debug\cmTC_4c3aa.tlog\link-cvtres.write.1.tlog. The system cannot find the path specified. [C:\Users\seand\AppData\Local\Temp\pip-install-6z4pfe_z\intel-npu-acceleration-library_eadf2a9821aa4d469dad66541d2a5dfd\build\temp.win-amd64-cpython-313\Release\CMakeFiles\CMakeScratch\TryCompile-hgrqxg\cmTC_4c3aa.vcxproj]

              1 Warning(s)
              2 Error(s)

          Time Elapsed 00:00:02.02

        CMake will not be able to correctly generate this project.
      Call Stack (most recent call first):
        CMakeLists.txt:9 (project)


      -- Configuring incomplete, errors occurred!
      error: command 'C:\\Program Files (x86)\\Microsoft Visual Studio\\2022\\BuildTools\\Common7\\IDE\\CommonExtensions\\Microsoft\\CMake\\CMake\\bin\\cmake.EXE' failed with exit code 1
      [end of output]

  note: This error originates from a subprocess, and is likely not a problem with pip.
  ERROR: Failed building wheel for intel-npu-acceleration-library

The reason this occurs is because CMake tries to compile a test program in the build directory, but the directory exceeds the path length limit on Windows because of all of the hex codes that pip install adds after the directory names. The way to get around this is to change the build directory to somewhere shorter. Here's how I did that:

  1. Open PowerShell in your home directory. For example, C:/Users/johndoe
  2. Run the command mkdir tmpbuild This creates a new folder called tmpbuild in your home directory, which will have a much shorter path than the default pip install version
  3. Run the command $env:TMPDIR="tmpbuild" This sets the build directory for pip install so that it will use the folder that you just created. Don't worry, this won't permanently change your system environment variables; your changes will be reset once you close your PowerShell window
  4. Finally, run the command pip install intel-npu-acceleration-library Hopefully it works this time!

I hope this helps.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants