無邪気にPythonを3.7に上げたらTensorflowが使えなくなった問題

タイトルの通りで、Python 3.7(Anaconda)をアップグレードしたら、TensorFlowが使えなくなった、いや正確に言うとTensorFlowのインストールが出来なくなったという問題の顛末を書いておきます。ちなみに使っている環境はMac OS X Mojaveです。

pip install tensorflow

だとエラーになるので、代わりに

pip install --upgrade https://storage.googleapis.com/tensorflow/mac/cpu/tensorflow-1.12.0-py3-none-any.whl

とやると、インストールは出来ました。正式リリースがいつ出るんじゃい?というのが半年ぐらい続いているようなので、本当はPythonを勢いで上げずに3.6でもう少しとどまっているのが正解だと思います。

一応、フルのログを残しておきます。

$ pip --version
pip 18.1 from /Users/xxxxxx/anaconda3/lib/python3.7/site-packages/pip (python 3.7)
$ python --version
Python 3.7.1
$ pip install tensorflow
Collecting tensorflow
  Could not find a version that satisfies the requirement tensorflow (from versions: )
No matching distribution found for tensorflow
$ pip install --upgrade https://storage.googleapis.com/tensorflow/mac/cpu/tensorflow-1.12.0-py3-none-any.whl
Collecting tensorflow==1.12.0 from https://storage.googleapis.com/tensorflow/mac/cpu/tensorflow-1.12.0-py3-none-any.whl
  Downloading https://storage.googleapis.com/tensorflow/mac/cpu/tensorflow-1.12.0-py3-none-any.whl (62.0MB)
    100% |████████████████████████████████| 62.0MB 376kB/s 
Collecting keras-applications>=1.0.6 (from tensorflow==1.12.0)
  Downloading https://files.pythonhosted.org/packages/90/85/64c82949765cfb246bbdaf5aca2d55f400f792655927a017710a78445def/Keras_Applications-1.0.7-py2.py3-none-any.whl (51kB)
    100% |████████████████████████████████| 61kB 7.7MB/s 
Collecting keras-preprocessing>=1.0.5 (from tensorflow==1.12.0)
  Downloading https://files.pythonhosted.org/packages/14/8d/443591dd9f42cdde966a14ea2d59e7a781b77a8f09652288af61bec93b81/Keras_Preprocessing-1.0.8-py2.py3-none-any.whl (59kB)
    100% |████████████████████████████████| 61kB 10.9MB/s 
Requirement already satisfied, skipping upgrade: wheel>=0.26 in ./anaconda3/lib/python3.7/site-packages (from tensorflow==1.12.0) (0.32.3)
Collecting grpcio>=1.8.6 (from tensorflow==1.12.0)
  Downloading https://files.pythonhosted.org/packages/cd/9d/e707b8a041171ca436c066a544f59a090a700c6742f323a074fc5989297f/grpcio-1.18.0-cp37-cp37m-macosx_10_9_x86_64.whl (1.8MB)
    100% |████████████████████████████████| 1.8MB 12.5MB/s 
Requirement already satisfied, skipping upgrade: numpy>=1.13.3 in ./anaconda3/lib/python3.7/site-packages (from tensorflow==1.12.0) (1.15.4)
Collecting tensorboard<1.13.0,>=1.12.0 (from tensorflow==1.12.0)
  Downloading https://files.pythonhosted.org/packages/07/53/8d32ce9471c18f8d99028b7cef2e5b39ea8765bd7ef250ca05b490880971/tensorboard-1.12.2-py3-none-any.whl (3.0MB)
    100% |████████████████████████████████| 3.1MB 6.3MB/s 
Collecting protobuf>=3.6.1 (from tensorflow==1.12.0)
  Downloading https://files.pythonhosted.org/packages/18/e7/785830a65d1f1faba7dccfa8314f7afded1db8cc2860218226ba4b3f6150/protobuf-3.6.1-cp37-cp37m-macosx_10_6_intel.macosx_10_9_intel.macosx_10_9_x86_64.macosx_10_10_intel.macosx_10_10_x86_64.whl (1.2MB)
    100% |████████████████████████████████| 1.2MB 13.3MB/s 
