I created a fresh virtual environment: virtualenv -p python2 test_venv/ And installed tensorflow: pip install —upgrade —no-cache-dir tensorflow
import tensorflow gives me Illegal instruction (core dumped)
Please help me understand what’s going on and how I can fix it. Thank you.
CPU information:
Stacktrace obtained with gdb:
5 Answers 5
I would use older version. Looks like your CPU does not support AVX instructions.
Quoting from their Release Page
You have atleast two options:
Use tensorflow 1.5 or older
Build from source
Regarding your concern for differences, you will miss out on new features, but most basic features and documentations are not that different.
Unfortunately, 1.6 has given many people the same error. I received it after installing 1.7 on a machine with an old Core2 CPU. I’ve settled with 1.5, as I can’t fit the big graphics card in the machine with the up-to-date processor!
As explained in the accepted answer, this issue can be fixed either by installing older version of TensorFlow (v1.5) or building from source. Between the two, building from source is arguably a preferred route despite the additional effort. Granted that the binary contains the most updated components of TensorFlow.
This article explains how to build TensorFlow from sources and optimizes for the older CPU. The key is in detecting the CPU flags and enable all the CPU flags for optimization when configuring the build.
The following command is used to detect common CPU optimization flags:
If by executing the command, -mavx and/or -mavx2 is not shown, it can be confirmed that AVX support is missing and the source build should be done with other optimization flags displayed in the output.
In a related article, the common root cause of this issue is discussed in more details, which is provided as an additional reference.
I am importing tensorflow in my ubuntu python using following commands-
And the program exits. Please specify the solution.
4 Answers 4
I had the same problem and had to downgrade tensorflow to 1.5.0:
Edit: As @Tobsta points out in the comments, the other option is to compile the binaries from source. The precompiled binaries of versions >1.5 use AVX instructions that are not supported by older CPUs
Downgrading TensorFlow is arguably not the best route to take. Installing from source may give some initial overhead but will pay off in the long run. If you are looking for the instruction to build the binaries from source with most of the CPU optimization, this article may help.
I see same message on my PC / Celeron N4000.
I successed to build TensorFlow v1.14.0 without AVX instruction. (Just build TensorFlow on CeleronN4000)
In my case, used Python 3.6.8 .
I also tested with Python 2.7 .
About Python 3.5 , I not tested.
Maybe possible to use similar way, I think.
Еще можно попробовать дать права суперпользователя установщику
При повторной установке после обновления pip предупреждение больше не вылетает?