I started off with Tensorflow recently. But before I could begin programming, I needed to have the necessary tools and environment set up on my MacBook Pro. I was already using the Anaconda Python 2.7.x distribution and wanted to keep some of my older projects in working condition and avoid the complications of multiple Python installations.
So, here are the steps I followed to setup an environment that had Python 3.6.x. (Steps 2 and 3 are not necessary. I did it to update my base Python 2.7.x to the latest and greatest releases)
Open up a terminal
Update conda
conda update condaUpdate anaconda
conda update anacondaCreate a new environment
conda create -n tensorflow -python=3.6 anaconda
Let's understand what this command does:
conda createis the instruction to create an enviromentThe argument
-nfollowed by the valuetensorflowindicates that the name of the environment istensorflowThe argument
-pythonwith the value3.6indicates the Python version that will be used for thetensorflowenvironment.Environment creation might take a while; relax. Once it's completed, use
source activate tensorflowto activate the environment. One may check that the prompt has changed to something like(tensorflow) MacBook Pro$. To deactivate the environment, usesource deactivate.Now that the environment is ready, the tensorflow packages could be installed - I used the
pipcommand to perform the installation
pip install --ignore-installed --upgrade tensorflow
The last step will take a while because all dependencies will be downloaded and installed. Usually this is quite easy and goes through without any errors. However, if there are errors, a good place to start off would be the Common installation problems section at https://www.tensorflow.org/install