Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save ashmalvayani/ab3f4a8469fe3a2e9904c3a2674ea947 to your computer and use it in GitHub Desktop.
Save ashmalvayani/ab3f4a8469fe3a2e9904c3a2674ea947 to your computer and use it in GitHub Desktop.
SOLUTION: ChromaDB - chroma-hnswlib build error
Chromadb specifically works on python version 3.10.10. Saw on other github issues that it does not work with other python versions.
to install chromadb, write the following command:
pip install chromadb
if you are getting the following build error:
Building wheels for collected packages: chroma-hnswlib
Building wheel for chroma-hnswlib (pyproject.toml) ... error
error: subprocess-exited-with-error
× Building wheel for chroma-hnswlib (pyproject.toml) did not run successfully.
│ exit code: 1
╰─> [5 lines of output]
running bdist_wheel
running build
running build_ext
building 'hnswlib' extension
error: Microsoft Visual C++ 14.0 or greater is required. Get it with "Microsoft C++ Build Tools": https://visualstudio.microsoft.com/visual-cpp-build-tools/
[end of output]
note: This error originates from a subprocess, and is likely not a problem with pip.
ERROR: Failed building wheel for chroma-hnswlib
Failed to build chroma-hnswlib
ERROR: Could not build wheels for chroma-hnswlib, which is required to install pyproject.toml-based projects
----------------
Then do the following:
1. install VS C++ build tools by following this website:
https://learn.microsoft.com/en-us/answers/questions/136595/error-microsoft-visual-c-14-0-or-greater-is-requir
2. Once the installation is complete, close your terminal where you were installing the module and open a new terminal and run the command again.
3. It will work.
@Traveltainer007
Copy link

Ive upgraded to 3.12 and the MSVSC C++ on win10 pro and everything downloads and installs except the chromalib
I also rebooted

│ exit code: 1
╰─> [12 lines of output]
running bdist_wheel
running build
running build_ext
building 'hnswlib' extension
creating build
creating build\temp.win32-cpython-312
creating build\temp.win32-cpython-312\Release
creating build\temp.win32-cpython-312\Release\python_bindings
"D:\Program Files (x86)\Microsoft Visual Studio\2022\BuildTools\VC\Tools\MSVC\14.39.33519\bin\HostX86\x86\cl.exe" /c /nologo /O2 /W3 /GL /DNDEBUG /MD -IC:\Users\user\AppData\Local\Temp\pip-build-env-4_9y2dxx\overlay\Lib\site-packages\pybind11\include -IC:\Users\user\AppData\Local\Temp\pip-build-env-4_9y2dxx\overlay\Lib\site-packages\numpy\core\include -I./hnswlib/ -IC:\Users\user\AppData\Local\Programs\Python\Python312\include -IC:\Users\user\AppData\Local\Programs\Python\Python312\Include "-ID:\Program Files (x86)\Microsoft Visual Studio\2022\BuildTools\VC\Tools\MSVC\14.39.33519\include" "-ID:\Program Files (x86)\Microsoft Visual Studio\2022\BuildTools\VC\Auxiliary\VS\include" "-ID:\Program Files (x86)\Microsoft Visual Studio\2022\BuildTools\VC\Tools\MSVC\14.39.33519\include" "-ID:\Program Files (x86)\Microsoft Visual Studio\2022\BuildTools\VC\Auxiliary\VS\include" /EHsc /Tp./python_bindings/bindings.cpp /Fobuild\temp.win32-cpython-312\Release./python_bindings/bindings.obj /EHsc /openmp /O2 /DVERSION_INFO=\"0.7.3\"
bindings.cpp
D:\Program Files (x86)\Microsoft Visual Studio\2022\BuildTools\VC\Tools\MSVC\14.39.33519\include\yvals.h(20): fatal error C1083: Cannot open include file: 'crtdbg.h': No such file or directory
error: command 'D:\Program Files (x86)\Microsoft Visual Studio\2022\BuildTools\VC\Tools\MSVC\14.39.33519\bin\HostX86\x86\cl.exe' failed with exit code 2
[end of output]

note: This error originates from a subprocess, and is likely not a problem with pip.
ERROR: Failed building wheel for chroma-hnswlib
Failed to build chroma-hnswlib

@deadlious
Copy link

Ive upgraded to 3.12 and the MSVSC C++ on win10 pro and everything downloads and installs except the chromalib I also rebooted

