Skip to content

Installing TensorFlow using anaconda

An alternative to using virtual environment for installing TF is to use conda. You will need to first log into our GPU-equipped dev-node dev-intel16-k80.

Install TF CPU-only

Installation

1
2
3
4
5
export PATH=[your top conda dir]/bin:$PATH
conda create --name tf
source activate tf
conda install -c conda-forge tensorflow 
source deactivate

Test

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
export PATH=[your top conda dir]/bin:$PATH
source activate tf
python
>>> import tensorflow as tf
>>> print (tf.__version__)
>>> tf_session = tf.Session()
>>> x = tf.constant(1)
>>> y = tf.constant(1)
>>> print(tf_session.run(x + y))
source deactivate

Install TF with GPU support

Installation

1
2
3
4
5
export PATH=[your top conda dir]/bin:$PATH
conda create --name tf_gpu
source activate tf_gpu
conda install tensorflow-gpu  
source deactivate

Test

1
2
3
4
5
6
export PATH=[your top conda dir]/bin:$PATH
source activate tf_gpu
python
>>> import tensorflow as tf
>>> sess = tf.Session(config=tf.ConfigProto(log_device_placement=True))
source deactivate