sg <

TensorFlowインストール – ビルド未遂

概念

TensorFlowのインストールを行う。

Bazelをインストールしてソールをビルドしようと思っていたが、

https://www.tensorflow.org/install/source

公式ホームページを読むと、macとlinuxに関してはビルド済みかつテスト済みのパッケージを提供しているよ(だからビルドなんか不要じゃない?)、とのことであった。
ここは一つ手を抜いて、パッケージダウンロード&インストールする方針にする。

ハードウェア

  • CPU Intel Core i7 8700K BOX
  • MEM DDR4-2666 DIMM 16GB x 2
  • M/B GIGABYTE Z370 HD3
  • SSD Intel SSD 545s 512GB SSDSC2KW512G8X1
  • HDD SEAGATE ST4000DM004 4TB
  • G/B 玄人志向 GF-GTX1080Ti-E11GB/OC/DF

ソフトウェア

    • OS Ubuntu 18.04.1 LTS
    • NVIDIAドライバ  NVIDIA-SMI 390.87 Driver Version: 390.87
    • CUDA Toolkit 10.0
    • cuDNN v7.3.1 (Sept 28, 2018), for CUDA 10.0
    • OpenBLAS
      • libopenblas-base/bionic 0.2.20+ds-4 amd64
      • libopenblas-dev/bionic 0.2.20+ds-4 amd64
    • python-numpy (1:1.13.3-2ubuntu1)
    • python-scipy (0.19.1-2ubuntu1)
    • python-matplotlib (2.1.1-2ubuntu3)
    • python-yaml (3.12-1build2)
    • HDF5
      • python-h5py (2.7.1-2)
      • libhdf5-serial-dev (1.10.0-patch1+docs-4)
    • graphviz (2.40.1-2)
    • python-pip
    • python-dev
    • pydot-ng-2.0.0
    • Bazel
      • openjdk-8-jre:amd64 (8u181-b13-0ubuntu0.18.04.1)
      • bazel (0.18.0)
    • Python 2.7.15rc1
    • pip 9.0.1 from /usr/lib/python2.7/dist-packages (python 2.7)
    • virtualenv 15.1.0 (本稿でインストール)

足りないパッケージのインストール

公式を参考にインストールをすすめる。

https://www.tensorflow.org/install/pip?lang=python2

python --version
pip --version
virtualenv --version
~$ virtualenv --version
Command 'virtualenv' not found, but can be installed with:
sudo apt install virtualenv

virtualenvのみ足らなかったようなので、インストールする。

~$ sudo apt install virtualenv
パッケージリストを読み込んでいます... 完了
依存関係ツリーを作成しています                
状態情報を読み取っています... 完了
以下の追加パッケージがインストールされます:
  python3-distutils python3-lib2to3 python3-virtualenv
以下のパッケージが新たにインストールされます:
  python3-distutils python3-lib2to3 python3-virtualenv virtualenv
アップグレード: 0 個、新規インストール: 4 個、削除: 0 個、保留: 0 個。
265 kB のアーカイブを取得する必要があります。
この操作後に追加で 2,289 kB のディスク容量が消費されます。
続行しますか? [Y/n] y
取得:1 http://jp.archive.ubuntu.com/ubuntu bionic/main amd64 python3-lib2to3 all 3.6.5-3 [76.6 kB]
取得:2 http://jp.archive.ubuntu.com/ubuntu bionic/main amd64 python3-distutils all 3.6.5-3 [141 kB]
取得:3 http://jp.archive.ubuntu.com/ubuntu bionic/universe amd64 python3-virtualenv all 15.1.0+ds-1.1 [43.4 kB]
取得:4 http://jp.archive.ubuntu.com/ubuntu bionic/universe amd64 virtualenv all 15.1.0+ds-1.1 [4,476 B]
265 kB を 1秒 で取得しました (497 kB/s)
以前に未選択のパッケージ python3-lib2to3 を選択しています。
(データベースを読み込んでいます ... 現在 181890 個のファイルとディレクトリがインストールされています。)
.../python3-lib2to3_3.6.5-3_all.deb を展開する準備をしています ...
python3-lib2to3 (3.6.5-3) を展開しています...
以前に未選択のパッケージ python3-distutils を選択しています。
.../python3-distutils_3.6.5-3_all.deb を展開する準備をしています ...
python3-distutils (3.6.5-3) を展開しています...
以前に未選択のパッケージ python3-virtualenv を選択しています。
.../python3-virtualenv_15.1.0+ds-1.1_all.deb を展開する準備をしています ...
python3-virtualenv (15.1.0+ds-1.1) を展開しています...
以前に未選択のパッケージ virtualenv を選択しています。
.../virtualenv_15.1.0+ds-1.1_all.deb を展開する準備をしています ...
virtualenv (15.1.0+ds-1.1) を展開しています...
man-db (2.8.3-2) のトリガを処理しています ...
python3-lib2to3 (3.6.5-3) を設定しています ...
python3-distutils (3.6.5-3) を設定しています ...
python3-virtualenv (15.1.0+ds-1.1) を設定しています ...
virtualenv (15.1.0+ds-1.1) を設定しています ...

でも、仮想環境を作ってみようぜ(推奨)と記載があって、仮想環境がないとインストールできないわけではない。

ここは仮想環境は希望しないので、ひとまず無視しておこう。

TensorFlowインストール

~$ sudo pip install tensorflow-gpu
The directory '/home/administrator/.cache/pip/http' or its parent directory is not owned by the current user and the cache has been disabled. Please check the permissions and owner of that directory. If executing pip with sudo, you may want sudo's -H flag.
The directory '/home/administrator/.cache/pip' or its parent directory is not owned by the current user and caching wheels has been disabled. check the permissions and owner of that directory. If executing pip with sudo, you may want sudo's -H flag.
Collecting tensorflow-gpu
  Downloading https://files.pythonhosted.org/packages/ce/5c/33d3fc212cd392ceb4396d6b5280fdb426856b8d9702a710444370c50e8c/tensorflow_gpu-1.11.0-cp27-cp27mu-manylinux1_x86_64.whl (258.9MB)
    100% |████████████████████████████████| 258.9MB 8.1kB/s 
Collecting grpcio>=1.8.6 (from tensorflow-gpu)
  Downloading https://files.pythonhosted.org/packages/3d/15/b34114198a2bc9c9bb73b21e2b559468a1a68bb28b373d21da6e51d6204f/grpcio-1.15.0-cp27-cp27mu-manylinux1_x86_64.whl (9.4MB)
    100% |████████████████████████████████| 9.4MB 168kB/s 
Collecting protobuf>=3.6.0 (from tensorflow-gpu)
  Downloading https://files.pythonhosted.org/packages/b8/c2/b7f587c0aaf8bf2201405e8162323037fe8d17aa21d3c7dda811b8d01469/protobuf-3.6.1-cp27-cp27mu-manylinux1_x86_64.whl (1.1MB)
    100% |████████████████████████████████| 1.1MB 168kB/s 
Requirement already satisfied: enum34>=1.1.6 in /usr/lib/python2.7/dist-packages (from tensorflow-gpu)
Collecting gast>=0.2.0 (from tensorflow-gpu)
  Downloading https://files.pythonhosted.org/packages/5c/78/ff794fcae2ce8aa6323e789d1f8b3b7765f601e7702726f430e814822b96/gast-0.2.0.tar.gz
Requirement already satisfied: six>=1.10.0 in /usr/lib/python2.7/dist-packages (from tensorflow-gpu)
Collecting absl-py>=0.1.6 (from tensorflow-gpu)
  Downloading https://files.pythonhosted.org/packages/16/db/cce5331638138c178dd1d5fb69f3f55eb3787a12efd9177177ae203e847f/absl-py-0.5.0.tar.gz (90kB)
    100% |████████████████████████████████| 92kB 276kB/s 
