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 · 21 comments

Comments

Projects
None yet
8 participants
@abala003

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

This comment has been minimized.

Show comment
Hide comment
@ageitgey

ageitgey Mar 17, 2017

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.

Owner

ageitgey commented Mar 17, 2017

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

This comment has been minimized.

Show comment
Hide comment
@abala003

abala003 Mar 18, 2017

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

abala003 commented Mar 18, 2017

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

@cuimiao187561

This comment has been minimized.

Show comment
Hide comment
@cuimiao187561

cuimiao187561 Mar 22, 2017

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)

cuimiao187561 commented Mar 22, 2017

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

This comment has been minimized.

Show comment
Hide comment
@ageitgey

ageitgey Mar 22, 2017

Owner

Did you follow the instructions above?

Owner

ageitgey commented Mar 22, 2017

Did you follow the instructions above?

@cuimiao187561

This comment has been minimized.

Show comment
Hide comment
@cuimiao187561

cuimiao187561 Mar 23, 2017

I try this method

cuimiao187561 commented Mar 23, 2017

I try this method

@ncbonde

This comment has been minimized.

Show comment
Hide comment
@ncbonde

ncbonde 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`

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

This comment has been minimized.

Show comment
Hide comment
@ageitgey

ageitgey Apr 13, 2017

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.

Owner

ageitgey commented Apr 13, 2017

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

This comment has been minimized.

Show comment
Hide comment
@Forsskieken

Forsskieken Apr 19, 2017

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

Forsskieken commented Apr 19, 2017

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

This comment has been minimized.

Show comment
Hide comment
@ageitgey

ageitgey Apr 19, 2017

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.

Owner

ageitgey commented Apr 19, 2017

@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

This comment has been minimized.

Show comment
Hide comment
@Forsskieken

Forsskieken 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

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

This comment has been minimized.

Show comment
Hide comment
@ageitgey

ageitgey May 15, 2017

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.

Owner

ageitgey commented May 15, 2017

@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

This comment has been minimized.

Show comment
Hide comment
@PreethiRe

PreethiRe Aug 7, 2017

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'

PreethiRe commented Aug 7, 2017

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

This comment has been minimized.

Show comment
Hide comment
@ageitgey

ageitgey Aug 7, 2017

Owner

@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.

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

This comment has been minimized.

Show comment
Hide comment
@PreethiRe

PreethiRe Aug 8, 2017

PreethiRe commented Aug 8, 2017

@PreethiRe

This comment has been minimized.

Show comment
Hide comment
@PreethiRe

PreethiRe Aug 9, 2017

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'

PreethiRe commented Aug 9, 2017

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

This comment has been minimized.

Show comment
Hide comment
@ageitgey

ageitgey Aug 9, 2017

Owner

@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.

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

This comment has been minimized.

Show comment
Hide comment
@Soulzerz

Soulzerz Jan 20, 2018

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)"

Soulzerz commented Jan 20, 2018

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

This comment has been minimized.

Show comment
Hide comment
@ageitgey

ageitgey Jan 22, 2018

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
Owner

ageitgey commented Jan 22, 2018

@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

This comment has been minimized.

Show comment
Hide comment
@Soulzerz

Soulzerz Jan 22, 2018

@ageitgey Thanks, that made it work! 😄

Soulzerz commented Jan 22, 2018

@ageitgey Thanks, that made it work! 😄

@ageitgey

This comment has been minimized.

Show comment
Hide comment
@ageitgey

ageitgey Jan 22, 2018

Owner

Great! :)

Owner

ageitgey commented Jan 22, 2018

Great! :)

@rjtmehta99

This comment has been minimized.

Show comment
Hide comment
@rjtmehta99

rjtmehta99 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'

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'

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment