yahoojapan / NGT

Nearest Neighbor Search with Neighborhood Graph and Tree for High-dimensional Data
Apache License 2.0
1.26k stars 115 forks source link

Install python bindings with shared memory #167

Closed jpmag7 closed 2 months ago

jpmag7 commented 2 months ago

Hello. I'm trying to compile NGT from source to get the python bindings with shared memory allocation but I'm getting an error. I'm running this to compile (which runs successfully):

git clone https://github.com/yahoojapan/NGT.git
cd NGT
mkdir build
cd build
cmake -DNGT_SHARED_MEMORY_ALLOCATOR=ON ..
make
make install
ldconfig /usr/local/lib 

And this to pip install:

pip3 install pybind11
pip3 install numpy
cd NGT/python
python3 setup.py sdist
pip3 install dist/ngt-2.2.4.tar.gz

But I get this error:

Building wheels for collected packages: ngt
  Building wheel for ngt (setup.py) ... error
  error: subprocess-exited-with-error

  × python setup.py bdist_wheel did not run successfully.
  │ exit code: 1
  ╰─> [472 lines of output]
      In file included from src/ngtpy.cpp:20:
      /usr/local/include/NGT/NGTQ/Quantizer.h:59:2: warning: #warning "AVX2 is available for NGTQG" [-Wcpp]
         59 | #warning "AVX2 is available for NGTQG"
            |  ^~~~~~~
      src/ngtpy.cpp:563:31: error: 'NGTQG' has not been declared
        563 | class QuantizedIndex : public NGTQG::Index {
            |                               ^~~~~
      src/ngtpy.cpp:563:38: error: expected '{' before 'Index'
        563 | class QuantizedIndex : public NGTQG::Index {
            |                                      ^~~~~
      src/ngtpy.cpp:564:1: error: expected primary-expression before 'public'
        564 | public:
            | ^~~~~~
      src/ngtpy.cpp:564:1: error: expected '}' before 'public'
      src/ngtpy.cpp:563:44: note: to match this '{'
        563 | class QuantizedIndex : public NGTQG::Index {
            |                                            ^
      src/ngtpy.cpp: In function 'pybind11::object search(pybind11::object, size_t, float, float, int)':
      src/ngtpy.cpp:599:7: error: 'NGTQG' has not been declared
        599 |       NGTQG::SearchQuery sc(qvector);
            |       ^~~~~
      src/ngtpy.cpp:600:33: error: 'defaultNumOfSearchObjects' was not declared in this scope
        600 |       size  = size > 0 ? size : defaultNumOfSearchObjects;
            |                                 ^~~~~~~~~~~~~~~~~~~~~~~~~
      src/ngtpy.cpp:601:45: error: 'defaultEpsilon' was not declared in this scope
        601 |       epsilon  = epsilon > -1.0 ? epsilon : defaultEpsilon;
            |                                             ^~~~~~~~~~~~~~
      src/ngtpy.cpp:602:68: error: 'defaultResultExpansion' was not declared in this scope; did you mean 'resultExpansion'?
        602 |       resultExpansion = resultExpansion >= 0.0 ? resultExpansion : defaultResultExpansion;
            |                                                                    ^~~~~~~~~~~~~~~~~~~~~~
            |                                                                    resultExpansion
      src/ngtpy.cpp:603:47: error: 'defaultEdgeSize' was not declared in this scope
        603 |       edgeSize  = edgeSize >= -2 ? edgeSize : defaultEdgeSize;
            |                                               ^~~~~~~~~~~~~~~
      src/ngtpy.cpp:604:7: error: 'sc' was not declared in this scope
        604 |       sc.setSize(size);    // the number of resulting objects.
            |       ^~
      src/ngtpy.cpp:605:20: error: 'defaultRadius' was not declared in this scope
        605 |       sc.setRadius(defaultRadius);   // the radius of search.
            |                    ^~~~~~~~~~~~~
      src/ngtpy.cpp:610:7: error: 'NGTQG' has not been declared
        610 |       NGTQG::Index::search(sc);
            |       ^~~~~
      src/ngtpy.cpp:612:7: error: 'numOfDistanceComputations' was not declared in this scope
        612 |       numOfDistanceComputations += sc.distanceComputationCount;
            |       ^~~~~~~~~~~~~~~~~~~~~~~~~
      src/ngtpy.cpp:614:12: error: 'withDistance' was not declared in this scope
        614 |       if (!withDistance) {
            |            ^~~~~~~~~~~~
      src/ngtpy.cpp:620:6: error: 'zeroNumbering' was not declared in this scope
        620 |  if (zeroNumbering) {
            |      ^~~~~~~~~~~~~
      src/ngtpy.cpp:637:11: error: 'zeroNumbering' was not declared in this scope
        637 |       if (zeroNumbering) {
            |           ^~~~~~~~~~~~~
      src/ngtpy.cpp:649:12: error: 'withDistance' was not declared in this scope
        649 |       if (!withDistance) {
            |            ^~~~~~~~~~~~
      src/ngtpy.cpp: In function 'void setWithDistance(bool)':
      src/ngtpy.cpp:657:34: error: 'withDistance' was not declared in this scope; did you mean 'setWithDistance'?
        657 |   void setWithDistance(bool v) { withDistance = v; }
            |                                  ^~~~~~~~~~~~
            |                                  setWithDistance
      src/ngtpy.cpp: In function 'void set(size_t, NGT::Distance, float, float, int)':
      src/ngtpy.cpp:666:5: error: 'defaultNumOfSearchObjects' was not declared in this scope; did you mean 'numOfSearchObjects'?
        666 |     defaultNumOfSearchObjects = numOfSearchObjects > 0 ? numOfSearchObjects : defaultNumOfSearchObjects;
            |     ^~~~~~~~~~~~~~~~~~~~~~~~~
            |     numOfSearchObjects
      src/ngtpy.cpp:667:5: error: 'defaultEpsilon' was not declared in this scope
        667 |     defaultEpsilon       = epsilon > -1.0 ? epsilon : defaultEpsilon;
            |     ^~~~~~~~~~~~~~
      src/ngtpy.cpp:668:5: error: 'defaultRadius' was not declared in this scope
        668 |     defaultRadius       = radius >= 0.0 ? radius : defaultRadius;
            |     ^~~~~~~~~~~~~
      src/ngtpy.cpp:669:5: error: 'defaultResultExpansion' was not declared in this scope; did you mean 'resultExpansion'?
        669 |     defaultResultExpansion    = resultExpansion >= 0.0 ? resultExpansion : defaultResultExpansion;
            |     ^~~~~~~~~~~~~~~~~~~~~~
            |     resultExpansion
      src/ngtpy.cpp:670:5: error: 'defaultEdgeSize' was not declared in this scope
        670 |     defaultEdgeSize       = edgeSize >= -2 ? edgeSize : defaultEdgeSize;
            |     ^~~~~~~~~~~~~~~
      src/ngtpy.cpp: At global scope:
      src/ngtpy.cpp:682:1: error: expected declaration before '}' token
        682 | };
            | ^
      src/ngtpy.cpp:685:35: error: 'QBG' has not been declared
        685 | class QuantizedBlobIndex : public QBG::Index {
            |                                   ^~~
      src/ngtpy.cpp:685:40: error: expected '{' before 'Index'
        685 | class QuantizedBlobIndex : public QBG::Index {
            |                                        ^~~~~
      src/ngtpy.cpp:685:40: error: redefinition of 'int Index'
      src/ngtpy.cpp:563:38: note: 'int Index' previously defined here
        563 | class QuantizedIndex : public NGTQG::Index {
            |                                      ^~~~~
      src/ngtpy.cpp:686:1: error: expected primary-expression before 'public'
        686 | public:
            | ^~~~~~
      src/ngtpy.cpp:686:1: error: expected '}' before 'public'
      src/ngtpy.cpp:685:46: note: to match this '{'
        685 | class QuantizedBlobIndex : public QBG::Index {
            |                                              ^
      src/ngtpy.cpp: In function 'void batchInsert(pybind11::array_t<double>, bool)':
      src/ngtpy.cpp:734:7: error: 'QBG' has not been declared
        734 |       QBG::Index::append(v);
            |       ^~~
      src/ngtpy.cpp: In function 'pybind11::array_t<unsigned int> batchSearchTmp(pybind11::array_t<float>, size_t)':
      src/ngtpy.cpp:758:7: error: 'QBG' has not been declared
        758 |       QBG::SearchContainer sc(queryObject);
            |       ^~~
      src/ngtpy.cpp:759:7: error: 'sc' was not declared in this scope
        759 |       sc.setSize(size);
            |       ^~
      src/ngtpy.cpp:761:25: error: 'defaultBlobEpsilon' was not declared in this scope; did you mean 'defaultEpsilon'?
        761 |       sc.setBlobEpsilon(defaultBlobEpsilon);
            |                         ^~~~~~~~~~~~~~~~~~
            |                         defaultEpsilon
      src/ngtpy.cpp:763:34: error: 'defaultExplorationSize' was not declared in this scope
        763 |       sc.setGraphExplorationSize(defaultExplorationSize);
            |                                  ^~~~~~~~~~~~~~~~~~~~~~
      src/ngtpy.cpp:764:7: error: 'QBG' has not been declared
        764 |       QBG::Index::search(sc);
            |       ^~~
      src/ngtpy.cpp: In function 'void batchSearchInTwoSteps(pybind11::array_t<float>, BatchResults&, size_t)':
      src/ngtpy.cpp:788:29: error: 'QBG' has not been declared
        788 |     size_t psedoDimension = QBG::Index::getQuantizer().globalCodebookIndex.getObjectSpace().getPaddedDimension();
            |                             ^~~
      src/ngtpy.cpp:802:7: error: 'QBG' has not been declared
        802 |       QBG::SearchContainer sc;
            |       ^~~
      src/ngtpy.cpp:803:7: error: 'sc' was not declared in this scope
        803 |       sc.setObjectVector(query);
            |       ^~
      src/ngtpy.cpp:806:25: error: 'defaultBlobEpsilon' was not declared in this scope; did you mean 'defaultEpsilon'?
        806 |       sc.setBlobEpsilon(defaultBlobEpsilon);
            |                         ^~~~~~~~~~~~~~~~~~
            |                         defaultEpsilon
      src/ngtpy.cpp:808:25: error: 'defaultNumOfProbes' was not declared in this scope; did you mean 'defaultNumOfSearchObjects'?
        808 |       sc.setNumOfProbes(defaultNumOfProbes);
            |                         ^~~~~~~~~~~~~~~~~~
            |                         defaultNumOfSearchObjects
      src/ngtpy.cpp:812:7: error: 'QBG' has not been declared
        812 |       QBG::Index::searchInTwoSteps(sc);
            |       ^~~
      src/ngtpy.cpp: In function 'void batchSearchInOneStep(pybind11::array_t<float>, BatchResults&, size_t)':
      src/ngtpy.cpp:828:29: error: 'QBG' has not been declared
        828 |     size_t psedoDimension = QBG::Index::getQuantizer().globalCodebookIndex.getObjectSpace().getPaddedDimension();
            |                             ^~~
      src/ngtpy.cpp:839:9: error: 'defaultExactResultExpansion' was not declared in this scope; did you mean 'defaultResultExpansion'?
        839 |     if (defaultExactResultExpansion >= 1.0) {
            |         ^~~~~~~~~~~~~~~~~~~~~~~~~~~
            |         defaultResultExpansion
      src/ngtpy.cpp:848:7: error: 'QBG' has not been declared
        848 |       QBG::SearchContainer sc;
            |       ^~~
      src/ngtpy.cpp:849:7: error: 'sc' was not declared in this scope
        849 |       sc.setObjectVector(query);
            |       ^~
      src/ngtpy.cpp:853:25: error: 'defaultBlobEpsilon' was not declared in this scope; did you mean 'defaultEpsilon'?
        853 |       sc.setBlobEpsilon(defaultBlobEpsilon);
            |                         ^~~~~~~~~~~~~~~~~~
            |                         defaultEpsilon
      src/ngtpy.cpp:855:34: error: 'defaultExplorationSize' was not declared in this scope
        855 |       sc.setGraphExplorationSize(defaultExplorationSize);
            |                                  ^~~~~~~~~~~~~~~~~~~~~~
      src/ngtpy.cpp:856:7: error: 'QBG' has not been declared
        856 |       QBG::Index::search(sc);
            |       ^~~
      src/ngtpy.cpp: In function 'void batchSearch(pybind11::array_t<float>, BatchResults&, size_t)':
      src/ngtpy.cpp:875:9: error: 'defaultNumOfProbes' was not declared in this scope; did you mean 'defaultNumOfSearchObjects'?
        875 |     if (defaultNumOfProbes == 0) {
            |         ^~~~~~~~~~~~~~~~~~
            |         defaultNumOfSearchObjects
      src/ngtpy.cpp: In function 'void batchRangeSearch(pybind11::array_t<float>, BatchResults&, float)':
      src/ngtpy.cpp:898:29: error: 'QBG' has not been declared
        898 |     size_t psedoDimension = QBG::Index::getQuantizer().globalCodebookIndex.getObjectSpace().getPaddedDimension();
            |                             ^~~
      src/ngtpy.cpp:912:7: error: 'QBG' has not been declared
        912 |       QBG::SearchContainer sc;
            |       ^~~
      src/ngtpy.cpp:913:7: error: 'sc' was not declared in this scope
        913 |       sc.setObjectVector(query);
            |       ^~
      src/ngtpy.cpp:917:25: error: 'defaultBlobEpsilon' was not declared in this scope; did you mean 'defaultEpsilon'?
        917 |       sc.setBlobEpsilon(defaultBlobEpsilon);
            |                         ^~~~~~~~~~~~~~~~~~
            |                         defaultEpsilon
      src/ngtpy.cpp:919:34: error: 'defaultExplorationSize' was not declared in this scope
        919 |       sc.setGraphExplorationSize(defaultExplorationSize);
            |                                  ^~~~~~~~~~~~~~~~~~~~~~
      src/ngtpy.cpp:920:7: error: 'QBG' has not been declared
        920 |       QBG::Index::search(sc);
            |       ^~~
      src/ngtpy.cpp: In function 'pybind11::object search(pybind11::object, size_t, float)':
      src/ngtpy.cpp:936:7: error: 'QBG' has not been declared
        936 |       QBG::SearchContainer sc;
            |       ^~~
      src/ngtpy.cpp:937:7: error: 'sc' was not declared in this scope
        937 |       sc.setObjectVector(qvector);
            |       ^~
      src/ngtpy.cpp:940:11: error: 'defaultExactResultExpansion' was not declared in this scope; did you mean 'defaultResultExpansion'?
        940 |       if (defaultExactResultExpansion >= 1.0) {
            |           ^~~~~~~~~~~~~~~~~~~~~~~~~~~
            |           defaultResultExpansion
      src/ngtpy.cpp:947:25: error: 'defaultBlobEpsilon' was not declared in this scope; did you mean 'defaultEpsilon'?
        947 |       sc.setBlobEpsilon(defaultBlobEpsilon);
            |                         ^~~~~~~~~~~~~~~~~~
            |                         defaultEpsilon
      src/ngtpy.cpp:949:34: error: 'defaultExplorationSize' was not declared in this scope
        949 |       sc.setGraphExplorationSize(defaultExplorationSize);
            |                                  ^~~~~~~~~~~~~~~~~~~~~~
      src/ngtpy.cpp:950:25: error: 'defaultNumOfProbes' was not declared in this scope; did you mean 'defaultNumOfSearchObjects'?
        950 |       sc.setNumOfProbes(defaultNumOfProbes);
            |                         ^~~~~~~~~~~~~~~~~~
            |                         defaultNumOfSearchObjects
      src/ngtpy.cpp:954:7: error: 'QBG' has not been declared
        954 |       QBG::Index::searchInTwoSteps(sc);
            |       ^~~
      src/ngtpy.cpp: At global scope:
      src/ngtpy.cpp:1002:8: error: redefinition of 'void setWithDistance(bool)'
       1002 |   void setWithDistance(bool v) { withDistance = v; }
            |        ^~~~~~~~~~~~~~~
      src/ngtpy.cpp:657:8: note: 'void setWithDistance(bool)' previously defined here
        657 |   void setWithDistance(bool v) { withDistance = v; }
            |        ^~~~~~~~~~~~~~~
      src/ngtpy.cpp: In function 'void set(size_t, float, float, float, float, int, int, float, int)':
      src/ngtpy.cpp:1020:5: error: 'defaultBlobEpsilon' was not declared in this scope; did you mean 'defaultEpsilon'?
       1020 |     defaultBlobEpsilon       = blobEpsilon > -1.0 ? blobEpsilon : defaultBlobEpsilon;
            |     ^~~~~~~~~~~~~~~~~~
            |     defaultEpsilon
      src/ngtpy.cpp:1023:5: error: 'defaultExplorationSize' was not declared in this scope; did you mean 'explorationSize'?
       1023 |     defaultExplorationSize    = explorationSize > 0 ? explorationSize : defaultExplorationSize;
            |     ^~~~~~~~~~~~~~~~~~~~~~
            |     explorationSize
      src/ngtpy.cpp:1025:5: error: 'defaultExactResultExpansion' was not declared in this scope; did you mean 'defaultResultExpansion'?
       1025 |     defaultExactResultExpansion = exactResultExpansion > 0.0 ? exactResultExpansion : defaultExactResultExpansion;
            |     ^~~~~~~~~~~~~~~~~~~~~~~~~~~
            |     defaultResultExpansion
      src/ngtpy.cpp:1026:5: error: 'defaultNumOfProbes' was not declared in this scope; did you mean 'defaultNumOfSearchObjects'?
       1026 |     defaultNumOfProbes       = numOfProbes > 0 ? numOfProbes : defaultNumOfProbes;
            |     ^~~~~~~~~~~~~~~~~~
            |     defaultNumOfSearchObjects
      src/ngtpy.cpp: At global scope:
      src/ngtpy.cpp:1032:9: error: redefinition of 'bool zeroNumbering'
       1032 |   bool  zeroNumbering;     // for object ID numbering. zero-based or one-based numbering.
            |         ^~~~~~~~~~~~~
      src/ngtpy.cpp:673:9: note: 'bool zeroNumbering' previously declared here
        673 |   bool  zeroNumbering;     // for object ID numbering. zero-based or one-based numbering.
            |         ^~~~~~~~~~~~~
      src/ngtpy.cpp:1033:10: error: redefinition of 'size_t numOfDistanceComputations'
       1033 |   size_t numOfDistanceComputations;
            |          ^~~~~~~~~~~~~~~~~~~~~~~~~
      src/ngtpy.cpp:674:10: note: 'size_t numOfDistanceComputations' previously declared here
        674 |   size_t numOfDistanceComputations;
            |          ^~~~~~~~~~~~~~~~~~~~~~~~~
      src/ngtpy.cpp:1034:9: error: redefinition of 'bool treeIndex'
       1034 |   bool  treeIndex;
            |         ^~~~~~~~~
      src/ngtpy.cpp:675:9: note: 'bool treeIndex' previously declared here
        675 |   bool  treeIndex;
            |         ^~~~~~~~~
      src/ngtpy.cpp:1035:9: error: redefinition of 'bool withDistance'
       1035 |   bool  withDistance;
            |         ^~~~~~~~~~~~
      src/ngtpy.cpp:676:9: note: 'bool withDistance' previously declared here
        676 |   bool  withDistance;
            |         ^~~~~~~~~~~~
      src/ngtpy.cpp:1036:10: error: redefinition of 'size_t defaultNumOfSearchObjects'
       1036 |   size_t defaultNumOfSearchObjects; // k
            |          ^~~~~~~~~~~~~~~~~~~~~~~~~
      src/ngtpy.cpp:677:10: note: 'size_t defaultNumOfSearchObjects' previously declared here
        677 |   size_t defaultNumOfSearchObjects; // k
            |          ^~~~~~~~~~~~~~~~~~~~~~~~~
      src/ngtpy.cpp:1037:10: error: redefinition of 'float defaultEpsilon'
       1037 |   float  defaultEpsilon;
            |          ^~~~~~~~~~~~~~
      src/ngtpy.cpp:678:10: note: 'float defaultEpsilon' previously declared here
        678 |   float  defaultEpsilon;
            |          ^~~~~~~~~~~~~~
      src/ngtpy.cpp:1040:10: error: redefinition of 'float defaultResultExpansion'
       1040 |   float  defaultResultExpansion;
            |          ^~~~~~~~~~~~~~~~~~~~~~
      src/ngtpy.cpp:680:10: note: 'float defaultResultExpansion' previously declared here
        680 |   float  defaultResultExpansion;
            |          ^~~~~~~~~~~~~~~~~~~~~~
      src/ngtpy.cpp:1041:11: error: redefinition of 'int64_t defaultEdgeSize'
       1041 |   int64_t defaultEdgeSize;
            |           ^~~~~~~~~~~~~~~
      src/ngtpy.cpp:681:11: note: 'int64_t defaultEdgeSize' previously declared here
        681 |   int64_t defaultEdgeSize;
            |           ^~~~~~~~~~~~~~~
      src/ngtpy.cpp:1043:10: error: redefinition of 'float defaultRadius'
       1043 |   float  defaultRadius;
            |          ^~~~~~~~~~~~~
      src/ngtpy.cpp:679:10: note: 'float defaultRadius' previously declared here
        679 |   float  defaultRadius;
            |          ^~~~~~~~~~~~~
      src/ngtpy.cpp:1049:1: error: expected declaration before '}' token
       1049 | };
            | ^
      src/ngtpy.cpp: In function 'void pybind11_init_ngtpy(pybind11::module_&)':
      src/ngtpy.cpp:1065:21: error: type/value mismatch at argument 1 in template parameter list for 'template<class type_, class ... options> class pybind11::class_'
       1065 |     py::class_<Index>(m, "Index")
            |                     ^
      src/ngtpy.cpp:1065:21: note:   expected a type, got 'Index'
      In file included from /usr/include/c++/9/bits/move.h:55,
                       from /usr/include/c++/9/bits/stl_pair.h:59,
                       from /usr/include/c++/9/bits/stl_algobase.h:64,
                       from /usr/include/c++/9/bits/char_traits.h:39,
                       from /usr/include/c++/9/string:40,
                       from /usr/local/include/NGT/Index.h:19,
                       from src/ngtpy.cpp:17:
      /usr/include/c++/9/type_traits: In instantiation of 'struct std::is_polymorphic<QuantizedIndex>':
      /opt/conda/lib/python3.10/site-packages/pybind11/include/pybind11/pybind11.h:1608:30:   required from 'class pybind11::class_<QuantizedIndex>'
      src/ngtpy.cpp:1173:51:   required from here
      /usr/include/c++/9/type_traits:709:12: error: invalid use of incomplete type 'class QuantizedIndex'
        709 |     struct is_polymorphic
            |            ^~~~~~~~~~~~~~
      src/ngtpy.cpp:563:7: note: forward declaration of 'class QuantizedIndex'
        563 | class QuantizedIndex : public NGTQG::Index {
            |       ^~~~~~~~~~~~~~
      In file included from src/ngtpy.cpp:27:
      /opt/conda/lib/python3.10/site-packages/pybind11/include/pybind11/pybind11.h: In instantiation of 'class pybind11::class_<QuantizedIndex>':
      src/ngtpy.cpp:1173:51:   required from here
      /opt/conda/lib/python3.10/site-packages/pybind11/include/pybind11/pybind11.h:1608:30: error: 'value' is not a member of 'std::is_polymorphic<QuantizedIndex>'
       1608 |     static_assert(!has_alias || std::is_polymorphic<type>::value,
            |                   ~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
      src/ngtpy.cpp:1180:41: error: incomplete type 'QuantizedIndex' used in nested name specifier
       1180 |       .def("search", &::QuantizedIndex::search,
            |                                         ^~~~~~
      src/ngtpy.cpp:1186:52: error: incomplete type 'QuantizedIndex' used in nested name specifier
       1186 |       .def("set_with_distance", &::QuantizedIndex::setWithDistance,
            |                                                    ^~~~~~~~~~~~~~~
      src/ngtpy.cpp:1188:38: error: incomplete type 'QuantizedIndex' used in nested name specifier
       1188 |       .def("set", &::QuantizedIndex::set,
            |                                      ^~~
      src/ngtpy.cpp:1195:47: error: incomplete type 'QuantizedIndex' used in nested name specifier
       1195 |       .def("set_defaults", &::QuantizedIndex::set,
            |                                               ^~~
      In file included from /usr/include/c++/9/bits/move.h:55,
                       from /usr/include/c++/9/bits/stl_pair.h:59,
                       from /usr/include/c++/9/bits/stl_algobase.h:64,
                       from /usr/include/c++/9/bits/char_traits.h:39,
                       from /usr/include/c++/9/string:40,
                       from /usr/local/include/NGT/Index.h:19,
                       from src/ngtpy.cpp:17:
      /usr/include/c++/9/type_traits: In instantiation of 'struct std::is_polymorphic<QuantizedBlobIndex>':
      /opt/conda/lib/python3.10/site-packages/pybind11/include/pybind11/pybind11.h:1608:30:   required from 'class pybind11::class_<QuantizedBlobIndex>'
      src/ngtpy.cpp:1203:59:   required from here
      /usr/include/c++/9/type_traits:709:12: error: invalid use of incomplete type 'class QuantizedBlobIndex'
        709 |     struct is_polymorphic
            |            ^~~~~~~~~~~~~~
      src/ngtpy.cpp:685:7: note: forward declaration of 'class QuantizedBlobIndex'
        685 | class QuantizedBlobIndex : public QBG::Index {
            |       ^~~~~~~~~~~~~~~~~~
      In file included from src/ngtpy.cpp:27:
      /opt/conda/lib/python3.10/site-packages/pybind11/include/pybind11/pybind11.h: In instantiation of 'class pybind11::class_<QuantizedBlobIndex>':
      src/ngtpy.cpp:1203:59:   required from here
      /opt/conda/lib/python3.10/site-packages/pybind11/include/pybind11/pybind11.h:1608:30: error: 'value' is not a member of 'std::is_polymorphic<QuantizedBlobIndex>'
       1608 |     static_assert(!has_alias || std::is_polymorphic<type>::value,
            |                   ~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
      src/ngtpy.cpp:1211:27: error: 'QBG' was not declared in this scope
       1211 |       .def("save", (void (QBG::Index::*)()) &QBG::Index::save)
            |                           ^~~
      src/ngtpy.cpp:1211:46: error: 'QBG' is not a class, namespace, or enumeration
       1211 |       .def("save", (void (QBG::Index::*)()) &QBG::Index::save)
            |                                              ^~~
      src/ngtpy.cpp:1212:51: error: incomplete type 'QuantizedBlobIndex' used in nested name specifier
       1212 |       .def("batch_insert", &::QuantizedBlobIndex::batchInsert,
            |                                                   ^~~~~~~~~~~
      src/ngtpy.cpp:1215:55: error: incomplete type 'QuantizedBlobIndex' used in nested name specifier
       1215 |       .def("batch_search_tmp", &::QuantizedBlobIndex::batchSearchTmp,
            |                                                       ^~~~~~~~~~~~~~
      src/ngtpy.cpp:1218:51: error: incomplete type 'QuantizedBlobIndex' used in nested name specifier
       1218 |       .def("batch_search", &::QuantizedBlobIndex::batchSearch,
            |                                                   ^~~~~~~~~~~
      src/ngtpy.cpp:1222:57: error: incomplete type 'QuantizedBlobIndex' used in nested name specifier
       1222 |       .def("batch_range_search", &::QuantizedBlobIndex::batchRangeSearch,
            |                                                         ^~~~~~~~~~~~~~~~
      src/ngtpy.cpp:1226:45: error: incomplete type 'QuantizedBlobIndex' used in nested name specifier
       1226 |       .def("search", &::QuantizedBlobIndex::search,
            |                                             ^~~~~~
      src/ngtpy.cpp:1230:56: error: incomplete type 'QuantizedBlobIndex' used in nested name specifier
       1230 |       .def("set_with_distance", &::QuantizedBlobIndex::setWithDistance,
            |                                                        ^~~~~~~~~~~~~~~
      src/ngtpy.cpp:1232:42: error: incomplete type 'QuantizedBlobIndex' used in nested name specifier
       1232 |       .def("set", &::QuantizedBlobIndex::set,
            |                                          ^~~
      In file included from src/ngtpy.cpp:27:
      /opt/conda/lib/python3.10/site-packages/pybind11/include/pybind11/pybind11.h: In instantiation of 'pybind11::class_<type_, options>::class_(pybind11::handle, const char*, const Extra& ...) [with Extra = {}; type_ = QuantizedIndex; options = {}]':
      src/ngtpy.cpp:1173:51:   required from here
      /opt/conda/lib/python3.10/site-packages/pybind11/include/pybind11/pybind11.h:1629:24: error: invalid use of incomplete type 'class QuantizedIndex'
       1629 |         record.type = &typeid(type);
            |                        ^~~~~~~~~~~~
      src/ngtpy.cpp:563:7: note: forward declaration of 'class QuantizedIndex'
        563 | class QuantizedIndex : public NGTQG::Index {
            |       ^~~~~~~~~~~~~~
      In file included from src/ngtpy.cpp:27:
      /opt/conda/lib/python3.10/site-packages/pybind11/include/pybind11/pybind11.h:1630:28: error: invalid application of 'sizeof' to incomplete type 'pybind11::detail::conditional_t<false, void, QuantizedIndex>' {aka 'QuantizedIndex'}
       1630 |         record.type_size = sizeof(conditional_t<has_alias, type_alias, type>);
            |                            ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
      /opt/conda/lib/python3.10/site-packages/pybind11/include/pybind11/pybind11.h:1631:29: error: invalid application of '__alignof__' to incomplete type 'pybind11::detail::conditional_t<false, void, QuantizedIndex>' {aka 'QuantizedIndex'}
       1631 |         record.type_align = alignof(conditional_t<has_alias, type_alias, type> &);
            |                             ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
      /opt/conda/lib/python3.10/site-packages/pybind11/include/pybind11/pybind11.h:1652:49: error: invalid use of incomplete type 'class QuantizedIndex'
       1652 |                     = instances[std::type_index(typeid(type))];
            |                                                 ^~~~~~~~~~~~
      src/ngtpy.cpp:563:7: note: forward declaration of 'class QuantizedIndex'
        563 | class QuantizedIndex : public NGTQG::Index {
            |       ^~~~~~~~~~~~~~
      In file included from src/ngtpy.cpp:27:
      /opt/conda/lib/python3.10/site-packages/pybind11/include/pybind11/pybind11.h: In instantiation of 'pybind11::class_<type_, options>::class_(pybind11::handle, const char*, const Extra& ...) [with Extra = {}; type_ = QuantizedBlobIndex; options = {}]':
      src/ngtpy.cpp:1203:59:   required from here
      /opt/conda/lib/python3.10/site-packages/pybind11/include/pybind11/pybind11.h:1629:24: error: invalid use of incomplete type 'class QuantizedBlobIndex'
       1629 |         record.type = &typeid(type);
            |                        ^~~~~~~~~~~~
      src/ngtpy.cpp:685:7: note: forward declaration of 'class QuantizedBlobIndex'
        685 | class QuantizedBlobIndex : public QBG::Index {
            |       ^~~~~~~~~~~~~~~~~~
      In file included from src/ngtpy.cpp:27:
      /opt/conda/lib/python3.10/site-packages/pybind11/include/pybind11/pybind11.h:1630:28: error: invalid application of 'sizeof' to incomplete type 'pybind11::detail::conditional_t<false, void, QuantizedBlobIndex>' {aka 'QuantizedBlobIndex'}
       1630 |         record.type_size = sizeof(conditional_t<has_alias, type_alias, type>);
            |                            ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
      /opt/conda/lib/python3.10/site-packages/pybind11/include/pybind11/pybind11.h:1631:29: error: invalid application of '__alignof__' to incomplete type 'pybind11::detail::conditional_t<false, void, QuantizedBlobIndex>' {aka 'QuantizedBlobIndex'}
       1631 |         record.type_align = alignof(conditional_t<has_alias, type_alias, type> &);
            |                             ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
      /opt/conda/lib/python3.10/site-packages/pybind11/include/pybind11/pybind11.h:1652:49: error: invalid use of incomplete type 'class QuantizedBlobIndex'
       1652 |                     = instances[std::type_index(typeid(type))];
            |                                                 ^~~~~~~~~~~~
      src/ngtpy.cpp:685:7: note: forward declaration of 'class QuantizedBlobIndex'
        685 | class QuantizedBlobIndex : public QBG::Index {
            |       ^~~~~~~~~~~~~~~~~~
      In file included from /opt/conda/lib/python3.10/site-packages/pybind11/include/pybind11/pybind11.h:14,
                       from src/ngtpy.cpp:27:
      /opt/conda/lib/python3.10/site-packages/pybind11/include/pybind11/detail/init.h: In instantiation of 'Class* pybind11::detail::initimpl::construct_or_initialize(Args&& ...) [with Class = QuantizedIndex; Args = {const std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >&, long unsigned int, bool, bool, bool}; typename std::enable_if<(! std::is_constructible<_Tp, _Args>::value), int>::type <anonymous> = 0]':
      /opt/conda/lib/python3.10/site-packages/pybind11/include/pybind11/detail/init.h:206:70:   required from 'static void pybind11::detail::initimpl::constructor<Args>::execute(Class&, const Extra& ...) [with Class = pybind11::class_<QuantizedIndex>; Extra = {pybind11::arg, pybind11::arg_v, pybind11::arg_v, pybind11::arg_v, pybind11::arg_v}; typename std::enable_if<(! Class::has_alias), int>::type <anonymous> = 0; Args = {const std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >&, long unsigned int, bool, bool, bool}]'
      /opt/conda/lib/python3.10/site-packages/pybind11/include/pybind11/pybind11.h:1707:9:   required from 'pybind11::class_<type_, options>& pybind11::class_<type_, options>::def(const pybind11::detail::initimpl::constructor<Args ...>&, const Extra& ...) [with Args = {const std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >&, long unsigned int, bool, bool, bool}; Extra = {pybind11::arg, pybind11::arg_v, pybind11::arg_v, pybind11::arg_v, pybind11::arg_v}; type_ = QuantizedIndex; options = {}]'
      src/ngtpy.cpp:1179:43:   required from here
      /opt/conda/lib/python3.10/site-packages/pybind11/include/pybind11/detail/init.h:82:12: error: invalid use of incomplete type 'class QuantizedIndex'
         82 |     return new Class{std::forward<Args>(args)...};
            |            ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
      src/ngtpy.cpp:563:7: note: forward declaration of 'class QuantizedIndex'
        563 | class QuantizedIndex : public NGTQG::Index {
            |       ^~~~~~~~~~~~~~
      In file included from /opt/conda/lib/python3.10/site-packages/pybind11/include/pybind11/pybind11.h:14,
                       from src/ngtpy.cpp:27:
      /opt/conda/lib/python3.10/site-packages/pybind11/include/pybind11/detail/init.h: In instantiation of 'Class* pybind11::detail::initimpl::construct_or_initialize(Args&& ...) [with Class = QuantizedBlobIndex; Args = {const std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >&, long unsigned int, bool, bool, bool, bool}; typename std::enable_if<(! std::is_constructible<_Tp, _Args>::value), int>::type <anonymous> = 0]':
      /opt/conda/lib/python3.10/site-packages/pybind11/include/pybind11/detail/init.h:206:70:   required from 'static void pybind11::detail::initimpl::constructor<Args>::execute(Class&, const Extra& ...) [with Class = pybind11::class_<QuantizedBlobIndex>; Extra = {pybind11::arg, pybind11::arg_v, pybind11::arg_v, pybind11::arg_v, pybind11::arg_v, pybind11::arg_v}; typename std::enable_if<(! Class::has_alias), int>::type <anonymous> = 0; Args = {const std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >&, long unsigned int, bool, bool, bool, bool}]'
      /opt/conda/lib/python3.10/site-packages/pybind11/include/pybind11/pybind11.h:1707:9:   required from 'pybind11::class_<type_, options>& pybind11::class_<type_, options>::def(const pybind11::detail::initimpl::constructor<Args ...>&, const Extra& ...) [with Args = {const std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >&, long unsigned int, bool, bool, bool, bool}; Extra = {pybind11::arg, pybind11::arg_v, pybind11::arg_v, pybind11::arg_v, pybind11::arg_v, pybind11::arg_v}; type_ = QuantizedBlobIndex; options = {}]'
      src/ngtpy.cpp:1210:39:   required from here
      /opt/conda/lib/python3.10/site-packages/pybind11/include/pybind11/detail/init.h:82:12: error: invalid use of incomplete type 'class QuantizedBlobIndex'
         82 |     return new Class{std::forward<Args>(args)...};
            |            ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
      src/ngtpy.cpp:685:7: note: forward declaration of 'class QuantizedBlobIndex'
        685 | class QuantizedBlobIndex : public QBG::Index {
            |       ^~~~~~~~~~~~~~~~~~
      In file included from /opt/conda/lib/python3.10/site-packages/pybind11/include/pybind11/detail/../detail/type_caster_base.h:15,
                       from /opt/conda/lib/python3.10/site-packages/pybind11/include/pybind11/detail/../cast.h:15,
                       from /opt/conda/lib/python3.10/site-packages/pybind11/include/pybind11/detail/../attr.h:14,
                       from /opt/conda/lib/python3.10/site-packages/pybind11/include/pybind11/detail/class.h:12,
                       from /opt/conda/lib/python3.10/site-packages/pybind11/include/pybind11/pybind11.h:13,
                       from src/ngtpy.cpp:27:
      /opt/conda/lib/python3.10/site-packages/pybind11/include/pybind11/detail/../detail/internals.h: At global scope:
      /opt/conda/lib/python3.10/site-packages/pybind11/include/pybind11/detail/../detail/internals.h:623:13: error: 'decltype (cb(pybind11::detail::get_internals())) pybind11::detail::with_internals(const F&) [with F = pybind11::class_<type_, options>::class_(pybind11::handle, const char*, const Extra& ...) [with Extra = {}; type_ = QuantizedIndex; options = {}]::<lambda(pybind11::detail::internals&)>; decltype (cb(pybind11::detail::get_internals())) = void]', declared using local type 'const pybind11::class_<type_, options>::class_(pybind11::handle, const char*, const Extra& ...) [with Extra = {}; type_ = QuantizedIndex; options = {}]::<lambda(pybind11::detail::internals&)>', is used but never defined [-fpermissive]
        623 | inline auto with_internals(const F &cb) -> decltype(cb(get_internals())) {
            |             ^~~~~~~~~~~~~~
      /opt/conda/lib/python3.10/site-packages/pybind11/include/pybind11/detail/../detail/internals.h:623:13: error: 'decltype (cb(pybind11::detail::get_internals())) pybind11::detail::with_internals(const F&) [with F = pybind11::class_<type_, options>::class_(pybind11::handle, const char*, const Extra& ...) [with Extra = {}; type_ = QuantizedBlobIndex; options = {}]::<lambda(pybind11::detail::internals&)>; decltype (cb(pybind11::detail::get_internals())) = void]', declared using local type 'const pybind11::class_<type_, options>::class_(pybind11::handle, const char*, const Extra& ...) [with Extra = {}; type_ = QuantizedBlobIndex; options = {}]::<lambda(pybind11::detail::internals&)>', is used but never defined [-fpermissive]
      src/ngtpy.cpp: In function 'pybind11::object search(pybind11::object, size_t, float, float, int)':
      src/ngtpy.cpp:595:37: warning: control reaches end of non-void function [-Wreturn-type]
        595 |     py::array_t<float> qobject(query);
            |                                     ^
      error: command '/usr/bin/gcc' 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 ngt
  Running setup.py clean for ngt
Failed to build ngt
ERROR: Could not build wheels for ngt, which is required to install pyproject.toml-based projects

I tried to manually remove the quantized versions from python/src/ngtpy.cpp (because I don't need them) and the pip install runs successfully but when I try to import it in python I get this error:

ImportError: dynamic module does not define module export function (PyInit_ngtpy)

Any help would be appreciated. My goal is to use the normal NGT Index with shared memory allocation in python