The Problem:
I am trying to install the python package "llama-cpp-python" using pip, but I am getting an error during the installation. The error message mentions "subprocess-exited-with-error" and "CMAKE_C_COMPILER not set". I have tried various solutions, such as installing CMake, but none of them have worked. What is the cause of this error, and how can I successfully install the package?
The Solutions:
Solution 1: Install Desktop C++ Block with Visual Studio
To resolve the issue while installing the llama-cpp-python package, follow these steps:
- Open the Visual Studio Installer.
- Click on Modify.
- Check the Desktop development with C++ checkbox.
- Click on Modify to start the installation.
You can also install the Windows 10 SDK to ensure compatibility.
-
After completing the installation, run the following command:
pip install llama-cpp-python
This command should build successfully without any errors.
Solution 2: Install gcc and g++
The error message "CMake Error: CMAKE_C_COMPILER not set, after EnableLanguage", "CMake Error: CMAKE_CXX_COMPILER not set, after EnableLanguage" indicates that the gcc
and g++
are not installed.
To install gcc
and g++
:
- For Ubuntu:
sudo apt update
sudo apt upgrade
sudo add-apt-repository ppa:ubuntu-toolchain-r/test
sudo apt update
sudo apt install gcc-11 g++-11
- For CentOS:
yum install scl-utils
yum install centos-release-scl
# find devtoolset-11
yum list all --enablerepo='centos-sclo-rh' | grep "devtoolset"
yum install -y devtoolset-11-toolchain
- For Amazon Linux 2023:
sudo dnf install gcc
sudo dnf install g++
Q&A
What should be done to fix the ‘subprocess-exited-with-error’ error?
Install cmake and desktop c++ block with visual studio and Windows 10 SDK.
What might be the reason for the ‘CMAKE_C_COMPILER not set’ and ‘CMAKE_CXX_COMPILER not set’ errors?
gcc and g++ might not be installed or their version is too low.
Video Explanation:
The following video, titled "Failed building wheel for llama-cpp-python - YouTube", provides additional insights and in-depth exploration related to the topics discussed in this post.
I have been trying to install Oobabooga text generation webui on Linux both in CPU mode and GPU mode but still get this error about ...
The following video, titled "Failed building wheel for llama-cpp-python - YouTube", provides additional insights and in-depth exploration related to the topics discussed in this post.
I have been trying to install Oobabooga text generation webui on Linux both in CPU mode and GPU mode but still get this error about ...