nmslib / hnswlib

Header-only C++/python library for fast approximate nearest neighbors
https://github.com/nmslib/hnswlib
Apache License 2.0
4.31k stars 633 forks source link

Installation Error #439

Closed GXY0116 closed 1 year ago

GXY0116 commented 1 year ago

On a linux server, my gcc and g++ version are 4.8.5, when i run 'pip install hnswlib' : Collecting hnswlib Using cached hnswlib-0.7.0.tar.gz (33 kB) Installing build dependencies ... done Getting requirements to build wheel ... done Preparing metadata (pyproject.toml) ... done Requirement already satisfied: numpy in /.../miniconda3/envs/bio_torch/lib/python3.9/site-packages (from hnswlib) (1.23.4) 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 ╰─> [60 lines of output] running bdist_wheel running build running build_ext creating tmp gcc -pthread -B /lustre/home/acct-seeshb/seeshb-user1/miniconda3/envs/bio_torch/compiler_compat -Wl,--sysroot=/ -Wno-unused-result -Wsign-compare -DNDEBUG -O2 -Wall -fPIC -O2 -isystem /.../miniconda3/envs/bio_torch/include -fno-semantic-interposition -fPIC -O2 -isystem /.../miniconda3/envs/bio_torch/include -fno-semantic-interposition -fPIC -I/.../miniconda3/envs/bio_torch/include/python3.9 -c /tmp/tmplugtvxn9.cpp -o tmp/tmplugtvxn9.o -std=c++14 gcc: error: unrecognized command line option ‘-fno-semantic-interposition’ gcc: error: unrecognized command line option ‘-fno-semantic-interposition’ gcc: error: unrecognized command line option ‘-std=c++14’ gcc -pthread -B /.../miniconda3/envs/bio_torch/compiler_compat -Wl,--sysroot=/ -Wno-unused-result -Wsign-compare -DNDEBUG -O2 -Wall -fPIC -O2 -isystem /.../miniconda3/envs/bio_torch/include -fno-semantic-interposition -fPIC -O2 -isystem /.../miniconda3/envs/bio_torch/include -fno-semantic-interposition -fPIC -I/.../miniconda3/envs/bio_torch/include/python3.9 -c /tmp/tmpyd2zkcy9.cpp -o tmp/tmpyd2zkcy9.o -std=c++11 gcc: error: unrecognized command line option ‘-fno-semantic-interposition’ gcc: error: unrecognized command line option ‘-fno-semantic-interposition’ ... ... ... RuntimeError: Unsupported compiler -- at least C++11 support is needed! [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

GXY0116 commented 1 year ago

I am not the administrator, so i can't upgrade gcc... Thanks a lot

yurymalkov commented 1 year ago

I do not think there much we can do from our side. C++11 is basically a necessity right now.

One things that you can do is install/compile a newer GCC on your machine or install it via conda (something like conda install -c conda-forge gcc). That should not require root privileges

GXY0116 commented 1 year ago

Thanks, i've done this on a new server.

UmairBinAhmad commented 1 year ago

apt install -y gcc-10 g++-10 cpp-10 CC=/usr/bin/gcc-10 pip3 install hnswlib Fixes the issue for me .

Sreekiranar commented 1 year ago

I was getting the same issue in MacOS. My issue was resolved when I upgraded the Python version from 3.8 to 3.11.