Collecting gast>=0.2.0 (from tensorflow==1.12.0)
  Downloading https://files.pythonhosted.org/packages/4e/35/11749bf99b2d4e3cceb4d55ca22590b0d7c2c62b9de38ac4a4a7f4687421/gast-0.2.2.tar.gz
Collecting termcolor>=1.1.0 (from tensorflow==1.12.0)
  Using cached https://files.pythonhosted.org/packages/8a/48/a76be51647d0eb9f10e2a4511bf3ffb8cc1e6b14e9e4fab46173aa79f981/termcolor-1.1.0.tar.gz
Collecting astor>=0.6.0 (from tensorflow==1.12.0)
  Using cached https://files.pythonhosted.org/packages/35/6b/11530768cac581a12952a2aad00e1526b89d242d0b9f59534ef6e6a1752f/astor-0.7.1-py2.py3-none-any.whl
Collecting absl-py>=0.1.6 (from tensorflow==1.12.0)
  Downloading https://files.pythonhosted.org/packages/31/bc/ab68120d1d89ae23b694a55fe2aece2f91194313b71f9b05a80b32d3c24b/absl-py-0.7.0.tar.gz (96kB)
    100% |████████████████████████████████| 102kB 16.6MB/s 
Requirement already satisfied, skipping upgrade: six>=1.10.0 in ./anaconda3/lib/python3.7/site-packages (from tensorflow==1.12.0) (1.12.0)
Requirement already satisfied, skipping upgrade: h5py in ./anaconda3/lib/python3.7/site-packages (from keras-applications>=1.0.6->tensorflow==1.12.0) (2.8.0)
Collecting markdown>=2.6.8 (from tensorboard<1.13.0,>=1.12.0->tensorflow==1.12.0)
  Downloading https://files.pythonhosted.org/packages/7a/6b/5600647404ba15545ec37d2f7f58844d690baf2f81f3a60b862e48f29287/Markdown-3.0.1-py2.py3-none-any.whl (89kB)
    100% |████████████████████████████████| 92kB 18.0MB/s 
Requirement already satisfied, skipping upgrade: werkzeug>=0.11.10 in ./anaconda3/lib/python3.7/site-packages (from tensorboard<1.13.0,>=1.12.0->tensorflow==1.12.0) (0.14.1)
Requirement already satisfied, skipping upgrade: setuptools in ./anaconda3/lib/python3.7/site-packages (from protobuf>=3.6.1->tensorflow==1.12.0) (40.6.3)
Building wheels for collected packages: gast, termcolor, absl-py
  Running setup.py bdist_wheel for gast ... done
  Stored in directory: /Users/ken/Library/Caches/pip/wheels/5c/2e/7e/a1d4d4fcebe6c381f378ce7743a3ced3699feb89bcfbdadadd
  Running setup.py bdist_wheel for termcolor ... done
  Stored in directory: /Users/ken/Library/Caches/pip/wheels/7c/06/54/bc84598ba1daf8f970247f550b175aaaee85f68b4b0c5ab2c6
  Running setup.py bdist_wheel for absl-py ... done
  Stored in directory: /Users/ken/Library/Caches/pip/wheels/90/db/f8/2c3101f72ef1ad434e4662853174126ce30201a3e163dcbeca
Successfully built gast termcolor absl-py
Installing collected packages: keras-applications, keras-preprocessing, grpcio, markdown, protobuf, tensorboard, gast, termcolor, astor, absl-py, tensorflow
Successfully installed absl-py-0.7.0 astor-0.7.1 gast-0.2.2 grpcio-1.18.0 keras-applications-1.0.7 keras-preprocessing-1.0.8 markdown-3.0.1 protobuf-3.6.1 tensorboard-1.12.2 tensorflow-1.12.0 termcolor-1.1.0
$ 

scikit-learnとTensorFlowによる実践機械学習

scikit-learnとTensorFlowによる実践機械学習

PythonとKerasによるディープラーニング

PythonとKerasによるディープラーニング