pypa / packaging-problems

An issue tracker for the problems in packaging
151 stars 35 forks source link

Not able to install hnswlib #648

Closed Sunil-1234 closed 1 year ago

Sunil-1234 commented 1 year ago

Problem description

When i try to install hnswlib for chromadb i got error , then i install microsoft builder again, getting same errror while all module is updated 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

matthewfeickert commented 1 year ago

@Sunil-1234 I would suggest that you open up this installation issue with the project itself on https://github.com/nmslib/hnswlib. The pypa/packaging-problems issue tracker isn't designed to help fix other project's packaging unless they come with questions on how their procedure is going wrong.

Admins, please close this Issue.

gilbertfullah commented 1 year ago

I'm also having this same problem when trying to install chromadb. I have search all over internet for a solution, but I still can't find one.

henryiii commented 1 year ago

Looks like you need to install MSVC. You can’t build code on Windows without a compiler like MSVC.

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/

Sunil-1234 commented 1 year ago

yes, i installed latest version of Microsoft Visual C++ , and then chromadb installed successfully

Taznain06 commented 1 year ago

@Sunil-1234 Could you please provide a detailed explanation of the steps you took to install Chromadb? I'm encountering a similar issue and would appreciate your guidance.

Sunil-1234 commented 1 year ago

@Sunil-1234 Could you please provide a detailed explanation of the steps you took to install Chromadb? I'm encountering a similar issue and would appreciate your guidance.

i just installed microsoft visual c++ latest version and then issue resolved.

hskhawaja commented 1 year ago

@Sunil-1234 Could you please provide a detailed explanation of the steps you took to install Chromadb? I'm encountering a similar issue and would appreciate your guidance.

i just installed microsoft visual c++ latest version and then issue resolved.

How did you install? I'm installing it via vs_BuildTools but no luck.

Error below:

error: command 'C:\Program Files (x86)\Microsoft Visual Studio\2022\BuildTools\VC\Tools\MSVC\14.35.32215\bin\HostX86\x64\cl.exe' failed with exit code 2

John-Rood commented 1 year ago

I've also updated the build tools, with no luck - aka visual c++ is up to date

nickjuntilla commented 1 year ago

Yeah it doesn't install on a mac either

prabhudevguntur commented 1 year ago

Installing through conda worked for me

conda install -c conda-forge hnswlib

Work around Docker file ...

FROM ubuntu:latest

Update the package lists

RUN apt-get update

Install the necessary dependencies

RUN apt-get install -y curl build-essential cmake libboost-all-dev git python3.9

Install Conda

RUN curl -sSL https://repo.anaconda.com/miniconda/Miniconda3-latest-Linux-x86_64.sh -o /tmp/miniconda.sh && bash /tmp/miniconda.sh -bfp /usr/local && rm -rf /tmp/miniconda.sh ENV PATH="/usr/local/bin:${PATH}" RUN conda update conda

Copy requirements.txt to the container

COPY requirements.txt .

Set environment variables

ENV HNSWLIB_NO_NATIVE=1

Install Python packages

RUN conda install -c conda-forge hnswlib

Install Homebrew

RUN sh -c "$(curl -fsSL https://raw.githubusercontent.com/Linuxbrew/install/master/install.sh)"

Add Homebrew to PATH

ENV PATH="/home/linuxbrew/.linuxbrew/bin:${PATH}"

Install libmagic from Homebrew

RUN brew install libmagic

anastasiaxuejing commented 1 year ago

try 'conda install -c conda-forge hnswlib ' if you use conda environment! BTW, running pip as the 'root' user can result in broken permissions and conflicting behaviour with the system package manager. It is recommended to use a virtual environment instead: https://pip.pypa.io/warnings/venv

sunilkumardash9 commented 1 year ago

How to do it on Linux? Any idea

TtTTTtTeee commented 1 year ago

I am with conda environment, so run 'conda install -c conda-forge hnswlib', and it worked and added hnswlib on conda list. But when I run 'pip install chromadb', it still got an error: ERROR: Could not build wheels for hnswlib, which is required to install pyproject.toml-based project

I created another clone that uses python 3.10, then 'pip install chromadb' worked straight away - Not sure if this info helps but this is what happened in my case.

sms03 commented 1 year ago

