Open naorsabag opened 1 year ago
If you encounter an error while building a wheel during the pip install process, you may need to install a C++ compiler on your computer.
For Windows 10/11
To install a C++ compiler on Windows 10/11, follow these steps:
Install Visual Studio 2022. Make sure the following components are selected: Universal Windows Platform development C++ CMake tools for Windows
Looks like you might be running a newer debian distro.
This should be reported upstream to the llama-cpp-python repo because that's what's failing to build.
It could be a depenency issue because that's usually when I see an issue like this on Linux. It's worth investigating.
I run the following as @Otoliths suggested and it solved the issue
conda install -c conda-forge c-compiler
conda install -c "conda-forge/label/cf202003" c-compiler
I get the same error on Linux
@naorsabag solution didn't work for me.
Conda Version - conda 23.3.1
Python Version - Python 3.10.6
OS details:
.-/+oossssoo+/-. abhishek@ryzen
`:+ssssssssssssssssss+:` --------------
-+ssssssssssssssssssyyssss+- OS: Ubuntu 22.04.2 LTS x86_64
.ossssssssssssssssssdMMMNysssso. Host: MS-7A38 8.0
/ssssssssssshdmmNNmmyNMMMMhssssss/ Kernel: 5.19.0-43-generic
+ssssssssshmydMMMMMMMNddddyssssssss+ Uptime: 14 mins
/sssssssshNMMMyhhyyyyhmNMMMNhssssssss/ Packages: 1996 (dpkg), 24 (snap)
.ssssssssdMMMNhsssssssssshNMMMdssssssss. Shell: zsh 5.8.1
+sssshhhyNMMNyssssssssssssyNMMMysssssss+ Resolution: 1920x1080, 1920x1080
ossyNMMMNyMMhsssssssssssssshmmmhssssssso DE: GNOME 42.5
ossyNMMMNyMMhsssssssssssssshmmmhssssssso WM: Mutter
+sssshhhyNMMNyssssssssssssyNMMMysssssss+ WM Theme: Flat-Remix-Teal-Dark
.ssssssssdMMMNhsssssssssshNMMMdssssssss. Theme: Yaru-dark [GTK2/3]
/sssssssshNMMMyhhyyyyhdNMMMNhssssssss/ Icons: Yaru [GTK2/3]
+sssssssssdmydMMMMMMMMddddyssssssss+ Terminal: gnome-terminal
/ssssssssssshdmNNNNmyNMMMMhssssss/ CPU: AMD Ryzen 5 3600 (12) @ 3.600GH
.ossssssssssssssssssdMMMNysssso. GPU: NVIDIA GeForce RTX 2060 SUPER
-+sssssssssssssssssyyyssss+- Memory: 4433MiB / 40061MiB
`:+ssssssssssssssssss+:`
Error:
Building wheels for collected packages: llama-cpp-python, hnswlib
Building wheel for llama-cpp-python (pyproject.toml) ... error
error: subprocess-exited-with-error
× Building wheel for llama-cpp-python (pyproject.toml) did not run successfully.
│ exit code: 1
╰─> [80 lines of output]
--------------------------------------------------------------------------------
-- Trying 'Ninja' generator
--------------------------------
---------------------------
----------------------
-----------------
------------
-------
--
CMake Error at /tmp/pip-build-env-gq9lomr_/overlay/lib/python3.10/site-packages/cmake/data/share/cmake-3.26/Modules/CMakeDetermineCCompiler.cmake:49 (message):
Could not find compiler set in environment variable CC:
ccache gcc.
Call Stack (most recent call first):
CMakeLists.txt:3 (ENABLE_LANGUAGE)
Not searching for unused variables given on the command line.
CMake Error: CMAKE_C_COMPILER not set, after EnableLanguage
-- Configuring incomplete, errors occurred!
--
-------
------------
-----------------
----------------------
---------------------------
--------------------------------
-- Trying 'Ninja' generator - failure
--------------------------------------------------------------------------------
--------------------------------------------------------------------------------
-- Trying 'Unix Makefiles' generator
--------------------------------
---------------------------
----------------------
-----------------
------------
-------
--
CMake Error at /tmp/pip-build-env-gq9lomr_/overlay/lib/python3.10/site-packages/cmake/data/share/cmake-3.26/Modules/CMakeDetermineCCompiler.cmake:49 (message):
Could not find compiler set in environment variable CC:
ccache gcc.
Call Stack (most recent call first):
CMakeLists.txt:3 (ENABLE_LANGUAGE)
Not searching for unused variables given on the command line.
CMake Error: CMAKE_C_COMPILER not set, after EnableLanguage
-- Configuring incomplete, errors occurred!
--
-------
------------
-----------------
----------------------
---------------------------
--------------------------------
-- Trying 'Unix Makefiles' generator - failure
--------------------------------------------------------------------------------
********************************************************************************
scikit-build could not get a working generator for your system. Aborting build.
Building Linux wheels for Python 3.10 requires a compiler (e.g gcc).
But scikit-build does *NOT* know how to install it on ubuntu
To build compliant wheels, consider using the manylinux system described in PEP-513.
Get it with "dockcross/manylinux-x64" docker image:
https://github.com/dockcross/dockcross#readme
For more details, please refer to scikit-build documentation:
http://scikit-build.readthedocs.io/en/latest/generators.html#linux
********************************************************************************
[end of output]
note: This error originates from a subprocess, and is likely not a problem with pip.
ERROR: Failed building wheel for llama-cpp-python
Building wheel for hnswlib (pyproject.toml) ... error
error: subprocess-exited-with-error
× Building wheel for hnswlib (pyproject.toml) did not run successfully.
│ exit code: 1
╰─> [55 lines of output]
running bdist_wheel
running build
running build_ext
creating tmp
ccache gcc -Wno-unused-result -Wsign-compare -DNDEBUG -g -fwrapv -O2 -Wall -g -fstack-protector-strong -Wformat -Werror=format-security -g -fwrapv -O2 -fPIC -I/home/abhishek/Documents/localGPT/.venv/include -I/usr/include/python3.10 -c /tmp/tmpt9xac4ma.cpp -o tmp/tmpt9xac4ma.o -std=c++14
ccache gcc -Wno-unused-result -Wsign-compare -DNDEBUG -g -fwrapv -O2 -Wall -g -fstack-protector-strong -Wformat -Werror=format-security -g -fwrapv -O2 -fPIC -I/home/abhishek/Documents/localGPT/.venv/include -I/usr/include/python3.10 -c /tmp/tmpkru11dic.cpp -o tmp/tmpkru11dic.o -std=c++11
Traceback (most recent call last):
File "/home/abhishek/Documents/localGPT/.venv/lib/python3.10/site-packages/pip/_vendor/pep517/in_process/_in_process.py", line 363, in <module>
main()
File "/home/abhishek/Documents/localGPT/.venv/lib/python3.10/site-packages/pip/_vendor/pep517/in_process/_in_process.py", line 345, in main
json_out['return_val'] = hook(**hook_input['kwargs'])
File "/home/abhishek/Documents/localGPT/.venv/lib/python3.10/site-packages/pip/_vendor/pep517/in_process/_in_process.py", line 261, in build_wheel
return _build_backend().build_wheel(wheel_directory, config_settings,
File "/tmp/pip-build-env-qj37ep6f/overlay/lib/python3.10/site-packages/setuptools/build_meta.py", line 416, in build_wheel
return self._build_with_temp_dir(['bdist_wheel'], '.whl',
File "/tmp/pip-build-env-qj37ep6f/overlay/lib/python3.10/site-packages/setuptools/build_meta.py", line 401, in _build_with_temp_dir
self.run_setup()
File "/tmp/pip-build-env-qj37ep6f/overlay/lib/python3.10/site-packages/setuptools/build_meta.py", line 338, in run_setup
exec(code, locals())
File "<string>", line 116, in <module>
File "/tmp/pip-build-env-qj37ep6f/overlay/lib/python3.10/site-packages/setuptools/__init__.py", line 107, in setup
return distutils.core.setup(**attrs)
File "/tmp/pip-build-env-qj37ep6f/overlay/lib/python3.10/site-packages/setuptools/_distutils/core.py", line 185, in setup
return run_commands(dist)
File "/tmp/pip-build-env-qj37ep6f/overlay/lib/python3.10/site-packages/setuptools/_distutils/core.py", line 201, in run_commands
dist.run_commands()
File "/tmp/pip-build-env-qj37ep6f/overlay/lib/python3.10/site-packages/setuptools/_distutils/dist.py", line 969, in run_commands
self.run_command(cmd)
File "/tmp/pip-build-env-qj37ep6f/overlay/lib/python3.10/site-packages/setuptools/dist.py", line 1234, in run_command
super().run_command(command)
File "/tmp/pip-build-env-qj37ep6f/overlay/lib/python3.10/site-packages/setuptools/_distutils/dist.py", line 988, in run_command
cmd_obj.run()
File "/tmp/pip-build-env-qj37ep6f/overlay/lib/python3.10/site-packages/wheel/bdist_wheel.py", line 343, in run
self.run_command("build")
File "/tmp/pip-build-env-qj37ep6f/overlay/lib/python3.10/site-packages/setuptools/_distutils/cmd.py", line 318, in run_command
self.distribution.run_command(command)
File "/tmp/pip-build-env-qj37ep6f/overlay/lib/python3.10/site-packages/setuptools/dist.py", line 1234, in run_command
super().run_command(command)
File "/tmp/pip-build-env-qj37ep6f/overlay/lib/python3.10/site-packages/setuptools/_distutils/dist.py", line 988, in run_command
cmd_obj.run()
File "/tmp/pip-build-env-qj37ep6f/overlay/lib/python3.10/site-packages/setuptools/_distutils/command/build.py", line 131, in run
self.run_command(cmd_name)
File "/tmp/pip-build-env-qj37ep6f/overlay/lib/python3.10/site-packages/setuptools/_distutils/cmd.py", line 318, in run_command
self.distribution.run_command(command)
File "/tmp/pip-build-env-qj37ep6f/overlay/lib/python3.10/site-packages/setuptools/dist.py", line 1234, in run_command
super().run_command(command)
File "/tmp/pip-build-env-qj37ep6f/overlay/lib/python3.10/site-packages/setuptools/_distutils/dist.py", line 988, in run_command
cmd_obj.run()
File "/tmp/pip-build-env-qj37ep6f/overlay/lib/python3.10/site-packages/setuptools/command/build_ext.py", line 84, in run
_build_ext.run(self)
File "/tmp/pip-build-env-qj37ep6f/overlay/lib/python3.10/site-packages/setuptools/_distutils/command/build_ext.py", line 345, in run
self.build_extensions()
File "<string>", line 103, in build_extensions
File "<string>", line 70, in cpp_flag
RuntimeError: Unsupported compiler -- at least C++11 support is needed!
[end of output]
note: This error originates from a subprocess, and is likely not a problem with pip.
ERROR: Failed building wheel for hnswlib
Failed to build llama-cpp-python hnswlib
ERROR: Could not build wheels for llama-cpp-python, hnswlib, which is required to install pyproject.toml-based projects
A chat with ChatGPT helped resolved this, sharing here for reference.
https://chat.openai.com/share/161a66d1-fe1a-4cd9-93e2-ef144471b522
If you encounter an error while building a wheel during the pip install process, you may need to install a C++ compiler on your computer.
For Windows 10/11
To install a C++ compiler on Windows 10/11, follow these steps:
Install Visual Studio 2022. Make sure the following components are selected: Universal Windows Platform development C++ CMake tools for Windows
Had the same problem, followed this advice. I have a Win11, Conda=23.5
Here's a screen shot from my VS Installer
I run the following as @Otoliths suggested and it solved the issue
conda install -c conda-forge c-compiler
conda install -c "conda-forge/label/cf202003" c-compiler
thanks. it work
Describe the bug:
Running 'pip install -r requirements.txt resulted' in error regarding building wheel for llama-cpp-python
Reproduction:
pip install -r requirements.txt ERROR: Failed building wheel for llama-cpp-python
System Info:
Logs: