Illegal hardware instruction when trying to import tensorflow

11,615

I just found this:

Illegal instruction (core dumped) after running import tensorflow

This problem seems to be caused by a set of instructions that are not hardware implemented in some older processors (AVX instruction set). Since they are not implemented in hardware, there's no real fix for this problem.

If I understood it correctly, and a workaround is to downgrade tensorflow from 1.6.0 to 1.5.0, this also applies to the GPU version. It worked for me.

I Will mark this as answered for now, but if anyone have any good idea how to get version 1.6.0 working, please let me know.

Share:
11,615
inblank
Author by

inblank

One always in the search for knowledge.

Updated on June 04, 2022

Comments

  • inblank
    inblank almost 2 years

    I just installed tensorflow using the instructions for the virtualenv method. The installation process went smoothly, so I don't think there was any problem there. After installation I proceeded to try and import it to validate that everything is ok, and I got the following message:

    [1]    4492 illegal hardware instruction (core dumped)  python
    

    This happened after I use the following command using th python interactive console:

    import tensorflow as tf
    

    I tried using the link with pip to reinstall it, but no success.

    I have created the virtualenv with:

    python3.6 -m venv venv
    

    After this didn't work (as in it generated the same error) I tried with:

    virtualenv --system-site-packages -p python3.6 venv
    

    I got the same result.

    The command I used to install tensorflow was:

    pip install tensorflow
    

    As you can see, I intend to install the CPU-only version.

    I read some think about other frameworks and technologies that show this message em the hardware does not have the instruction implemented, so there's nothing to do about that except getting new hardware.

    Is there any way to fix this issue? I already tried some different installation methods, but none of then seen to work

    As for the system specifications:

    OS = Ubuntu 16.04 x64 LTS
    Python = Python 3.6
    pip version = 9.0.1
    tensorflow version = TensorFlow 1.6.0
    CPU = Intel Core 2 Quad Q6600  @2.40GHz
    

    OBS: I do have a GPU on this machine, but I don't think that tensorflow will run on it, since it is kind of old. It's a Nvidia 8800 GTS 512.

    I appreciate any help, and if there's any missing info, please let me know.

    • troymyname00
      troymyname00 about 6 years
      If you're using Python3, shouldn't you be using pip3 instead of pip?
    • inblank
      inblank about 6 years
      As I am in a virtualenv, so when I call pip, itis already linked with pip3
  • Manikandan Balasubramanian
    Manikandan Balasubramanian almost 6 years
    I too thought avx flag is the reason. Even after enabling the fpu, avx, avx2 flags in VM, it is still the same. If I import tensorflow (1.7) in python console, exited with the message Illegal Instruction
  • lampShadesDrifter
    lampShadesDrifter almost 6 years
    Can confirm that this solution (downgrading, pip install tensorflow=1.5) works for CentOS 7.
  • David 天宇 Wong
    David 天宇 Wong over 5 years
    for what is worth, mine was because I was using an uninitialized pointer in C