│ exit code: 1 ╰─> [12 lines of output] running bdist_wheel running build running build_ext building 'hnswlib' extension creating build creating build\temp.win32-cpython-312 creating build\temp.win32-cpython-312\Release creating build\temp.win32-cpython-312\Release\python_bindings "D:\Program Files (x86)\Microsoft Visual Studio\2022\BuildTools\VC\Tools\MSVC\14.39.33519\bin\HostX86\x86\cl.exe" /c /nologo /O2 /W3 /GL /DNDEBUG /MD -IC:\Users\user\AppData\Local\Temp\pip-build-env-4_9y2dxx\overlay\Lib\site-packages\pybind11\include -IC:\Users\user\AppData\Local\Temp\pip-build-env-4_9y2dxx\overlay\Lib\site-packages\numpy\core\include -I./hnswlib/ -IC:\Users\user\AppData\Local\Programs\Python\Python312\include -IC:\Users\user\AppData\Local\Programs\Python\Python312\Include "-ID:\Program Files (x86)\Microsoft Visual Studio\2022\BuildTools\VC\Tools\MSVC\14.39.33519\include" "-ID:\Program Files (x86)\Microsoft Visual Studio\2022\BuildTools\VC\Auxiliary\VS\include" "-ID:\Program Files (x86)\Microsoft Visual Studio\2022\BuildTools\VC\Tools\MSVC\14.39.33519\include" "-ID:\Program Files (x86)\Microsoft Visual Studio\2022\BuildTools\VC\Auxiliary\VS\include" /EHsc /Tp./python_bindings/bindings.cpp /Fobuild\temp.win32-cpython-312\Release./python_bindings/bindings.obj /EHsc /openmp /O2 /DVERSION_INFO="0.7.3" bindings.cpp D:\Program Files (x86)\Microsoft Visual Studio\2022\BuildTools\VC\Tools\MSVC\14.39.33519\include\yvals.h(20): fatal error C1083: Cannot open include file: 'crtdbg.h': No such file or directory error: command 'D:\Program Files (x86)\Microsoft Visual Studio\2022\BuildTools\VC\Tools\MSVC\14.39.33519\bin\HostX86\x86\cl.exe' failed with exit code 2 [end of output]

note: This error originates from a subprocess, and is likely not a problem with pip. ERROR: Failed building wheel for chroma-hnswlib Failed to build chroma-hnswlib

me too:

Building wheels for collected packages: chroma-hnswlib
  Building wheel for chroma-hnswlib (pyproject.toml) ... error
  error: subprocess-exited-with-error

  × Building wheel for chroma-hnswlib (pyproject.toml) did not run successfully.
  │ exit code: 1
  ╰─> [12 lines of output]
      running bdist_wheel
      running build
      running build_ext
      building 'hnswlib' extension
      creating build
      creating build\temp.win-amd64-cpython-312
      creating build\temp.win-amd64-cpython-312\Release
      creating build\temp.win-amd64-cpython-312\Release\python_bindings
      "C:\Program Files (x86)\Microsoft Visual Studio\2022\BuildTools\VC\Tools\MSVC\14.34.31933\bin\HostX86\x64\cl.exe" /c /nologo /O2 /W3 /GL /DNDEBUG /MD -IC:\Users\Deadlious\AppData\Local\Temp\pip-build-env-cso39com\overlay\Lib\s
ite-packages\pybind11\include -IC:\Users\Deadlious\AppData\Local\Temp\pip-build-env-cso39com\overlay\Lib\site-packages\numpy\core\include -I./hnswlib/ -IC:\Projects\crew_ai\venv\include -IC:\Python\include -IC:\Python\Include "-IC:\
Program Files (x86)\Microsoft Visual Studio\2022\BuildTools\VC\Tools\MSVC\14.34.31933\include" "-IC:\Program Files (x86)\Microsoft Visual Studio\2022\BuildTools\VC\Auxiliary\VS\include" /EHsc /Tp./python_bindings/bindings.cpp /Fobui
ld\temp.win-amd64-cpython-312\Release\./python_bindings/bindings.obj /EHsc /openmp /O2 /DVERSION_INFO=\\\"0.7.3\\\"
      bindings.cpp
      C:\Program Files (x86)\Microsoft Visual Studio\2022\BuildTools\VC\Tools\MSVC\14.34.31933\include\yvals.h(17): fatal error C1083: Cannot open include file: 'crtdbg.h': No such file or directory
      error: command 'C:\\Program Files (x86)\\Microsoft Visual Studio\\2022\\BuildTools\\VC\\Tools\\MSVC\\14.34.31933\\bin\\HostX86\\x64\\cl.exe' failed with exit code 2
      [end of output]

  note: This error originates from a subprocess, and is likely not a problem with pip.
  ERROR: Failed building wheel for chroma-hnswlib
Failed to build chroma-hnswlib
ERROR: Could not build wheels for chroma-hnswlib, which is required to install pyproject.toml-based projects

@ervivekgoswami
Copy link

Hi All, Faced the same issue about
ERROR: Failed building wheel for chroma-hnswlib

Then as per help from StackOverflow installed the VS and selected Indivdual Components.
However, it did not worked. Then I added below package as shown in image and it works fine.

image

Note: Using Windows 10 x64-bit

@insightbuilder
Copy link

SOLUTION#02: If you are running this command on linux machine and your error only shows: "Gcc error: gcc: error trying to exec 'cc1': execvp: No such file or directory"

OR

RuntimeError: Unsupported compiler -- at least C++11 support is needed!

Then you need to run the following command on your linux machine and that should work: sudo apt-get update sudo apt-get install --reinstall build-essential

on top of it add

sudo apt install python3-dev

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment