Searching for tutorials and software about Deep Learning and Neural Nets? Be sure to look at my Resource Page!
Looking for Octave? Go to my Easy Octave on Mac page!

Saturday, November 14, 2015

Conda: setting up Python 2.7 for TensorFlow

Summary: I've done it and it works.
If you have already got Anaconda — a tool that allows you to run multiple Python versions without crosstalk, then all you need is  this link ...  or this command.

conda install -c tensorflow

The bulk of this post deals with installing Conda.

1. -----------------Installing  Python 2.7
Here are my notes on installing TensorFlow on my Mac using Conda. Skip to the bottom of this post for a note on the GUI.

I don't want to foobar my Mac Python install, and I want to run iPython etc.  I already have the Conda Python environment manager running on ElCapitan. 

The Conda CheatSheet and test drive have the info I need to get going.  I printed the CheatSheet, double sided 130% to A4.  Yes, there are times when one needs paper. 

Here is my shell history 
 /Users/xxxxxxxx/anaconda/bin/ipython_mac.command ; exit;
   70  conda info --envs
   71  conda list
   72  conda --version
   73  conda update conda
   74  conda info --envs
   75  conda search --full-name python
   76  conda create --name py27 python=2.7
   77  conda info --envs
   78  source actiavte py27
   79  source activate py27
   80  history
As you can see, the trick is that to Conda, Python is just another package to install! At this point, my system has  an environment called appropriately enough py27, which I should be able to destroy at will.  But every time I open a shell, I will still need to do source activate py27.

Here is a new shell. Watch:

$ conda info --envs
# conda environments:
py27                     /Users/xxxxxxxxx/anaconda/envs/py27
root                  *  /Users/xxxxxxxxx/anaconda

$ python --version
Python 3.5.0 :: Anaconda 2.4.0 (x86_64)
$ source activate py27
discarding /Users/xxxxxxxxx/anaconda/bin from PATH
prepending /Users/xxxxxxxxx/anaconda/envs/py27/bin to PATH
(py27)xxxxxxxx:~ xxxxxxxxx$ python --version
Python 2.7.10 :: Continuum Analytics, Inc.

Ok, I guess at this point we're done for the day with configuring Python via Conda. Phew.

Update. Of course, I now found out that the Anaconda Launcher App can create and curate environments. Sadly there seems to have been a bug and the py27 I created in the command line, above, only showed up in the app when I created another Python 2.7 environment named py27conda from the launcher. 

2. ----------Installing TensorFlow with Conda
With Python 2.7 active, use the command line at the top of this post. You should see something like this:

(py27)MBPdeEdndRonald:~ XXX$ conda install -c tensorflow
Fetching package metadata: ......
Solving package specifications: ................
Package plan for installation in environment /Users/edmundronald/anaconda/envs/py27:

The following packages will be downloaded:

    package                    |            build
    numpy-1.10.1               |           py27_0         3.0 MB
    six-1.10.0                 |           py27_0          16 KB
    tensorflow-0.5.0           |           py27_2         7.5 MB
                                           Total:        10.5 MB

The following NEW packages will be INSTALLED:

    numpy:      1.10.1-py27_0
    six:        1.10.0-py27_0
    tensorflow: 0.5.0-py27_2 

Proceed ([y]/n)? y

And after you type Y ... you'll have got the job done.


1 comment:

Hey, let me know what you think of my blog, and what material I should add!