Requirement already satisfied: wheel in /usr/lib/python2.7/dist-packages (from tensorflow-gpu)
Collecting keras-preprocessing>=1.0.3 (from tensorflow-gpu)
  Downloading https://files.pythonhosted.org/packages/fc/94/74e0fa783d3fc07e41715973435dd051ca89c550881b3454233c39c73e69/Keras_Preprocessing-1.0.5-py2.py3-none-any.whl
Collecting termcolor>=1.1.0 (from tensorflow-gpu)
  Downloading https://files.pythonhosted.org/packages/8a/48/a76be51647d0eb9f10e2a4511bf3ffb8cc1e6b14e9e4fab46173aa79f981/termcolor-1.1.0.tar.gz
Collecting keras-applications>=1.0.5 (from tensorflow-gpu)
  Downloading https://files.pythonhosted.org/packages/3f/c4/2ff40221029f7098d58f8d7fb99b97e8100f3293f9856f0fb5834bef100b/Keras_Applications-1.0.6-py2.py3-none-any.whl (44kB)
    100% |████████████████████████████████| 51kB 481kB/s 
Requirement already satisfied: numpy>=1.13.3 in /usr/lib/python2.7/dist-packages (from tensorflow-gpu)
Collecting tensorboard<1.12.0,>=1.11.0 (from tensorflow-gpu)
  Downloading https://files.pythonhosted.org/packages/76/f9/e62022d00940e4df9a629d6bfe42eb28907bb35808db62bb9e8b69ea5ef3/tensorboard-1.11.0-py2-none-any.whl (3.0MB)
    100% |████████████████████████████████| 3.0MB 296kB/s 
Collecting backports.weakref>=1.0rc1 (from tensorflow-gpu)
  Downloading https://files.pythonhosted.org/packages/88/ec/f598b633c3d5ffe267aaada57d961c94fdfa183c5c3ebda2b6d151943db6/backports.weakref-1.0.post1-py2.py3-none-any.whl
Requirement already satisfied: setuptools<=39.1.0 in /usr/lib/python2.7/dist-packages (from tensorflow-gpu) Collecting mock>=2.0.0 (from tensorflow-gpu)
  Downloading https://files.pythonhosted.org/packages/e6/35/f187bdf23be87092bd0f1200d43d23076cee4d0dec109f195173fd3ebc79/mock-2.0.0-py2.py3-none-any.whl (56kB)
    100% |████████████████████████████████| 61kB 478kB/s 
Collecting astor>=0.6.0 (from tensorflow-gpu)
  Downloading https://files.pythonhosted.org/packages/35/6b/11530768cac581a12952a2aad00e1526b89d242d0b9f59534ef6e6a1752f/astor-0.7.1-py2.py3-none-any.whl
Collecting futures>=2.2.0 (from grpcio>=1.8.6->tensorflow-gpu)
  Downloading https://files.pythonhosted.org/packages/2d/99/b2c4e9d5a30f6471e410a146232b4118e697fa3ffc06d6a65efde84debd0/futures-3.2.0-py2-none-any.whl
Requirement already satisfied: h5py in /usr/lib/python2.7/dist-packages (from keras-applications>=1.0.5->tensorflow-gpu)
Collecting werkzeug>=0.11.10 (from tensorboard<1.12.0,>=1.11.0->tensorflow-gpu)
  Downloading https://files.pythonhosted.org/packages/20/c4/12e3e56473e52375aa29c4764e70d1b8f3efa6682bef8d0aae04fe335243/Werkzeug-0.14.1-py2.py3-none-any.whl (322kB)
    100% |████████████████████████████████| 327kB 163kB/s 
