[Python] ERROR: Could not build wheels for hnswlib, which is required to install...

Discussão em 'Python' iniciado por Stack, Fevereiro 26, 2025.

  1. Stack

    Stack Membro Participativo

    I'm trying to install embeddinghub on mac (tried pip3 install embeddinghub and pip3 install pandas embeddinghub protobuf), but I get the same error saying "could not build wheels for hnswlib, which is required to install pyproject.toml-based projects." I can't find any solutions regarding hnswlib. I've tried a lot of solutions regarding PEP517 and building wheels for other things, but none of the solutions helped. Here's the full error:

    Error

    Collecting pandas
    Using cached pandas-1.5.0-cp310-cp310-macosx_11_0_arm64.whl (10.8 MB)
    Collecting embeddinghub
    Using cached embeddinghub-0.0.1.post12-py3-none-any.whl
    Collecting protobuf
    Using cached protobuf-4.21.7-cp37-abi3-macosx_10_9_universal2.whl (484 kB)
    Collecting pytz>=2020.1
    Using cached pytz-2022.4-py2.py3-none-any.whl (500 kB)
    Collecting python-dateutil>=2.8.1
    Using cached python_dateutil-2.8.2-py2.py3-none-any.whl (247 kB)
    Collecting numpy>=1.21.0
    Using cached numpy-1.23.3-cp310-cp310-macosx_11_0_arm64.whl (13.3 MB)
    Collecting grpcio==1.40.0
    Using cached grpcio-1.40.0-cp310-cp310-macosx_10_10_universal2.whl
    Collecting hnswlib==0.5.2
    Using cached hnswlib-0.5.2.tar.gz (29 kB)
    Installing build dependencies ... done
    Getting requirements to build wheel ... done
    Preparing metadata (pyproject.toml) ... done
    Collecting numpy>=1.21.0
    Using cached numpy-1.21.1-cp310-cp310-macosx_12_0_universal2.whl
    Collecting six==1.16.0
    Using cached six-1.16.0-py2.py3-none-any.whl (11 kB)
    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
    ╰─> [17 lines of output]
    running bdist_wheel
    running build
    running build_ext
    creating var
    creating var/folders
    creating var/folders/3h
    creating var/folders/3h/0w98c6q56bl4x4c2qm31np_c0000gn
    creating var/folders/3h/0w98c6q56bl4x4c2qm31np_c0000gn/T
    clang -Wno-unused-result -Wsign-compare -Wunreachable-code -fno-common -dynamic -DNDEBUG -g -fwrapv -O3 -Wall -arch arm64 -arch x86_64 -g -I/Users/s/venv/include -I/Library/Frameworks/Python.framework/Versions/3.10/include/python3.10 -c /var/folders/3h/0w98c6q56bl4x4c2qm31np_c0000gn/T/tmp5hthbs8k.cpp -o var/folders/3h/0w98c6q56bl4x4c2qm31np_c0000gn/T/tmp5hthbs8k.o -std=c++14
    clang -Wno-unused-result -Wsign-compare -Wunreachable-code -fno-common -dynamic -DNDEBUG -g -fwrapv -O3 -Wall -arch arm64 -arch x86_64 -g -I/Users/s/venv/include -I/Library/Frameworks/Python.framework/Versions/3.10/include/python3.10 -c /var/folders/3h/0w98c6q56bl4x4c2qm31np_c0000gn/T/tmpipibvgip.cpp -o var/folders/3h/0w98c6q56bl4x4c2qm31np_c0000gn/T/tmpipibvgip.o -fvisibility=hidden
    building 'hnswlib' extension
    creating build
    creating build/temp.macosx-10.9-universal2-cpython-310
    creating build/temp.macosx-10.9-universal2-cpython-310/python_bindings
    clang -Wno-unused-result -Wsign-compare -Wunreachable-code -fno-common -dynamic -DNDEBUG -g -fwrapv -O3 -Wall -arch arm64 -arch x86_64 -g -I/private/var/folders/3h/0w98c6q56bl4x4c2qm31np_c0000gn/T/pip-build-env-hhht57g1/overlay/lib/python3.10/site-packages/pybind11/include -I/private/var/folders/3h/0w98c6q56bl4x4c2qm31np_c0000gn/T/pip-build-env-hhht57g1/overlay/lib/python3.10/site-packages/numpy/core/include -I./hnswlib/ -I/Users/s/venv/include -I/Library/Frameworks/Python.framework/Versions/3.10/include/python3.10 -c ./python_bindings/bindings.cpp -o build/temp.macosx-10.9-universal2-cpython-310/./python_bindings/bindings.o -O3 -march=native -stdlib=libc++ -mmacosx-version-min=10.7 -DVERSION_INFO=\"0.5.2\" -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
    Failed to build hnswlib
    ERROR: Could not build wheels for hnswlib, which is required to install pyproject.toml-based projects

    Continue reading...

Compartilhe esta Página