spotify / annoy

Approximate Nearest Neighbors in C++/Python optimized for memory usage and loading/saving to disk
Apache License 2.0
13.24k stars 1.17k forks source link

"Illegal instruction: 4" when trying to build index (Python 3.7, Annoy version 1.17.0, macOS 10.14.6) #513

Open aparrish opened 4 years ago

aparrish commented 4 years ago

I'm using the code from #506 to test. The program crashes after .build() and prints "Illegal instruction: 4" on the output.

I get the same error whether or not I'm using the multithreaded version of .build().

Python version:

Python 3.7.6 (default, Jan  8 2020, 13:42:34) 
[Clang 4.0.1 (tags/RELEASE_401/final)] :: Anaconda, Inc. on darwin

I installed Annoy with pip. The reported version is 1.17.0, and pip installed the pre-built binary wheel for the package.

Interestingly, things seem to work fine if I tell pip to ignore the binary wheel (pip install annoy --no-binary :all:). I haven't tested this in a controlled environment, but the conda-forge binary build of 1.17.0 also seems to work fine for me (using the same version of Python and macOS).

erikbern commented 4 years ago

Sounds like there's some platform mismatch. Possibly AVX instructions. I guess the main workaround for now is to build from source.

shelbywhite commented 3 years ago

Also getting the Illegal instruction: 4 error after upgrading to 1.17.0. Python 3.7.7

xiaoheiNLP commented 3 years ago

pip install annoy==1.16.3

porterjenkins commented 3 years ago

I had this problem as well. pip install annoy==1.16.3 worked for me!

erikbern commented 3 years ago

seems unfortunate that you need to use old versions. i'll see what we can do about 1.17.0

lagejoao commented 3 years ago

Also facing the same issue using both 1.16.3 and 1.17.0 versions. A force reinstall of annoy for any version (pip install --force annoy=1.17.0) fixes the .build() fault to me.

djeer commented 1 year ago

Same problem when running annoy in Docker. Works fine on the same server when running on bare OS. Docker image was build in github actions runner, so I think runner CPU can be a little different from server but that's not gow it should work - other libs handle it just fine