Friday, September 7, 2018

Setup Machine Learning Environment using python 3.6.1, Tensorflow (Keras), Jupyter

Issue: Your Mac OSX has been pre-installed with python 2.x which is not preferred version for the latest tensorflow version.

Solutions:  

Option : 1 Using brew to install specific version of python 3.6.1

Use below steps to install 3.6.1 version of the python, and then create virtual environment with this new python version to finally install tensorflow within the virtual environment.

1. Uninstall python 3.7 version which is incompatible with tensorflow latest version (at the time of writing this blog) 

brew uninstall --ignore-dependenciew python

2. Install python 3.6.1

pyenv install 3.6.1

3. List all the versions of python

pyenv versions

4. Change global version of python (to set active python version out of the above list)

pyenv global 3.6.1

5. Check python version (this step should display above 3.6.1 version, if not follow below step)

python --version

6. Check location of the newly installed python 3.6.1

pyenv which python


/Users/<USER>/.pyenv/versions/3.6.1/bin/python

7. Create virtual environment with python 3.6.1


/Users/<USER>/.pyenv/versions/3.6.1/bin/python -m venv myenv

8. Activate the virtual environment 


source myenv/bin/activate

9. Install tensorflow inside the virtual environment (myenv)

pip3 install tensorflow

10. Start using jupyter within the myenv

jupyter notebook

Option : 2 Using brew to install specific version of python 3.6.1


brew install https://raw.githubusercontent.com/Homebrew/homebrew-core/f2a764ef944b1080be64bd88dca9a1d80130c558/Formula/python.rb






No comments:

Post a Comment

Installation of Tensorflow within Python Env and Jupyter

1. Download Anaconda: https://www.anaconda.com/distribution/#macos Error while creating a Session with Tensorflow (command line) >...