LoginSignup
9
5

More than 3 years have passed since last update.

Keras/Tensorflowをimportしたら"Illegal instruction (コアダンプ)"と出た時の対処法

Last updated at Posted at 2018-08-18

症状


import keras #バックエンドがTensorflow
#もしくは
import tensorflow

と打つと

Illegal instruction (コアダンプ)

と言われてPythonインタプリタごと落ちる。

発生環境

ある程度古いCPUを搭載したマシン(AVX命令をサポートしていないCPU)で
Tensorflowバージョン1.6以上を使用
私の環境ではAMD A8-3850 with RadeonHD 6550D

原因

おそらくTensorflow==1.6からpipで降ってくるものがAVX命令に対応したCPUのものになってしまった。

対処方法

Tensorflowのバージョンを1.5にダウングレードします。

既存のTensorflowをアンインストールします。

pip uninstall tensorflow

tensorflow v1.5(以下)を指定してインストールします。

pip install tensorflow==1.5

確認

Pythonのインタプリタに入って


import keras #バックエンドがTensorflow
#OR
import tensorflow

と打ち、前述した症状が現れなければ成功です。

追記

condaを使ったインストールならTensorflow 1.5以降でも大丈夫なようです。
conda(anaconda,Miniconda)をインストール済みの方は以下のようにしてください。

pip uninstall tensorflow #既にTensorflowをインストール済みの方はこちらも実行

conda install tensorflow #バージョンを指定しなくても良い
9
5
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
9
5