Setting up Tensorflow with Anaconda Python on my MacBook Pro

in machinelearning •  7 years ago  (edited)

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 conda

  • Update anaconda
    conda update anaconda

  • Create a new environment
    conda create -n tensorflow -python=3.6 anaconda

Let's understand what this command does:

  • conda create is the instruction to create an enviroment

  • The argument -n followed by the value tensorflow indicates that the name of the environment is tensorflow

  • The argument -python with the value 3.6 indicates the Python version that will be used for the tensorflow environment.

  • Environment creation might take a while; relax. Once it's completed, use source activate tensorflow to activate the environment. One may check that the prompt has changed to something like (tensorflow) MacBook Pro$. To deactivate the environment, use source deactivate.

  • Now that the environment is ready, the tensorflow packages could be installed - I used the pip command 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

Authors get paid when people like you upvote their post.
If you enjoyed what you read here, create your account today and start earning FREE STEEM!