Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Illegal instruction: 4 when importing tensorflow in python 3.6

I installed Tensorflow on macOS with Virtualenv. Everything went okay ("Successfully installed six-1.11.0 tensorflow-1.6.0" is the last output of the terminal, once i run the command pip3 install --upgrade tensorflow). So, with the virtualenv activated, I typed: python3 and then import tensorflow as tf but it outputs the error Illegal instruction: 4 and quits python.

I looked around to see if anybody else had encountered the same issue, but I didn't find much, apart from this question, which doesn't provide a solution. I read this answer explaining what Illegal instruction means, the point is that I'm on the latest version of macOS High Sierra:

enter image description here

Am I misunderstanding what the answer is referring to?

Do you know how I could solve this issue? Or hopefully a workaround, so that I can start using tensorflow.

Thank you in advance.

like image 563
Jules Avatar asked Mar 03 '18 14:03

Jules


1 Answers

I had the same issue, so what I did was uninstalled tensorflow 1.6. installed

pip install -Iv tensorflow==1.5
pip install -Iv numpy==1.13

seems to be fine now, my guess is there was the latest bug in tensorflow 1.6.

To make sure it's compatible with the pandas, you can do: pip install -Iv numpy==1.13.3

like image 113
dfresh22 Avatar answered Nov 14 '22 22:11

dfresh22