Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Illegal Instruction. #11

Closed
abala003 opened this issue Mar 17, 2017 · 30 comments
Closed

Illegal Instruction. #11

abala003 opened this issue Mar 17, 2017 · 30 comments

Comments

@abala003
Copy link

abala003 commented Mar 17, 2017

  • face_recognition version: 0.1.9
  • Python version: 2.7
  • Operating System: Linux Mint

Description

Hey, first of all Thank you so much for this library. Its Amazing.
When i run the script line by line, i get an error "Illegal Instruction" at the following line
"my_face_encoding = face_recognition.face_encodings(picture_of_me)[0]"
The python terminal exits after this. Please let me know if i am doing something wrong.

What I Did

I am using Linux Mint and i pip installed face_recognition (got all libraries including dlib installed)

@ageitgey
Copy link
Owner

The issue is most likely that dlib was compiled with support for AVX and/or SSE4 instructions, but your cpu is too old to support them (pre-2011, I think).

The easiest solution is to download dlib and compile it yourself. But when you do that, you need to make one change.

Before compiling dlib, edit dlib's tools/python/CMakeLists.txt file from:

set(USE_SSE4_INSTRUCTIONS ON CACHE BOOL "Use SSE4 instructions")

to:

set(USE_SSE2_INSTRUCTIONS ON CACHE BOOL "Use SSE2 instructions")

And then compile and install dlib and the dlib python extensions. Hopefully that should fix it.

@abala003
Copy link
Author

Correct. My Laptop is from 2008. The solution you suggested has fixed my issue. The script is able to recognize faces. Thank you.

@cuimiao187561
Copy link

face_recognition version:0.1.0
Python version:2.7.6
Operating System:ubantu 14.04
I encountered the same problem,When i run the code,
I get an error "Illegal Instruction" at the following line
gnss523@gnss523:~/Desktop/face_recognition-master/examples$ python find_faces_in_picture.py
Illegal instruction (core dumped)

@ageitgey
Copy link
Owner

Did you follow the instructions above?

@cuimiao187561
Copy link

I try this method

@ncbonde
Copy link

ncbonde commented Apr 13, 2017

i have got this error ...how to solve it??

` >>>import face_recognition

Traceback (most recent call last):
File "", line 1, in
File "/usr/local/lib/python2.7/dist-packages/face_recognition/init.py", line 7, in
from .api import load_image_file, face_locations, face_landmarks, face_encodings, compare_faces
File "/usr/local/lib/python2.7/dist-packages/face_recognition/api.py", line 21, in
face_encoder = dlib.face_recognition_model_v1(face_recognition_model)
AttributeError: 'module' object has no attribute 'face_recognition_model_v1`

@ageitgey
Copy link
Owner

AttributeError: 'module' object has no attribute 'face_recognition_model_v1 means that the version of dlib you are using is too old. You need to use dlib 19.4 or newer.

@Forsskieken
Copy link

Hi ageitgeym
Thanks for putting this togheter.
I've got error Process finished with exit code 132 (interrupted by signal 4: SIGILL)
when I run the examples, I also cheked if my processor was SSE4 capable (Intel® Xeon® Processor W3680) so before downloading dlib and compiling I wanted to know if there's something else I should do.

thanks for reading and your vmmachine

@ageitgey
Copy link
Owner

@Forsskieken The Intel Xeon W3680 (released 2010) doesn't support AVX instructions (released 2011). So that's why it's failing. Sorry! Your only option is to compile dlib without AVX enabled.

@Forsskieken
Copy link

Forsskieken commented May 15, 2017

Hi There the compilation succeeded but when I want to install it I get following error:

deeplearning@deep-learning-virtual-machine:~/Downloads/dlib-19.4$ python setup.py install
Traceback (most recent call last):
  File "setup.py", line 36, in <module>
    from setuptools.command.bdist_egg import bdist_egg as _bdist_egg
ImportError: No module named setuptools.command.bdist_egg

python3-setuptools is already the newest version (20.7.0-1).

I then did:

wget https://bootstrap.pypa.io/get-pip.py
sudo python get-pip.py
sudo python3 setup.py install

But how do I make sure pycharms uses this newly compiled version
Ok it seems "sudo python3 setup install" instead of "sudo python setup.." did the trick

Thanks and kind Regards

@ageitgey
Copy link
Owner

@Forsskieken The problem was python setup.py runs Python 2, which is totally separate and doesn't have access to any libraries you installed for Python 3. So running python3 setup.py instead is the key.

You can choose when version of Python you are using in Pycharm by going to your project settings and changing the interpreter it's using. Just make sure you choose Python 3 for any new projects you create.

@PreethiRe
Copy link

I am getting error like this..
import face_recognition
File "C:\Python27\lib\site-packages\face_recognition_init_.py", line 7, in
from .api import load_image_file, face_locations, face_landmarks, face_encodings, compare_faces, face_distance
File "C:\Python27\lib\site-packages\face_recognition\api.py", line 22, in
face_encoder =dlib.face_recognition_model_v1(face_recognition_model)
AttributeError: 'module' object has no attribute 'face_recognition_model_v1'

@ageitgey
Copy link
Owner

ageitgey commented Aug 7, 2017

@PreethiRe Please don't post on closed issues with new unrelated problems. In any case, the answer to your question is here in the README. You need to upgrade to a newer version of dlib.

@PreethiRe
Copy link

PreethiRe commented Aug 8, 2017 via email

@PreethiRe
Copy link

how to fix this..?
face_distances = face_recognition.face_distance(known_encodings, image_to_test_encoding)
AttributeError: module 'face_recognition' has no attribute 'face_distance'

@ageitgey
Copy link
Owner

ageitgey commented Aug 9, 2017

@PreethiRe Again, please don't post on closed issues with new unrelated problems. But I'm guessing you accidentally called your own file "face_recognition.py". You can't name your own file that or Python will find that file instead of the library you are trying to import.

@Soulzerz
Copy link

I have an acer aspire es1-512, I'm facing this error and have already tried the easy solution proposed. And don't know what else to do.
"Dlib was compiled to use AVX instructions, but these aren't available on your machine.
Illegal instruction (core dumped)"

@ageitgey
Copy link
Owner

@Soulzerz Try installing dlib by downloading the source code and running this command inside the source folder:

python3 setup.py install --no USE_AVX_INSTRUCTIONS --no DLIB_USE_CUDA

@Soulzerz
Copy link

@ageitgey Thanks, that made it work! 😄

@ageitgey
Copy link
Owner

Great! :)

@rjtmehta99
Copy link

rjtmehta99 commented Mar 25, 2018

Hi, I have been getting this error and I'm unable to understand why this keeps on happening.
Any help would be appreciated !

import face_recognition_models

image = face_recognition_models.load_image_file("abc.jpg")
face_locations = face_recognition_models.face_locations(image)

Traceback (most recent call last):

File "", line 3, in
image = face_recognition_models.load_image_file("abc.jpg")

AttributeError: module 'face_recognition_models' has no attribute 'load_image_file'

@akhilesh-pandey
Copy link

Hi, I am new to PyCharm. I needed a library face_recognition for my project so I installed it using pip install face_recognition. Now i am able to import it in ipython but not in PyCharm. I get

ImportError: No module named 'face_recognition'

Thanks for your help.

@salonimundra
Copy link

The issue is most likely that dlib was compiled with support for AVX and/or SSE4 instructions, but your cpu is too old to support them (pre-2011, I think).

The easiest solution is to download dlib and compile it yourself. But when you do that, you need to make one change.

Before compiling dlib, edit dlib's tools/python/CMakeLists.txt file from:

set(USE_SSE4_INSTRUCTIONS ON CACHE BOOL "Use SSE4 instructions")

to:

set(USE_SSE2_INSTRUCTIONS ON CACHE BOOL "Use SSE2 instructions")

And then compile and install dlib and the dlib python extensions. Hopefully that should fix it.

Hello, I didn't find this line in the specified location and also my macbook(macbook pro 2010 mid) supports SSE4 but doesn't support AVX. How do I build dlib taking into consideration this issue. I tried reinstalling dlib a lot of times but each time I get Illegal Instruction: 4.

@gujifly
Copy link

gujifly commented Mar 22, 2019

The issue is most likely that dlib was compiled with support for AVX and/or SSE4 instructions, but your cpu is too old to support them (pre-2011, I think).
The easiest solution is to download dlib and compile it yourself. But when you do that, you need to make one change.
Before compiling dlib, edit dlib's tools/python/CMakeLists.txt file from:

set(USE_SSE4_INSTRUCTIONS ON CACHE BOOL "Use SSE4 instructions")

to:

set(USE_SSE2_INSTRUCTIONS ON CACHE BOOL "Use SSE2 instructions")

And then compile and install dlib and the dlib python extensions. Hopefully that should fix it.

Hello, I didn't find this line in the specified location and also my macbook(macbook pro 2010 mid) supports SSE4 but doesn't support AVX. How do I build dlib taking into consideration this issue. I tried reinstalling dlib a lot of times but each time I get Illegal Instruction: 4.

I find this line in " ./dlib/dlib/cmake_utils/set_compiler_specific_options.cmake" ,so change and recomplie , it work!
image

@steffanjensen
Copy link

The issue is most likely that dlib was compiled with support for AVX and/or SSE4 instructions, but your cpu is too old to support them (pre-2011, I think).
The easiest solution is to download dlib and compile it yourself. But when you do that, you need to make one change.
Before compiling dlib, edit dlib's tools/python/CMakeLists.txt file from:

set(USE_SSE4_INSTRUCTIONS ON CACHE BOOL "Use SSE4 instructions")

to:

set(USE_SSE2_INSTRUCTIONS ON CACHE BOOL "Use SSE2 instructions")

And then compile and install dlib and the dlib python extensions. Hopefully that should fix it.

Hello, I didn't find this line in the specified location and also my macbook(macbook pro 2010 mid) supports SSE4 but doesn't support AVX. How do I build dlib taking into consideration this issue. I tried reinstalling dlib a lot of times but each time I get Illegal Instruction: 4.

I find this line in " ./dlib/dlib/cmake_utils/set_compiler_specific_options.cmake" ,so change and recomplie , it work!
image

works

@rakode
Copy link

rakode commented Feb 18, 2020

Buenos dias , la libreria face_recognition , confunde personas al identifcar , lo llame falso positivo , para cuando van a resolver este problema . Estoy haciendo un sistema de reconocimiento facial y me gustaria saber para cuando tienen la solucion.

@listofbanned
Copy link

Buenos dias , la libreria face_recognition , confunde personas al identifcar , lo llame falso positivo , para cuando van a resolver este problema . Estoy haciendo un sistema de reconocimiento facial y me gustaria saber para cuando tienen la solucion.

Hi!, could you give more details? It always happens? when it happens it's only for a moment or for a long time? is it just one face or many?
Hola!, puedes dar mas detalles? Pasa siempre? cuando pasa es solo por un momento u ocurre por largo rato?, pasa solo con una cara o con muchas?

@rakode
Copy link

rakode commented Feb 18, 2020 via email

@rakode
Copy link

rakode commented Feb 18, 2020 via email

@sumeetvaidya
Copy link

I have the issue in MacOS 12.0.1 (M1 chip). Error:
zsh: illegal hardware instruction
installation:
using python 3.7
conda install -c conda-forge dlib
pip install face_recognition

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests