I created a fresh virtual environment: virtualenv -p python2 test_venv/
And installed tensorflow: pip install --upgrade --no-cache-dir tensorflow
I had a similar issue and it turned out that it is due to I have slightly old CPU and that doesn't work very well with 1.6+ versions of TensorFlow https://www.tensorflow.org/install/source
Note: Starting with TensorFlow 1.6, binaries use AVX instructions which may not run on older CPUs.
So as mentioned before you can either install TensorFlow 1.5, or if you still want the latest version of TF, you will need to install it with conda instead (both solutions worked with me)
For conda installation:
conda create -n tensorflow
conda install tensorflow-gpu -n tensorflow
https://github.com/tensorflow/tensorflow/issues/17411
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!
I would use older version. Looks like your CPU does not support AVX instructions.
Quoting from their Release Page
Breaking Changes
Prebuilt binaries are now built against CUDA 9.0 and cuDNN 7.
Prebuilt binaries will use AVX instructions. This may break TF on older CPUs.
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.
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:
$ grep flags -m1 /proc/cpuinfo | cut -d ":" -f 2 | tr '[:upper:]' '[:lower:]' | { read FLAGS; OPT="-march=native"; for flag in $FLAGS; do case "$flag" in "sse4_1" | "sse4_2" | "ssse3" | "fma" | "cx16" | "popcnt" | "avx" | "avx2") OPT+=" -m$flag";; esac; done; MODOPT=${OPT//_/\.}; echo "$MODOPT"; }
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.
The following steps worked for me. (remove exsisting tensorflow)
inside conda virtual env
step 1: install keras-application using pip
step 2: install tensorflow (no need to downgrade)
There is an issue on github about this, which seems to have gotten little interest from the tensorflow team, unfortunately.
There are a few community builds around the web that might work depending on your situation: