langflow icon indicating copy to clipboard operation
langflow copied to clipboard

hnswlib installation failed.

Open oliver-li opened this issue 2 years ago • 9 comments

Describe the bug hnswlib installation failed and breaks installation or upgrades to version 0.0.56 or 0.0.57

To Reproduce Steps to reproduce the behavior:

run pip install langflow==0.0.56 Additional context stdout:

 × Building wheel for hnswlib (pyproject.toml) did not run successfully.
  │ exit code: 1
  ╰─> [17 lines of output]
      running bdist_wheel
      running build
      running build_ext
      creating var
      creating var/folders
      creating var/folders/2p
      creating var/folders/2p/76jf8q5x4pd7pll_qnd_c0jh0000gn
      creating var/folders/2p/76jf8q5x4pd7pll_qnd_c0jh0000gn/T
      clang -Wno-unused-result -Wsign-compare -Wunreachable-code -fno-common -dynamic -DNDEBUG -g -fwrapv -O3 -Wall -iwithsysroot/System/Library/Frameworks/System.framework/PrivateHeaders -iwithsysroot/Applications/Xcode.app/Contents/Developer/Library/Frameworks/Python3.framework/Versions/3.9/Headers -arch arm64 -arch x86_64 -Werror=implicit-function-declaration -I/Users/oliver/workspace/langflow/venv/include -I/Library/Developer/CommandLineTools/Library/Frameworks/Python3.framework/Versions/3.9/include/python3.9 -c /var/folders/2p/76jf8q5x4pd7pll_qnd_c0jh0000gn/T/tmpmz522jms.cpp -o var/folders/2p/76jf8q5x4pd7pll_qnd_c0jh0000gn/T/tmpmz522jms.o -std=c++14
      clang -Wno-unused-result -Wsign-compare -Wunreachable-code -fno-common -dynamic -DNDEBUG -g -fwrapv -O3 -Wall -iwithsysroot/System/Library/Frameworks/System.framework/PrivateHeaders -iwithsysroot/Applications/Xcode.app/Contents/Developer/Library/Frameworks/Python3.framework/Versions/3.9/Headers -arch arm64 -arch x86_64 -Werror=implicit-function-declaration -I/Users/oliver/workspace/langflow/venv/include -I/Library/Developer/CommandLineTools/Library/Frameworks/Python3.framework/Versions/3.9/include/python3.9 -c /var/folders/2p/76jf8q5x4pd7pll_qnd_c0jh0000gn/T/tmpsvbwtkwk.cpp -o var/folders/2p/76jf8q5x4pd7pll_qnd_c0jh0000gn/T/tmpsvbwtkwk.o -fvisibility=hidden
      building 'hnswlib' extension
      creating build
      creating build/temp.macosx-10.9-universal2-cpython-39
      creating build/temp.macosx-10.9-universal2-cpython-39/python_bindings
      clang -Wno-unused-result -Wsign-compare -Wunreachable-code -fno-common -dynamic -DNDEBUG -g -fwrapv -O3 -Wall -iwithsysroot/System/Library/Frameworks/System.framework/PrivateHeaders -iwithsysroot/Applications/Xcode.app/Contents/Developer/Library/Frameworks/Python3.framework/Versions/3.9/Headers -arch arm64 -arch x86_64 -Werror=implicit-function-declaration -I/private/var/folders/2p/76jf8q5x4pd7pll_qnd_c0jh0000gn/T/pip-build-env-dgzzaga6/overlay/lib/python3.9/site-packages/pybind11/include -I/private/var/folders/2p/76jf8q5x4pd7pll_qnd_c0jh0000gn/T/pip-build-env-dgzzaga6/overlay/lib/python3.9/site-packages/numpy/core/include -I./hnswlib/ -I/Users/oliver/workspace/langflow/venv/include -I/Library/Developer/CommandLineTools/Library/Frameworks/Python3.framework/Versions/3.9/include/python3.9 -c ./python_bindings/bindings.cpp -o build/temp.macosx-10.9-universal2-cpython-39/./python_bindings/bindings.o -O3 -march=native -stdlib=libc++ -mmacosx-version-min=10.7 -DVERSION_INFO=\"0.7.0\" -std=c++14 -fvisibility=hidden
      clang: error: the clang compiler does not support '-march=native'
      error: command '/usr/bin/clang' failed with exit code 1
      [end of output]

  note: This error originates from a subprocess, and is likely not a problem with pip.
  ERROR: Failed building wheel for hnswlib
  Building wheel for sentence-transformers (setup.py) ... done
  Created wheel for sentence-transformers: filename=sentence_transformers-2.2.2-py3-none-any.whl size=125926 sha256=74731066c472a636fccf8fff4007da1c9cc1cd5b5e03166da291d28965e1ebc3
  Stored in directory: /Users/oliver/Library/Caches/pip/wheels/d0/c7/69/06c8dbd65cf294d4aa37702827b6b341b3506e62fd7f6e7f54
  Building wheel for python-docx (setup.py) ... done
  Created wheel for python-docx: filename=python_docx-0.8.11-py3-none-any.whl size=184491 sha256=db6458e45c244b19e172eb52b6bdb9cd72f211a0fd9a05bc5b96fd1f19fa982e
  Stored in directory: /Users/oliver/Library/Caches/pip/wheels/39/ca/c1/d3e7abe5ce2e8423382d816e689c056bc26590f48fad8f20ac
  Building wheel for python-pptx (setup.py) ... done
  Created wheel for python-pptx: filename=python_pptx-0.6.21-py3-none-any.whl size=470935 sha256=f6ebd72eebbe54eb77e9a355ea616ea6aa7c9582d9edc146e6c58f0d0366a63a
  Stored in directory: /Users/oliver/Library/Caches/pip/wheels/75/14/7a/1f563540a42f97a868eb0b13b0f42a075024c4491cb169ad01
  Building wheel for olefile (setup.py) ... done
  Created wheel for olefile: filename=olefile-0.46-py2.py3-none-any.whl size=35417 sha256=3724fcd312b663365943b94403e9a83155eafb101c3882964e31f6407a127c91
  Stored in directory: /Users/oliver/Library/Caches/pip/wheels/27/e8/89/6ea6bf88439c9ef62473281e2cc5bbf09d8e028e1bad7d0bf4
