hnswlib: pip install hnswlib fail on python 3.9
`Building wheels for collected packages: hnswlib 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 ╰─> [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 hnswlib Failed to build hnswlib ERROR: Could not build wheels for hnswlib, which is required to install pyproject.toml-based projects`
I have installed the latest Microsoft Visual C++ redistributions despite of that it is not installing
About this issue
- Original URL
- State: open
- Created a year ago
- Reactions: 10
- Comments: 49 (6 by maintainers)
Hey all. I looked in the code and saw there’s a check for an environment variable. Try
export HNSWLIB_NO_NATIVE=1and try install again.For windows:
I have this problem with Python 3.10.3 on macOS 13.2.1 (M1)
I’m not using
hnswlibdirectly, but it’s needed as a dependency of another package (https://github.com/chroma-core/chroma/issues/250)Are there some instructions for how to install the python lib successfully?
Using
HNSWLIB_NO_NATIVE=1I get a different error:Was getting the same error while installing on Linux inside Docker Container:
It revealed that problem was in low RAM (1GB). As I created swap-file for another 1GB everything worked just fine.
I used this commands to create SWAP-memory, if anyone needs:
And deleted it afterwards with
I have the same error on MacOS 13.1 and python 3.10. Setting the environment variable HNSWLIB_NO_NATIVE did not work for me. I do not have this problem on Windows 11.
same is happening as @anentropic mentioned I was installing chromadb and got a failure with python 3.9, any solutions people have found on this? which can help
For Linux users.
sudo apt-get install python3.11-dev
if chromadb is needed then sudo apt-get install chromadb
This solution worked for me on Apple M1 with clang 14.0.3 and python 3.10.5. I had the same problem as previous reporters above. Did not need to set HNSWLIB_NO_NATIVE flag either. Thank you!
Installed version was:
This also makes it possible to install chromadb without any issues. (see https://github.com/chroma-core/chroma/issues/250)
Working on Windows 10 , and Python 3.12 , I’ve installed MSVC Tools and Windows 10 SDK and I’m still getting this error : 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 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]
I got this error along with
pipenveven after setting upexport HNSWLIB_NO_NATIVE=1Python 3.11.2
Failed case😡
Worked case🥰
export HNSWLIB_NO_NATIVE=1 export ARCHFLAGS=“-arch x86_64” and try again!!
Hi, Same problem here, python3.9 on macosx 13.3.1 export HNSWLIB_NO_NATIVE=1 from terminal before install works for me. Thanks 👍
I have the same problem using python 3.9
Failed to build hnswlib ERROR: Could not build wheels for hnswlib, which is required to install pyproject.toml-based projects
any solution to fix that problem