yes, i installed latest version of Microsoft Visual C++ , and then chromadb installed successfully

what version u install can u tell me??

queerputin commented 1 year ago

If you have older versions of visual studio tools, it might work if you uninstall them and then install the newest. That seemed to work for me.

ja-818 commented 1 year ago

For everyone who doesn't know how to make it work with pip, those are the steps I followed to do it. I'm putting this in really easy clear steps as I know many people are just starting coding to try out chromadb with LangChain, so sorry if it seems too obvious:

  1. Go to this page: https://visualstudio.microsoft.com/visual-cpp-build-tools/
  2. Click on "Download Build Tools" and run what you downloaded
  3. Click on "Install" (a window with different options to click should show up)
  4. Click only on "Desktop Development with C++" and click on install (image for reference)
  5. Reboot your system
  6. try "pip install chromadb" again, it should work i1
AhmadBakdash commented 1 year ago

How to solve the problem and download it on Mac?

AhmadBakdash commented 1 year ago

How to solve the problem and download it on Mac?

Try setting an environment variable: export HNSWLIB_NO_NATIVE=1 And then retry...

...this helped me

manuelrech commented 1 year ago

Any suggestion for ubuntu 20.04?

juancitro commented 1 year ago

For Ubuntu try following commands: sudo apt install python3-dev sudo apt-get install build-essential -y

bryceschultz commented 1 year ago

For everyone who doesn't know how to make it work with pip, those are the steps I followed to do it. I'm putting this in really easy clear steps as I know many people are just starting coding to try out chromadb with LangChain, so sorry if it seems too obvious:

  1. Go to this page: https://visualstudio.microsoft.com/visual-cpp-build-tools/
  2. Click on "Download Build Tools" and run what you downloaded
  3. Click on "Install" (a window with different options to click should show up)
  4. Click only on "Desktop Development with C++" and click on install (image for reference)
  5. Reboot your system
  6. try "pip install chromadb" again, it should work i1

I'm running on windows 11 and originally python 3.10 and tried the above steps but chromadb install was still failing. In addition to the above steps I had to install python 3.9.12 and point my path to python 3.9.12 and the chromadb install then worked. Python Windows installation files can be found here: https://www.python.org/downloads/windows/

Aditya1399 commented 1 year ago

It is not running even after installing visual studio c++ on windows

Aditya1399 commented 1 year ago

I HV tried the above mentioned export command also

jweinstock-git commented 1 year ago

To install hnswlib, the only solution that woked for me (on Docker) is to use conda:

conda install -c conda-forge hnswlib

To install chromadb (or any other package with dependency on hnswlib) install it without dependency:

  1. install all the other dependencies except hnswlib manually
  2. pip install chromadb --no-deps
mananmani1 commented 1 year ago

Solution at my end: I installed MSVS installer in my machine after installation a new window has shown by MSVS installer to select the visual studio build tools then after selecting this ,so in the this way installation and downloading of packages will took place side by side.

link for MSVS installer: https://visualstudio.microsoft.com/visual-cpp-build-tools/

tkni2005 commented 1 year ago

Solved like this https://github.com/imartinez/privateGPT/issues/445#issuecomment-1685057620

Shubhamtomar123 commented 9 months ago

@Sunil-1234 I would suggest that you open up this installation issue with the project itself on https://github.com/nmslib/hnswlib. The pypa/packaging-problems issue tracker isn't designed to help fix other project's packaging unless they come with questions on how their procedure is going wrong.

Admins, please close this Issue.

simple download another python entrepreneur and issue will be resolved

TheArtifulProgrammer commented 8 months ago

I downgraded my Python version from 3.12 to 3.11. and it solved the issue for me. Downloading MSVS build tools didn't work

semiautomatix commented 7 months ago

For Ubuntu try following commands: sudo apt install python3-dev sudo apt-get install build-essential -y

Thanks, this worked.

Just a note here, ensure you match your python version if using deadsnakes PPA, for example:

sudo apt install python3.12-dev sudo apt-get install build-essential -y

esakkiappan444 commented 7 months ago

yes, i installed latest version of Microsoft Visual C++ , and then chromadb installed successfully

what version u install can u tell me??

Python Version 3.12 Not Working some days before i'm facing same issue that time i have python version 3.9 after i will install Microsoft Visual studio and that Development C++ and working fine