Collecting markdown>=2.6.8 (from tensorboard<1.12.0,>=1.11.0->tensorflow-gpu)
  Downloading https://files.pythonhosted.org/packages/7a/6b/5600647404ba15545ec37d2f7f58844d690baf2f81f3a60b862e48f29287/Markdown-3.0.1-py2.py3-none-any.whl (89kB)
    100% |████████████████████████████████| 92kB 251kB/s 
Collecting funcsigs>=1; python_version < "3.3" (from mock>=2.0.0->tensorflow-gpu)
  Downloading https://files.pythonhosted.org/packages/69/cb/f5be453359271714c01b9bd06126eaf2e368f1fddfff30818754b5ac2328/funcsigs-1.0.2-py2.py3-none-any.whl
Collecting pbr>=0.11 (from mock>=2.0.0->tensorflow-gpu)
  Downloading https://files.pythonhosted.org/packages/ca/81/4e8230c5648ea6d85d90ec3babc3dcc1c46d890f2f26b3e2b374819274dd/pbr-5.0.0-py2.py3-none-any.whl (106kB)
    100% |████████████████████████████████| 112kB 388kB/s 
Installing collected packages: futures, grpcio, protobuf, gast, absl-py, keras-preprocessing, termcolor, keras-applications, werkzeug, markdown, tensorboard, backports.weakref, funcsigs, pbr, mock, astor, tensorflow-gpu
  Running setup.py install for gast ... done
  Running setup.py install for absl-py ... done
  Running setup.py install for termcolor ... done
Successfully installed absl-py-0.5.0 astor-0.7.1 backports.weakref-1.0.post1 funcsigs-1.0.2 futures-3.2.0 gast-0.2.0 grpcio-1.15.0 keras-applications-1.0.6 keras-preprocessing-1.0.5 markdown-3.0.1 mock-2.0.0 pbr-5.0.0 protobuf-3.6.1 tensorboard-1.11.0 tensorflow-gpu-1.11.0 termcolor-1.1.0 werkzeug-0.14.1

Theanoインストール

以前用いられていたテンソル計算を行うライブラリ。TensorFlowに取って代わられたのかどうかわからないが、開発は中止されている。あえてのインストールは不要であろう。

Kerasのインストール

ディープラーニング初心者向けのフロントエンドで有名。

~$ sudo pip install keras
The directory '/home/administrator/.cache/pip/http' or its parent directory is not owned by the current user and the cache has been disabled. Please check the permissions and owner of that directory. If executing pip with sudo, you may want sudo's -H flag.
The directory '/home/administrator/.cache/pip' or its parent directory is not owned by the current user and caching wheels has been disabled. check the permissions and owner of that directory. If executing pip with sudo, you may want sudo's -H flag.
Collecting keras
  Downloading https://files.pythonhosted.org/packages/5e/10/aa32dad071ce52b5502266b5c659451cfd6ffcbf14e6c8c4f16c0ff5aaab/Keras-2.2.4-py2.py3-none-any.whl (312kB)
    100% |████████████████████████████████| 317kB 1.0MB/s 
Requirement already satisfied: keras-applications>=1.0.6 in /usr/local/lib/python2.7/dist-packages (from keras)
Requirement already satisfied: numpy>=1.9.1 in /usr/lib/python2.7/dist-packages (from keras)
Requirement already satisfied: scipy>=0.14 in /usr/lib/python2.7/dist-packages (from keras)
Requirement already satisfied: keras-preprocessing>=1.0.5 in /usr/local/lib/python2.7/dist-packages (from keras)
Requirement already satisfied: h5py in /usr/lib/python2.7/dist-packages (from keras)
Requirement already satisfied: pyyaml in /usr/lib/python2.7/dist-packages (from keras)
Requirement already satisfied: six>=1.9.0 in /usr/lib/python2.7/dist-packages (from keras)
Installing collected packages: keras
Successfully installed keras-2.2.4

コメントを残す

メールアドレスが公開されることはありません。 * が付いている欄は必須項目です

このサイトはスパムを低減するために Akismet を使っています。コメントデータの処理方法の詳細はこちらをご覧ください