Installing Tensorflow on CentOS7
Post date: 2017/05/04 5:51:10
- Installation
# yum -y install python-pip python-devel
# yum -y install gcc gcc-c++ python-pip python-devel atlas atlas-devel gcc-gfortran openssl-devel libffi-devel
$ pip install --upgrade virtualenv
$ virtualenv --system-site-packages ~/venvs/tensorflow
$ source ~/venvs/tensorflow/bin/activate (tensorflow)
$ pip install --upgrade numpy scipy wheel cryptography (tensorflow)
$ pip install --upgrade tensorflow-gpu
Collecting tensorflow-gpu Downloading tensorflow_gpu-1.1.0-cp27-cp27mu-manylinux1_x86_64.whl (84.1MB) ...
- Validation (失敗 : cuDNN v.5 がインストールされていない)
(tensorflow) $ python
>>> import tensorflow as tf
... ImportError: libcudnn.so.5: cannot open shared object file: No such file or directory
Failed to load the native TensorFlow runtime. See https://www.tensorflow.org/install/install_sources#common_installation_problems
for some common reasons and solutions.
Include the entire stack trace above this error message when asking for help.
>>>
- Installation cuDNN v.5
- Download cuDNN v5 (May 27, 2016), for CUDA 8.0 : cuDNN v5 Library for Linux
$ tar zxvf cudnn-8.0-linux-x64-v5.0.solitairetheme8
# cp -a lib64/* /usr/local/cuda/lib64/
# cp -a include/cudnn.h /usr/local/cuda/include/
- Validation
$ source ~/venvs/tensorflow/bin/activate
(tensorflow) $ python
Python 2.7.5 (default, Nov 6 2016, 00:28:07) [GCC 4.8.5 20150623 (Red Hat 4.8.5-11)] on linux2 Type "help", "copyright", "credits" or "license" for more information.
>>> import tensorflow as tf
>>> hello = tf.constant('Hello, TensorFlow!')
>>> sess = tf.Session()
2017-05-04 16:26:03.801993: W tensorflow/core/platform/cpu_feature_guard.cc:45]
The TensorFlow library wasn't compiled to use SSE4.1 instructions, but these are available on your machine and could speed up CPU computations. 2017-05-04 16:26:03.802038: W tensorflow/core/platform/cpu_feature_guard.cc:45]
The TensorFlow library wasn't compiled to use SSE4.2 instructions, but these are available on your machine and could speed up CPU computations. 2017-05-04 16:26:03.802049: W tensorflow/core/platform/cpu_feature_guard.cc:45]
The TensorFlow library wasn't compiled to use AVX instructions, but these are available on your machine and could speed up CPU computations. ...
>>> print(sess.run(hello)) Hello, TensorFlow!
>>> ^D
(tensorflow) $ deactivate
$
Ref: