Thursday, March 9, 2017

Re-installing tensorflow

Finally I understood why my friend recommended Anaconda. It's so much easier to install Anaconda, which includes all the goodies that come with it, rather than installing each component on an as-needed basis (e.g. Spyder, iPython, etc.) The only reason I didn't go with Anaconda installation of tensorflow previously was that the tensorflow official documentation did not strongly recommend it. I used Anaconda to install tensorflow in my MacBookAir, and had no issues so far. So why not use it for the GPU box as well?

1. Install Anaconda (Python 3.6 at the time of this writing)

2. Create a conda environment named tensorflow to run Python 3.6:

$ conda create -n tensorflow

3. Activate the conda environment:

$ source activate tensorflow
  (tensorflow) username$ # Your prompt should change

4. Install tensorflow within the conda environment:

(tensorflow) username$ pip install --ignore-installed --upgrade https://storage.googleapis.com/tensorflow/linux/gpu/tensorflow_gpu-1.0.1-cp36-cp36m-linux_x86_64.whl   

# This is for Python 3.6 with GPU support

I tried pip3 at the beginning and got an error. pip works without an issue. I still don't quite understand pip3 (python3) vs. pip (python2).

5.  Verify that tensorflow is installed within Anaconda

(tensorflow) username$ ls /home/username/anaconda3/envs/tensorflow/bin/

activate  conda  deactivate


6. Install ipython and jupyter

(tensorflow) username$ conda install ipython


(tensorflow) username$ pip3 install jupyter  


7. Verify that ipython and  is installed within Anaconda

(tensorflow) username$ ls /home/username/anaconda3/envs/tensorflow/bin/

2to3          easy_install-3.6  pydoc       python3.6-config   tclsh8.5
2to3-3.6      idle3             pydoc3      python3.6m         unxz
activate      idle3.6           pydoc3.6    python3.6m-config  wheel
conda         ipython           pygmentize  python3-config     wish8.5
c_rehash      ipython3          python      pyvenv             xz
deactivate    openssl           python3     pyvenv-3.6
easy_install  pip               python3.6   sqlite3 



Now I can use tensorflow in ipython within Anaconda!

No comments:

Post a Comment