Now I have Python version 3.12 Not working , Now i have installed Microsoft Visual code and Development C++ Not working!

So use python v3.9,v3.10 or v3.11 Python v3.12 Not workng

tunacinsoy commented 1 week ago

If you also received a terminal output that indicates something like:

Building wheel for chroma-hnswlib (pyproject.toml) did not run successfully.
  │ exit code: 1
  ╰─> [303 lines of output]
      running bdist_wheel
      running build
      running build_ext
      creating tmp
      clang++ -pthread -fno-strict-overflow -Wsign-compare -Wunreachable-code -DNDEBUG -g -O3 -Wall -fPIC -fPIC -I/home/tuna/.local/share/mise/installs/python/latest/include/python3.13 -c /tmp/tmp0jka794n.cpp -o tmp/tmp0jka794n.o -std=c++14
      clang++ -pthread -fno-strict-overflow -Wsign-compare -Wunreachable-code -DNDEBUG -g -O3 -Wall -fPIC -fPIC -I/home/tuna/.local/share/mise/installs/python/latest/include/python3.13 -c /tmp/tmp0o46bagx.cpp -o tmp/tmp0o46bagx.o -fvisibility=hidden
      building 'hnswlib' extension
      creating build/temp.linux-x86_64-cpython-313/python_bindings
      clang++ -pthread -fno-strict-overflow -Wsign-compare -Wunreachable-code -DNDEBUG -g -O3 -Wall -fPIC -fPIC -I/tmp/pip-build-env-g9nkq740/overlay/lib/python3.13/site-packages/pybind11/include -I/tmp/pip-build-env-g9nkq740/overlay/lib/python3.13/site-packages/numpy/_core/include -I./hnswlib/ -I/home/tuna/.local/share/mise/installs/python/latest/include/python3.13 -c ./python_bindings/bindings.cpp -o build/temp.linux-x86_64-cpython-313/./python_bindings/bindings.o -O3 -march=native -fopenmp -DVERSION_INFO=\"0.7.6\" -std=c++14 -fvisibility=hidden
      In file included from ./python_bindings/bindings.cpp:6:
      In file included from ./hnswlib/hnswlib.h:221:
      ./hnswlib/hnswalg.h:1208:31: warning: comparison of integers of different signs: 'int' and 'size_t' (aka 'unsigned long') [-Wsign-compare]
       1208 |             for (int i = 0; i < dim; i++)
            |                             ~ ^ ~~~
      ./hnswlib/hnswalg.h:1394:23: warning: unused variable 'lengthPtr' [-Wunused-variable]
       1394 |                 void *lengthPtr = length_memory_ + internalId * sizeof(float);
            |                       ^~~~~~~~~
      ./hnswlib/hnswalg.h:1635:23: warning: unused variable 'lengthPtr' [-Wunused-variable]
       1635 |                 void *lengthPtr = length_memory_ + cur_c * sizeof(float);
            |                       ^~~~~~~~~
      ./python_bindings/bindings.cpp:115:18: warning: format specifies type 'int' but the argument has type 'ssize_t' (aka 'long') [-Wformat]
        114 |                  "Input vector data wrong shape. Number of dimensions %d. Data must be a 1D or 2D array.",
            |                                                                       ~~
            |                                                                       %zd
        115 |                  buffer.ndim);
            |                  ^~~~~~~~~~~
      ./python_bindings/bindings.cpp:144:22: warning: format specifies type 'int' but the argument has type 'ssize_t' (aka 'long') [-Wformat]
        143 |                      "The input label shape %d does not match the input data vector shape %d",
            |                                             ~~
            |                                             %zd
        144 |                      ids_numpy.ndim, feature_rows);
            |                      ^~~~~~~~~~~~~~
      ./python_bindings/bindings.cpp:144:38: warning: format specifies type 'int' but the argument has type 'size_t' (aka 'unsigned long') [-Wformat]
        143 |                      "The input label shape %d does not match the input data vector shape %d",
            |                                                                                           ~~
            |                                                                                           %zu
        144 |                      ids_numpy.ndim, feature_rows);
            |                                      ^~~~~~~~~~~~
      ./python_bindings/bindings.cpp:138:58: warning: comparison of integers of different signs: 'value_type' (aka 'long') and 'size_t' (aka 'unsigned long') [-Wsign-compare]
        138 |         if (!((ids_numpy.ndim == 1 && ids_numpy.shape[0] == feature_rows) ||
            |                                       ~~~~~~~~~~~~~~~~~~ ^  ~~~~~~~~~~~~
      ./python_bindings/bindings.cpp:432:41: warning: cannot delete expression with pointer-to-'void' type 'void *' [-Wdelete-incomplete]
        432 |                                       { delete[] f; });
            |                                         ^        ~
      ./python_bindings/bindings.cpp:434:42: warning: cannot delete expression with pointer-to-'void' type 'void *' [-Wdelete-incomplete]
        434 |                                        { delete[] f; });
            |                                          ^        ~
      ./python_bindings/bindings.cpp:436:41: warning: cannot delete expression with pointer-to-'void' type 'void *' [-Wdelete-incomplete]
        436 |                                       { delete[] f; });
            |                                         ^        ~
      ./python_bindings/bindings.cpp:438:41: warning: cannot delete expression with pointer-to-'void' type 'void *' [-Wdelete-incomplete]
        438 |                                       { delete[] f; });
            |                                         ^        ~
      ./python_bindings/bindings.cpp:440:41: warning: cannot delete expression with pointer-to-'void' type 'void *' [-Wdelete-incomplete]
        440 |                                       { delete[] f; });
            |                                         ^        ~
      ./python_bindings/bindings.cpp:717:28: warning: unused variable 'data' [-Wunused-variable]
        717 |                     float* data = (float*)items.data(row);
            |                            ^~~~
      ./python_bindings/bindings.cpp:736:40: warning: cannot delete expression with pointer-to-'void' type 'void *' [-Wdelete-incomplete]
        736 |                                      { delete[] f; });
            |                                        ^        ~
      ./python_bindings/bindings.cpp:738:40: warning: cannot delete expression with pointer-to-'void' type 'void *' [-Wdelete-incomplete]
        738 |                                      { delete[] f; });
            |                                        ^        ~
      ./python_bindings/bindings.cpp:936:40: warning: cannot delete expression with pointer-to-'void' type 'void *' [-Wdelete-incomplete]
        936 |                                      { delete[] f; });
            |                                        ^        ~
      ./python_bindings/bindings.cpp:938:40: warning: cannot delete expression with pointer-to-'void' type 'void *' [-Wdelete-incomplete]
        938 |                                      { delete[] f; });
            |                                        ^        ~
      ./python_bindings/bindings.cpp:955:1: warning: 'pybind11_init' is deprecated: PYBIND11_PLUGIN is deprecated, use PYBIND11_MODULE [-Wdeprecated-declarations]
        955 | PYBIND11_PLUGIN(hnswlib)
            | ^
      /tmp/pip-build-env-g9nkq740/overlay/lib/python3.13/site-packages/pybind11/include/pybind11/detail/common.h:439:20: note: expanded from macro 'PYBIND11_PLUGIN'
        439 |             return pybind11_init();                                                               \
            |                    ^
      ./python_bindings/bindings.cpp:955:1: note: 'pybind11_init' has been explicitly marked deprecated here
      /tmp/pip-build-env-g9nkq740/overlay/lib/python3.13/site-packages/pybind11/include/pybind11/detail/common.h:433:5: note: expanded from macro 'PYBIND11_PLUGIN'
        433 |     PYBIND11_DEPRECATED("PYBIND11_PLUGIN is deprecated, use PYBIND11_MODULE")                     \
            |     ^
      /tmp/pip-build-env-g9nkq740/overlay/lib/python3.13/site-packages/pybind11/include/pybind11/detail/common.h:202:43: note: expanded from macro 'PYBIND11_DEPRECATED'
        202 | #    define PYBIND11_DEPRECATED(reason) [[deprecated(reason)]]
            |                                           ^
      In file included from ./python_bindings/bindings.cpp:6:
      In file included from ./hnswlib/hnswlib.h:221:
      ./hnswlib/hnswalg.h:270:31: warning: comparison of integers of different signs: 'int' and 'size_t' (aka 'unsigned long') [-Wsign-compare]
        270 |             for (int i = 0; i < dim; i++)
            |                             ~ ^ ~~~
      ./hnswlib/hnswalg.h:1634:32: note: in instantiation of member function 'hnswlib::HierarchicalNSW<float>::normalize_vector' requested here
       1634 |                 float length = normalize_vector((float *)data_point, norm_array.data(), dim);
            |                                ^
      ./hnswlib/hnswalg.h:1349:17: note: in instantiation of member function 'hnswlib::HierarchicalNSW<float>::addPoint' requested here
       1349 |                 addPoint(data_point, label, -1);
            |                 ^
      ./hnswlib/hnswalg.h:188:9: note: in instantiation of member function 'hnswlib::HierarchicalNSW<float>::addPoint' requested here
        188 |         ~HierarchicalNSW()
            |         ^
      ./python_bindings/bindings.cpp:218:13: note: in instantiation of member function 'hnswlib::HierarchicalNSW<float>::~HierarchicalNSW' requested here
        218 |             delete appr_alg;
            |             ^
      /usr/bin/../lib/gcc/x86_64-linux-gnu/13/../../../../include/c++/13/bits/unique_ptr.h:99:2: note: in instantiation of member function 'Index<float>::~Index' requested here
         99 |         delete __ptr;
            |         ^
      /usr/bin/../lib/gcc/x86_64-linux-gnu/13/../../../../include/c++/13/bits/unique_ptr.h:404:4: note: in instantiation of member function 'std::default_delete<Index<float>>::operator()' requested here
        404 |           get_deleter()(std::move(__ptr));
            |           ^
      /tmp/pip-build-env-g9nkq740/overlay/lib/python3.13/site-packages/pybind11/include/pybind11/pybind11.h:1926:40: note: in instantiation of member function 'std::unique_ptr<Index<float>>::~unique_ptr' requested here
       1926 |             v_h.holder<holder_type>().~holder_type();
            |                                        ^
      /tmp/pip-build-env-g9nkq740/overlay/lib/python3.13/site-packages/pybind11/include/pybind11/pybind11.h:1585:26: note: in instantiation of member function 'pybind11::class_<Index<float>>::dealloc' requested here
       1585 |         record.dealloc = dealloc;
            |                          ^
      ./python_bindings/bindings.cpp:959:5: note: in instantiation of function template specialization 'pybind11::class_<Index<float>>::class_<>' requested here
        959 |     py::class_<Index<float>>(m, "Index")
            |     ^
      In file included from ./python_bindings/bindings.cpp:6:
      In file included from ./hnswlib/hnswlib.h:221:
      ./hnswlib/hnswalg.h:274:31: warning: comparison of integers of different signs: 'int' and 'size_t' (aka 'unsigned long') [-Wsign-compare]
        274 |             for (int i = 0; i < dim; i++)
            |                             ~ ^ ~~~
      ./hnswlib/hnswalg.h:127:15: warning: field 'link_list_locks_' will be initialized after field 'label_op_locks_' [-Wreorder-ctor]
        127 |             : link_list_locks_(max_elements),
            |               ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
            |               label_op_locks_(MAX_LABEL_OPERATION_LOCKS)
        128 |               label_op_locks_(MAX_LABEL_OPERATION_LOCKS),
            |               ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
            |               link_list_locks_(max_elements)
      ./python_bindings/bindings.cpp:533:39: note: in instantiation of member function 'hnswlib::HierarchicalNSW<float>::HierarchicalNSW' requested here
        533 |             new_index->appr_alg = new hnswlib::HierarchicalNSW<dist_t>(
            |                                       ^
      ./python_bindings/bindings.cpp:960:38: note: in instantiation of member function 'Index<float>::createFromParams' requested here
        960 |         .def(py::init(&Index<float>::createFromParams), py::arg("params"))
            |                                      ^
      ./python_bindings/bindings.cpp:736:40: warning: cannot delete expression with pointer-to-'void' type 'void *' [-Wdelete-incomplete]
        736 |                                      { delete[] f; });
            |                                        ^        ~
      ./python_bindings/bindings.cpp:736:38: note: while substituting into a lambda expression here
        736 |                                      { delete[] f; });
            |                                      ^
      ./python_bindings/bindings.cpp:974:29: note: in instantiation of member function 'Index<float>::knnQuery_return_numpy' requested here
        974 |              &Index<float>::knnQuery_return_numpy,
            |                             ^
      ./python_bindings/bindings.cpp:738:40: warning: cannot delete expression with pointer-to-'void' type 'void *' [-Wdelete-incomplete]
        738 |                                      { delete[] f; });
            |                                        ^        ~
      ./python_bindings/bindings.cpp:738:38: note: while substituting into a lambda expression here
        738 |                                      { delete[] f; });
            |                                      ^
      ./python_bindings/bindings.cpp:974:29: note: in instantiation of member function 'Index<float>::knnQuery_return_numpy' requested here
        974 |              &Index<float>::knnQuery_return_numpy,
            |                             ^
      ./python_bindings/bindings.cpp:684:22: warning: comparison of integers of different signs: 'size_t' (aka 'unsigned long') and 'int' [-Wsign-compare]
        684 |             if (rows <= num_threads * 4)
            |                 ~~~~ ^  ~~~~~~~~~~~~~~~
      ./python_bindings/bindings.cpp:974:29: note: in instantiation of member function 'Index<float>::knnQuery_return_numpy' requested here
        974 |              &Index<float>::knnQuery_return_numpy,
            |                             ^
      ./python_bindings/bindings.cpp:310:22: warning: comparison of integers of different signs: 'size_t' (aka 'unsigned long') and 'int' [-Wsign-compare]
        310 |         if (features != dim)
            |             ~~~~~~~~ ^  ~~~
      ./python_bindings/bindings.cpp:980:29: note: in instantiation of member function 'Index<float>::addItems' requested here
        980 |              &Index<float>::addItems,
            |                             ^
      ./python_bindings/bindings.cpp:314:18: warning: comparison of integers of different signs: 'size_t' (aka 'unsigned long') and 'int' [-Wsign-compare]
        314 |         if (rows <= num_threads * 4)
            |             ~~~~ ^  ~~~~~~~~~~~~~~~
      In file included from ./python_bindings/bindings.cpp:6:
      In file included from ./hnswlib/hnswlib.h:221:
      ./hnswlib/hnswalg.h:1208:31: warning: comparison of integers of different signs: 'int' and 'size_t' (aka 'unsigned long') [-Wsign-compare]
       1208 |             for (int i = 0; i < dim; i++)
            |                             ~ ^ ~~~
      ./python_bindings/bindings.cpp:367:47: note: in instantiation of function template specialization 'hnswlib::HierarchicalNSW<float>::getDataByLabel<float>' requested here
        367 |             data.push_back(appr_alg->template getDataByLabel<data_t>(id));
            |                                               ^
      ./python_bindings/bindings.cpp:985:49: note: in instantiation of member function 'Index<float>::getDataReturnList' requested here
        985 |         .def("get_items", &Index<float, float>::getDataReturnList, py::arg("ids") = py::none())
            |                                                 ^
      ./python_bindings/bindings.cpp:432:41: warning: cannot delete expression with pointer-to-'void' type 'void *' [-Wdelete-incomplete]
        432 |                                       { delete[] f; });
            |                                         ^        ~
      ./python_bindings/bindings.cpp:432:39: note: while substituting into a lambda expression here
        432 |                                       { delete[] f; });
            |                                       ^
      ./python_bindings/bindings.cpp:511:27: note: in instantiation of member function 'Index<float>::getAnnData' requested here
        511 |         auto ann_params = getAnnData();
            |                           ^
      ./python_bindings/bindings.cpp:1025:39: note: in instantiation of member function 'Index<float>::getIndexParams' requested here
       1025 |             return py::make_tuple(ind.getIndexParams()); /* Return dict (wrapped in a tuple) that fully encodes state of the Index object */
            |                                       ^
      ./python_bindings/bindings.cpp:434:42: warning: cannot delete expression with pointer-to-'void' type 'void *' [-Wdelete-incomplete]
        434 |                                        { delete[] f; });
            |                                          ^        ~
      ./python_bindings/bindings.cpp:434:40: note: while substituting into a lambda expression here
        434 |                                        { delete[] f; });
            |                                        ^
      ./python_bindings/bindings.cpp:511:27: note: in instantiation of member function 'Index<float>::getAnnData' requested here
        511 |         auto ann_params = getAnnData();
            |                           ^
      ./python_bindings/bindings.cpp:1025:39: note: in instantiation of member function 'Index<float>::getIndexParams' requested here
       1025 |             return py::make_tuple(ind.getIndexParams()); /* Return dict (wrapped in a tuple) that fully encodes state of the Index object */
            |                                       ^
      ./python_bindings/bindings.cpp:436:41: warning: cannot delete expression with pointer-to-'void' type 'void *' [-Wdelete-incomplete]
        436 |                                       { delete[] f; });
            |                                         ^        ~
      ./python_bindings/bindings.cpp:436:39: note: while substituting into a lambda expression here
        436 |                                       { delete[] f; });
            |                                       ^
      ./python_bindings/bindings.cpp:511:27: note: in instantiation of member function 'Index<float>::getAnnData' requested here
        511 |         auto ann_params = getAnnData();
            |                           ^
      ./python_bindings/bindings.cpp:1025:39: note: in instantiation of member function 'Index<float>::getIndexParams' requested here
       1025 |             return py::make_tuple(ind.getIndexParams()); /* Return dict (wrapped in a tuple) that fully encodes state of the Index object */
            |                                       ^
      ./python_bindings/bindings.cpp:438:41: warning: cannot delete expression with pointer-to-'void' type 'void *' [-Wdelete-incomplete]
        438 |                                       { delete[] f; });
            |                                         ^        ~
      ./python_bindings/bindings.cpp:438:39: note: while substituting into a lambda expression here
        438 |                                       { delete[] f; });
            |                                       ^
      ./python_bindings/bindings.cpp:511:27: note: in instantiation of member function 'Index<float>::getAnnData' requested here
        511 |         auto ann_params = getAnnData();
            |                           ^
      ./python_bindings/bindings.cpp:1025:39: note: in instantiation of member function 'Index<float>::getIndexParams' requested here
       1025 |             return py::make_tuple(ind.getIndexParams()); /* Return dict (wrapped in a tuple) that fully encodes state of the Index object */
            |                                       ^
      ./python_bindings/bindings.cpp:440:41: warning: cannot delete expression with pointer-to-'void' type 'void *' [-Wdelete-incomplete]
        440 |                                       { delete[] f; });
            |                                         ^        ~
      ./python_bindings/bindings.cpp:440:39: note: while substituting into a lambda expression here
        440 |                                       { delete[] f; });
            |                                       ^
      ./python_bindings/bindings.cpp:511:27: note: in instantiation of member function 'Index<float>::getAnnData' requested here
        511 |         auto ann_params = getAnnData();
            |                           ^
      ./python_bindings/bindings.cpp:1025:39: note: in instantiation of member function 'Index<float>::getIndexParams' requested here
       1025 |             return py::make_tuple(ind.getIndexParams()); /* Return dict (wrapped in a tuple) that fully encodes state of the Index object */
            |                                       ^
      In file included from ./python_bindings/bindings.cpp:6:
      In file included from ./hnswlib/hnswlib.h:220:
      ./hnswlib/bruteforce.h:112:31: warning: comparison of integers of different signs: 'int' and 'size_t' (aka 'unsigned long') [-Wsign-compare]
        112 |             for (int i = 0; i < k; i++)
            |                             ~ ^ ~
      ./hnswlib/bruteforce.h:60:9: note: in instantiation of member function 'hnswlib::BruteforceSearch<float>::searchKnn' requested here
         60 |         ~BruteforceSearch()
            |         ^
      ./python_bindings/bindings.cpp:823:13: note: in instantiation of member function 'hnswlib::BruteforceSearch<float>::~BruteforceSearch' requested here
        823 |             delete alg;
            |             ^
      /usr/bin/../lib/gcc/x86_64-linux-gnu/13/../../../../include/c++/13/bits/unique_ptr.h:99:2: note: in instantiation of member function 'BFIndex<float>::~BFIndex' requested here
         99 |         delete __ptr;
            |         ^
      /usr/bin/../lib/gcc/x86_64-linux-gnu/13/../../../../include/c++/13/bits/unique_ptr.h:404:4: note: in instantiation of member function 'std::default_delete<BFIndex<float>>::operator()' requested here
        404 |           get_deleter()(std::move(__ptr));
            |           ^
      /tmp/pip-build-env-g9nkq740/overlay/lib/python3.13/site-packages/pybind11/include/pybind11/pybind11.h:1926:40: note: in instantiation of member function 'std::unique_ptr<BFIndex<float>>::~unique_ptr' requested here
       1926 |             v_h.holder<holder_type>().~holder_type();
            |                                        ^
      /tmp/pip-build-env-g9nkq740/overlay/lib/python3.13/site-packages/pybind11/include/pybind11/pybind11.h:1585:26: note: in instantiation of member function 'pybind11::class_<BFIndex<float>>::dealloc' requested here
       1585 |         record.dealloc = dealloc;
            |                          ^
      ./python_bindings/bindings.cpp:1036:5: note: in instantiation of function template specialization 'pybind11::class_<BFIndex<float>>::class_<>' requested here
       1036 |     py::class_<BFIndex<float>>(m, "BFIndex")
            |     ^
      In file included from ./python_bindings/bindings.cpp:6:
      In file included from ./hnswlib/hnswlib.h:220:
      ./hnswlib/bruteforce.h:122:31: warning: comparison of integers of different signs: 'int' and 'const size_t' (aka 'const unsigned long') [-Wsign-compare]
        122 |             for (int i = k; i < cur_element_count; i++)
            |                             ~ ^ ~~~~~~~~~~~~~~~~~
      ./python_bindings/bindings.cpp:936:40: warning: cannot delete expression with pointer-to-'void' type 'void *' [-Wdelete-incomplete]
        936 |                                      { delete[] f; });
            |                                        ^        ~
      ./python_bindings/bindings.cpp:936:38: note: while substituting into a lambda expression here
        936 |                                      { delete[] f; });
            |                                      ^
      ./python_bindings/bindings.cpp:1039:44: note: in instantiation of member function 'BFIndex<float>::knnQuery_return_numpy' requested here
       1039 |         .def("knn_query", &BFIndex<float>::knnQuery_return_numpy, py::arg("data"), py::arg("k") = 1, py::arg("filter") = py::none())
            |                                            ^
      ./python_bindings/bindings.cpp:938:40: warning: cannot delete expression with pointer-to-'void' type 'void *' [-Wdelete-incomplete]
        938 |                                      { delete[] f; });
            |                                        ^        ~
      ./python_bindings/bindings.cpp:938:38: note: while substituting into a lambda expression here
        938 |                                      { delete[] f; });
            |                                      ^
      ./python_bindings/bindings.cpp:1039:44: note: in instantiation of member function 'BFIndex<float>::knnQuery_return_numpy' requested here
       1039 |         .def("knn_query", &BFIndex<float>::knnQuery_return_numpy, py::arg("data"), py::arg("k") = 1, py::arg("filter") = py::none())
            |                                            ^
      ./python_bindings/bindings.cpp:854:22: warning: comparison of integers of different signs: 'size_t' (aka 'unsigned long') and 'int' [-Wsign-compare]
        854 |         if (features != dim)
            |             ~~~~~~~~ ^  ~~~
      ./python_bindings/bindings.cpp:1040:44: note: in instantiation of member function 'BFIndex<float>::addItems' requested here
       1040 |         .def("add_items", &BFIndex<float>::addItems, py::arg("data"), py::arg("ids") = py::none())
            |                                            ^
      In file included from ./python_bindings/bindings.cpp:6:
      ./hnswlib/hnswlib.h:87:13: warning: unused function 'AVX512Capable' [-Wunused-function]
         87 | static bool AVX512Capable()
            |             ^~~~~~~~~~~~~
      38 warnings generated.
      creating build/lib.linux-x86_64-cpython-313
      clang++ -pthread -fno-strict-overflow -Wsign-compare -Wunreachable-code -DNDEBUG -g -O3 -Wall -fPIC -pthread -shared -Wl,--exclude-libs,ALL -LModules/_hacl build/temp.linux-x86_64-cpython-313/./python_bindings/bindings.o -L/install/lib -o build/lib.linux-x86_64-cpython-313/hnswlib.cpython-313-x86_64-linux-gnu.so -fopenmp -pthread
      /usr/bin/ld: cannot find -lomp: No such file or directory
      clang++: error: linker command failed with exit code 1 (use -v to see invocation)
      error: command '/usr/bin/clang++' failed with exit code 1
      [end of output]

For those who use ubuntu 24.04+, following command solved the problem for me:

sudo apt-get install libomp-dev