microsoft / BitNet

Official inference framework for 1-bit LLMs
MIT License
11.44k stars 774 forks source link

error while executing python setup_env.py -md models/Llama3-8B-1.58-100B-tokens -q i2_s command #62

Closed HariKrishna070 closed 2 weeks ago

HariKrishna070 commented 1 month ago

I am trying to runt he following command in my system(Windows 11) :

python setup_env.py -md models/Llama3-8B-1.58-100B-tokens -q i2_s

and I am getting the following error :

################################

INFO:root:Compiling the code using CMake. ERROR:root:Error occurred while running command: Command '['cmake', '-B', 'build', '-DBITNET_X86_TL2=ON', '-T', 'ClangCL']' returned non-zero exit status 1., check details in logs\generate_build_files.log

################################

I have this versions installed in my conda environment

################################ python - 3.9.20 cmake - 3.29.2 clang - 19.1.2 ################################

How to resolve this?

rodyherrera commented 1 month ago

Check https://github.com/microsoft/BitNet/issues/25#issuecomment-2426882861

thuyduong19062004 commented 1 month ago

I get the same error.

dinhvanlinh0610 commented 1 month ago

I also got the same error

to-grt commented 1 month ago

Can you show us the logs\generate_build_files.log ?

dinhvanlinh0610 commented 1 month ago

logs\generate_build_files.log

-- Selecting Windows SDK version 10.0.19041.0 to target Windows 10.0.19045. CMake Error at CMakeLists.txt:2 (project): Failed to run MSBuild command:

C:/Program Files/Microsoft Visual Studio/2022/Community/MSBuild/Current/Bin/amd64/MSBuild.exe 

to get the value of VCTargetsPath:

MSBuild version 17.9.8+b34f75857 for .NET Framework 
Build started 10/22/2024 5:19:53 PM. 

Project "C:\Users\Admin\Downloads\Code\BitNet\build\CMakeFiles\3.30.5\VCTargetsPath.vcxproj" on node 1 (default targets). 
C:\Program Files\Microsoft Visual Studio\2022\Community\MSBuild\Microsoft\VC\v170\Microsoft.CppBuild.targets(456,5): error MSB8020: The build tools for ClangCL (Platform Toolset = 'ClangCL') cannot be found. To build using the ClangCL build tools, please install ClangCL build tools.  Alternatively, you may upgrade to the current Visual Studio tools by selecting the Project menu or right-click the solution, and then selecting "Retarget solution". [C:\Users\Admin\Downloads\Code\BitNet\build\CMakeFiles\3.30.5\VCTargetsPath.vcxproj] 
Done Building Project "C:\Users\Admin\Downloads\Code\BitNet\build\CMakeFiles\3.30.5\VCTargetsPath.vcxproj" (default targets) -- FAILED. 

Build FAILED. 

"C:\Users\Admin\Downloads\Code\BitNet\build\CMakeFiles\3.30.5\VCTargetsPath.vcxproj" (default target) (1) -> 
(PrepareForBuild target) ->  
  C:\Program Files\Microsoft Visual Studio\2022\Community\MSBuild\Microsoft\VC\v170\Microsoft.CppBuild.targets(456,5): error MSB8020: The build tools for ClangCL (Platform Toolset = 'ClangCL') cannot be found. To build using the ClangCL build tools, please install ClangCL build tools.  Alternatively, you may upgrade to the current Visual Studio tools by selecting the Project menu or right-click the solution, and then selecting "Retarget solution". [C:\Users\Admin\Downloads\Code\BitNet\build\CMakeFiles\3.30.5\VCTargetsPath.vcxproj] 

    0 Warning(s) 
    1 Error(s) 

Time Elapsed 00:00:00.91 

Exit code: 1

-- Configuring incomplete, errors occurred!

to-grt commented 1 month ago

It seems like clang is not detected in your installation : The build tools for ClangCL (Platform Toolset = 'ClangCL') cannot be found. I am not sure how you installed it but I strongly suggest you follow the instructions given in the README: Image If this is how you did it, I don't know where I could have gone wrong. Are you using one of these? Image

antonovkz commented 1 month ago

It seems like clang is not detected in your installation : The build tools for ClangCL (Platform Toolset = 'ClangCL') cannot be found. I am not sure how you installed it but I strongly suggest you follow the instructions given in the README: Image If this is how you did it, I don't know where I could have gone wrong. Are you using one of these? Image

Yes, I tried to do it from under it, the same error, I even tried to activate C:\Program Files\Microsoft Visual Studio\2022\Enterprise\VC\Auxiliary\Build>vcvars64.bat before that. I get this error

IINFO:root:Compiling the code using CMake.
ERROR:root:Error occurred while running command: Command '['cmake', '-B', 'build', '-DBITNET_X86_TL2=ON', '-T', 'ClangCL']' returned non-zero exit status 1., check details in logs\generate_build_files.log
to-grt commented 1 month ago

And do you have the same log output as shown before?

antonovkz commented 1 month ago

Resolved for me by installing LLVM-Toolset

RoadTLife commented 1 month ago

executing python setup_env.py -md models/Llama3-8B-1.58-100B-tokens -q i2_s command encountered an error:
The CMAKE_CXX_COMPILER: clang++ is not a full path and was not found in the PATH. How to resolve this?

INFO:

ERROR:

-- The C compiler identification is unknown
-- The CXX compiler identification is unknown
CMake Error at CMakeLists.txt:2 (project):
  The CMAKE_C_COMPILER:

    clang

  is not a full path and was not found in the PATH.

  Tell CMake where to find the compiler by setting either the environment
  variable "CC" or the CMake cache entry CMAKE_C_COMPILER to the full path to
  the compiler, or to the compiler name if it is in the PATH.

CMake Error at CMakeLists.txt:2 (project):
  The CMAKE_CXX_COMPILER:

    clang++

  is not a full path and was not found in the PATH.

  Tell CMake where to find the compiler by setting either the environment
  variable "CXX" or the CMake cache entry CMAKE_CXX_COMPILER to the full path
  to the compiler, or to the compiler name if it is in the PATH.

-- Configuring incomplete, errors occurred!
to-grt commented 1 month ago

Try: export CC=/usr/bin/clang-18 export CXX=/usr/bin/clang++-18

RoadTLife commented 1 month ago

Invalid Image

to-grt commented 1 month ago

Last idea: sudo update-alternatives --install /usr/bin/clang clang /usr/bin/clang-18 100 sudo update-alternatives --install /usr/bin/clang++ clang++ /usr/bin/clang++-18 100 Now select the correct clang version if you have several alternatives set up: sudo update-alternatives --config clang sudo update-alternatives --config clang++ Verify with: clang --version clang++ --version It will use clang-18 as the default alternative when anything tries to call clang. If you need clang in the future, be mindful that this version will be used.

RoadTLife commented 1 month ago

The command
sudo update-alternatives --install /usr/bin/clang clang /usr/bin/clang-18 100 sudo update-alternatives --install /usr/bin/clang++ clang++ /usr/bin/clang++-18 100 works, thank you .