下のサイトで、更新中。
このページは、失敗のログとして保存。
Docker の導入
下のサイトを参照
https://mseeeen.msen.jp/activate-docker-and-start-centos7/
sudo yum -y install docker net-tools
sudo systemctl start docker
sudo systemctl enable docker
docker pull centos:centos7
docker run --privileged -d --name TFTEST centos:centos7 /sbin/init
docker exec -it TFTEST /bin/bash
以降は、コンテナ内で作業
前提 ライブラリを追加
個別に導入
yum -y install gcc wget curl-devel expat-devel gettext-devel openssl-devel zlib-devel perl-ExtUtils-MakeMaker autoconf bzip2 bzip2-devel libbz2-dev openssl openssl-devel readline readline-devel
or
開発ツール一式を導入
yum -y groupinstall "Development Tools"
yum -y install readline-devel zlib-devel bzip2-devel sqlite-devel openssl-devel
Git の導入
yum で導入
yum -y install git
or
コンパイルで導入
wget https://www.kernel.org/pub/software/scm/git/git-2.9.5.tar.gz
tar vfx git-2.9.5.tar.gz
cd git-2.9.5
make configure
./configure --prefix=/usr
make all
make install
cd
pyenv の導入
下を参照。ありがとうございます!
https://qiita.com/agumon/items/4d7826c2c39d0af868bd
git clone https://github.com/pyenv/pyenv.git ~/.pyenv
echo 'export PYENV_ROOT="$HOME/.pyenv"' >> ~/.bash_profile
echo 'export PATH="$PYENV_ROOT/bin:$PATH"' >> ~/.bash_profile
echo 'eval "$(pyenv init -)"' >> ~/.bash_profile
source ~/.bash_profile
pyenv-virtualenv の導入
https://github.com/pyenv/pyenv-virtualenv
git clone https://github.com/yyuu/pyenv-virtualenv.git ~/.pyenv/plugins/pyenv-virtualenv
echo 'eval "$(pyenv virtualenv-init -)"' >> ~/.bash_profile
exec $SHELL -l
pyenv へanaconda3 を導入
※pyenv install は、私の環境では、5分程度の時間がかかるため、小休憩を取りましょう。python も同じく。
pyenv install anaconda3-4.3.1
echo 'PATH="$PYENV_ROOT/versions/anaconda3-4.3.1/bin:$PATH"' >> ~/.bash_profile
source ~/.bash_profile
pyenv へ python3 を導入
pyenv install 3.6.6
pyenv global 3.6.6
pyenv rehash
pyenv の仮想環境を構築
conda create -n py36 python=3.6 anaconda
途中で、"y" を入力
その後、5分くらいかかるので、小休憩を取って下さい
source activate py36
下の図のようになれば成功
以降は、上の図のように py36 環境で実行する。
Tensorflow の導入
pip install --ignore-installed --upgrade https://storage.googleapis.com/tensorflow/mac/cpu/tensorflow-1.0.1-py3-none-any.whl
curl -LO https://raw.githubusercontent.com/HaHatake/tensorflow/master/tensorflowhello.py
実行後、下のエラーが発生
python tensorflowhello.py
Traceback (most recent call last):
File "/root/.pyenv/versions/anaconda3-4.3.1/envs/py36/lib/python3.6/site-packages/tensorflow/python/init.py", line 61, in
from tensorflow.python import pywrap_tensorflow
File "/root/.pyenv/versions/anaconda3-4.3.1/envs/py36/lib/python3.6/site-packages/tensorflow/python/pywrap_tensorflow.py", line 28, in
pywrap_tensorflow = swig_import_helper()
File "/root/.pyenv/versions/anaconda3-4.3.1/envs/py36/lib/python3.6/site-packages/tensorflow/python/pywrap_tensorflow.py", line 24, in swig_import_helper
_mod = imp.load_module('_pywrap_tensorflow', fp, pathname, description)
File "/root/.pyenv/versions/anaconda3-4.3.1/envs/py36/lib/python3.6/imp.py", line 242, in load_module
return load_dynamic(name, filename, file)
File "/root/.pyenv/versions/anaconda3-4.3.1/envs/py36/lib/python3.6/imp.py", line 342, in load_dynamic
return _load(spec)
ImportError: /root/.pyenv/versions/anaconda3-4.3.1/envs/py36/lib/python3.6/site-packages/tensorflow/python/_pywrap_tensorflow.so: invalid ELF header
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "tensorflowhello.py", line 1, in
import tensorflow
File "/root/.pyenv/versions/anaconda3-4.3.1/envs/py36/lib/python3.6/site-packages/tensorflow/init.py", line 24, in
from tensorflow.python import *
File "/root/.pyenv/versions/anaconda3-4.3.1/envs/py36/lib/python3.6/site-packages/tensorflow/python/init.py", line 72, in
raise ImportError(msg)
ImportError: Traceback (most recent call last):
File "/root/.pyenv/versions/anaconda3-4.3.1/envs/py36/lib/python3.6/site-packages/tensorflow/python/init_.py", line 61, in
from tensorflow.python import pywrap_tensorflow
File "/root/.pyenv/versions/anaconda3-4.3.1/envs/py36/lib/python3.6/site-packages/tensorflow/python/pywrap_tensorflow.py", line 28, in
_pywrap_tensorflow = swig_import_helper()
File "/root/.pyenv/versions/anaconda3-4.3.1/envs/py36/lib/python3.6/site-packages/tensorflow/python/pywrap_tensorflow.py", line 24, in swig_import_helper
_mod = imp.load_module('_pywrap_tensorflow', fp, pathname, description)
File "/root/.pyenv/versions/anaconda3-4.3.1/envs/py36/lib/python3.6/imp.py", line 242, in load_module
return load_dynamic(name, filename, file)
File "/root/.pyenv/versions/anaconda3-4.3.1/envs/py36/lib/python3.6/imp.py", line 342, in load_dynamic
return _load(spec)
ImportError: /root/.pyenv/versions/anaconda3-4.3.1/envs/py36/lib/python3.6/site-packages/tensorflow/python/_pywrap_tensorflow.so: invalid ELF header
Failed to load the native TensorFlow runtime.
See https://github.com/tensorflow/tensorflow/blob/master/tensorflow/g3doc/get_started/os_setup.md#import_error
for some common reasons and solutions. Include the entire stack trace
above this error message when asking for help.
指示通り、下のサイトを参照
https://github.com/tensorflow/tensorflow/blob/master/tensorflow/g3doc/get_started/os_setup.md#import_error
下のサイトを参考に改めてやってみるか。。。
https://k-side.hatenablog.jp/entry/2016/09/07/115412
よく見れば、インストールするソフトを間違ってた。
mac 用のテンソーフローをインストールしていた。
まずは、テンソーフローのアンインストール。
yum uninstall tensorflow
その後、自分の環境にあったテンソーフローのインストールを試みる。
pip install --ignore-installed --upgrade https://storage.googleapis.com/tensorflow/linux/cpu/tensorflow-0.10.0rc0-cp35-cp35m-linux_x86_64.whl
エラーでた。
tensorflow-0.10.0rc0-cp35-cp35m-linux_x86_64.whl is not a supported wheel on this platform.
wheel がないって言ってるから、入れる。
pyenv exec pip install wheel
もっかい、
pip install --ignore-installed --upgrade https://storage.googleapis.com/tensorflow/linux/cpu/tensorflow-0.10.0rc0-cp35-cp35m-linux_x86_64.whl
また同じエラーだ。
オフィシャルサイトを参照
https://www.tensorflow.org/install/#pip-installation
分かった。。。CentOS じゃダメなんだ。。。
ubuntu でやろう。。。
この記事は終了。。。
Tips
アナコンダ導入
pyenv install anaconda3-4.3.1
ダウンロードが完了しない事象が発生。。。
2時間待っても動きなし。。。
ググってみると下のサイトを発見
https://github.com/pyenv/pyenv/wiki/Common-build-problems
下のコマンドで、ミドルウェアを追加して解決!
yum -y install compat-openssl10-devel --allowerasing
yum -y install xz-devel