Unable to install crewai in venv with python 3.12 facing ERROR: Failed building wheel for chroma-hnswlib

Using cached wcwidth-0.2.13-py2.py3-none-any.whl (34 kB)
Using cached pyasn1-0.6.1-py3-none-any.whl (83 kB)
Using cached pyreadline3-3.5.4-py3-none-any.whl (83 kB)
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
╰─> [9 lines of output]
running bdist_wheel
running build
running build_ext
building ‘hnswlib’ extension
creating build\temp.win-amd64-cpython-312\Release\python_bindings
“C:\Program Files (x86)\Microsoft Visual Studio\2022\BuildTools\VC\Tools\MSVC\14.36.32532\bin\HostX86\x64\cl.exe” /c /nologo /O2 /W3 /GL /DNDEBUG /MD -IC:\Users\xxx\AppData\Local\Temp\pip-build-env-eb5gis7d\overlay\Lib\site-packages\pybind11\include -IC:\Users\xxxx\AppData\Local\Temp\pip-build-env-eb5gis7d\overlay\Lib\site-packages\numpy_core\include -I./hnswlib/ -IC:\Users\xxxx\Documents\AI_AGENTS\venv\include “-IC:\Program Files\Python312\include” “-IC:\Program Files\Python312\Include” “-IC:\Program Files (x86)\Microsoft Visual Studio\2022\BuildTools\VC\Tools\MSVC\14.36.32532\include” “-IC:\Program Files (x86)\Microsoft Visual Studio\2022\BuildTools\VC\Auxiliary\VS\include” /EHsc /Tp./python_bindings/bindings.cpp /Fobuild\temp.win-amd64-cpython-312\Release\python_bindings\bindings.obj /EHsc /openmp /O2 /DVERSION_INFO=\"0.7.6\"
bindings.cpp
C:\Program Files (x86)\Microsoft Visual Studio\2022\BuildTools\VC\Tools\MSVC\14.36.32532\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.36.32532\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: Failed to build installable wheels for some pyproject.toml based projects (chroma-hnswlib)

Note: I have tried installing visual studio installer 22 also try with :
pip install crewai --pre

pip install --upgrade setuptools wheel

pip cache purge

pip install crewai --no-build-isolation

Also i tried to install chromadb, hnslib directly too but unable to fix. Please suggest if anybody faced this and how this resolved. Early response will be highly appreciated.

How are you installing crewai?

I am following official document for installation in venv with python version 3.12 tried with

  • pip install ‘crewai[tools]’
  • pip install crewai crewai-tools
    but facing above error

I had the same issue with a version newer than 3.11. With 3.11 I didn’t face the problem anymore.

I got the issue too. this worked for me: HNSWLIB_NO_NATIVE=1 uv pip install crewai

Thanks, Stefan_weber. I faced the same issues, so I uninstalled Python 3.12 and installed 3.11, and it worked.