Successfully built langflow llama-cpp-python pysrt sentence-transformers python-docx python-pptx olefile
Failed to build hnswlib
ERROR: Could not build wheels for hnswlib, which is required to install pyproject.toml-based projects

oliver-li avatar Apr 18 '23 08:04 oliver-li

I'm assuming that you're using a mac, Intel chipset?

If so then I have the same problem. The issue lies in the config file of the package installer that has the parameter "-march=native" somewhere in it.

My google is strong, my coding is weak. I can't help more than that i'm afraid as I have the same problem and came here to see if there was a solution - obviously not!

Captain-Bacon avatar Apr 20 '23 04:04 Captain-Bacon

I'm assuming that you're using a mac, Intel chipset?

If so then I have the same problem. The issue lies in the config file of the package installer that has the parameter "-march=native" somewhere in it.

My google is strong, my coding is weak. I can't help more than that i'm afraid as I have the same problem and came here to see if there was a solution - obviously not!

You can try using the command "export HNSWLIB_NO_NATIVE=1".

oliver-li avatar Apr 20 '23 11:04 oliver-li

You can try using the command "export HNSWLIB_NO_NATIVE=1".

Dude, I could flipping kiss you right now! Thank you!

To anyone who has chromadb or hnswlib errors that finds this page in google searches for the error "clang: error: the clang compiler does not support '-march=native' error: command '/usr/bin/clang' failed with exit code 1 " then please know that @oliver-li is a genius, this worked, and you need to say 'thanks'.

Captain-Bacon avatar Apr 21 '23 11:04 Captain-Bacon

I get this error while installing 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 ╰─> [308 lines of output]

AdamAdamAdam avatar May 13 '23 02:05 AdamAdamAdam

Hey, same error for me

TPQuentin avatar May 18 '23 13:05 TPQuentin

Is there any solution ?

TPQuentin avatar May 18 '23 13:05 TPQuentin

i solved this running: sudo apt-get install python3-dev

diegoferreira avatar May 22 '23 14:05 diegoferreira

hi, i had the same issue I downloaded the visual studio 2022 community version and visual studio build tools and that sorted the issue on its own building the wheels ect, just download Visual Studio and Build tools and should sort out the issues. all the best

chetanhansraj avatar Jun 13 '23 08:06 chetanhansraj

✅ Hey everyone, I tried what you all tried and here's the solution

I tried WSL and windows, I installed the build tools and searched everywhere and nothing worked but the information in that comment did the trick.

It's tedious so react to this comment so other people can see it.

nicolascalev avatar Jun 20 '23 23:06 nicolascalev

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

stale[bot] avatar Aug 04 '23 23:08 stale[bot]

✅ Hey everyone, I tried what you all tried and here's the solution

I tried WSL and windows, I installed the build tools and searched everywhere and nothing worked but the information in that comment did the trick.

It's tedious so react to this comment so other people can see it.

I was also having issues with hnswlib on WSL2, Ubuntu 20.04 have tried to do everything in that comment with no success, and all the other online solutions as well I got here while installing chromadb, i think the problem was that i was using python3.11, so for those who are looking this up:

seems like chromadb is currently only working on python3.10

ON WSL, i managed to solve by simply installing full python3.10 and corresponding pip then python3.10 -m pip install chromadb just worked though i cant rule out that it was a combination of both using py3.10 and something else from the suggested solutions

good luck and all the best !

fire17 avatar Aug 08 '23 05:08 fire17

I'm assuming that you're using a mac, Intel chipset? If so then I have the same problem. The issue lies in the config file of the package installer that has the parameter "-march=native" somewhere in it. My google is strong, my coding is weak. I can't help more than that i'm afraid as I have the same problem and came here to see if there was a solution - obviously not!

You can try using the command "export HNSWLIB_NO_NATIVE=1".

Man thank you very much this was super userfull 🔥🔥

goldensash01 avatar Jul 16 '24 21:07 goldensash01