'CentOS'에 해당되는 글 1건

  1. 2017.12.18 [설치] CentOs Tensorflow Install

영상 분석을 위한 서버 환경이 CentOs 가 설치되어 있다.


tensorflow.org는 기본적으로 우분투 환경에서 완벽하게 지원하고 있는것으로 보인다.

궁극적으로는 ubuntu로 가는것이 맞는것으로 보이지만, 일단 회사 정책(기조?)가 CentOs로 넘어가고 있는 분위기라서

CentOs의 개발환경이 필요해진 상황이다.

ubuntu Install: http://cafe.naver.com/telcosn/552


영상분석 서버의 스펙은 아래와 같다.

OS: CentOS Linux release 7.3.1611

CPU: 1x E5-1650 V4 (6 Core, 15M Cache, 3.6 GHz, 140W)

MEM: 8x DDR4 PC19200 32GB ECC-REG

HDD: 3x HDD 3.5인치 SATA3 2TB

SSD: 1x 512GB SSD

POWER: POWER 2000W

GPU: NVIDIA TITAN X


CentOs TensorFlow 설치 과정

※ 많은 사람들이 CentOs에서는 python의 virtualenv 환경으로 설치하기를 권장해서 virtualenv 환경에서 설치

참고: https://www.tensorflow.org/install/install_linux 의 Installing with virtualenv


* GPU를 사용하고 있기 때문에 GPU 환경으로 설치

1. Install base

# yum -y install gcc gcc-c++ atlas atlas-devel gcc-gfortran openssl-devel libffi-devel
2. Installing with virtualenv
Take the following steps to install TensorFlow with Virtualenv:

Install pip and virtualenv by issuing one of the following commands:

 

$ sudo yum install python-pip python-devel python-virtualenv # for Python 2.7
$ sudo yum install python3-pip python3-devel python-virtualenv # for Python 3.n

 

Create a virtualenv environment by issuing one of the following commands:

 

$ virtualenv --system-site-packages targetDirectory # for Python 2.7
$ virtualenv --system-site-packages -p python3 targetDirectory # for Python 3.n

 

where targetDirectory specifies the top of the virtualenv tree. Our instructions assume that targetDirectory is ~/tensorflow, but you may choose any directory.

Activate the virtualenv environment by issuing one of the following commands:

 

$ source ~/tensorflow/bin/activate # bash, sh, ksh, or zsh
$ source ~/tensorflow/bin/activate.csh  # csh or tcsh

 

The preceding source command should change your prompt to the following:

 

(tensorflow)$ 

 

Ensure pip ≥8.1 is installed:

 

$ easy_install -U pip

 

Issue one of the following commands to install TensorFlow in the active virtualenv environment:

 


(tensorflow)$ pip install --upgrade tensorflow      # for Python 2.7(tensorflow)
$ pip3 install --upgrade tensorflow     # for Python 3.n(tensorflow)
$ pip install --upgrade tensorflow-gpu  # for Python 2.7 and GPU(tensorflow)
$ pip3 install --upgrade tensorflow-gpu # for Python 3.n and GPU

 

If the preceding command succeeds, skip Step 6. If the preceding command fails, perform Step 6.

(Optional) If Step 5 failed (typically because you invoked a pip version lower than 8.1), install TensorFlow in the active virtualenv environment by issuing a command of the following format:

 

(tensorflow)$ pip install --upgrade tfBinaryURL   # Python 2.7
(tensorflow)$ pip3 install --upgrade tfBinaryURL  # Python 3.n 

 

where tfBinaryURL identifies the URL of the TensorFlow Python package. The appropriate value of tfBinaryURLdepends on the operating system, Python version, and GPU support. Find the appropriate value for tfBinaryURL for your system here. For example, if you are installing TensorFlow for Linux, Python 3.4, and CPU-only support, issue the following command to install TensorFlow in the active virtualenv environment:

 

(tensorflow)$ pip3 install --upgrade \https://storage.googleapis.com/tensorflow/linux/cpu/tensorflow-1.4.0-cp34-cp34m-linux_x86_64.whl

 

If you encounter installation problems, see Common Installation Problems.
3. Next Steps After installing TensorFlow, validate the installation.
Note that you must activate the virtualenv environment each time you use TensorFlow. 
If the virtualenv environment is not currently active, invoke one of the following commands:
$ source ~/tensorflow/bin/activate      # bash, sh, ksh, or zsh
$ source ~/tensorflow/bin/activate.csh  # csh or tcsh
그래픽카드 사용시, 환경변수에 쿠다 관련 실행경로를 추가 해주어야 한다.
vi ~/venvs/tensorflow/bin/activate
PATH="$VIRTUAL_ENV/bin:$PATH:/usr/local/cuda-8.0/bin"
export PATH
LD_LIBRARY_PATH="/usr/local/cuda-8.0/lib64"
export LD_LIBRARY_PATH

When the virtualenv environment is active, you may run TensorFlow programs from this shell.
Your prompt will become the following to indicate that your tensorflow environment is active:
(tensorflow)$ 
When you are done using TensorFlow, you may deactivate the environment by invoking the deactivate function as follows:
(tensorflow)$ deactivate 
The prompt will revert back to your default prompt (as defined by the PS1 environment variable).
Uninstalling TensorFlow
To uninstall TensorFlow, simply remove the tree you created. For example:
$ rm -r targetDirectory 
※ 나의 경우에는 pip install --upgrade mock 이 설치가 안되어서 설치해줌 또한 쿠다환경은 다른 분석도구를 사용하기 위해서 사전에 설치되어 있었음
Posted by 이성윤