Mandar Deshpande    Medium    Archive    GitHub    Resume    About

Setup Python Environment for ml and Deep Learning

This page gives quick and easy steps to setup your machine for machine learning and deep learning.

Hi guys, In python there are many pre built libraries which can be used for machine learning and deep learning. But one major problem lies in setting up the environment for development using these libraries (especially for Windows based machines).

Since most of these libraries were built to be used on Linux (Ubuntu etc), its easier to setup the working environment in Linux. At the same time its a very confusing and lengthy procedure on Windows machine.

So below are the steps to get you up and running for ml and deep learning development on Windows:

Step 1: Download Anaconda Distribution

For your version of system 32bit or 64bit from here Its better to select the version for Python 3.6 or 3.5.x since Tensorflow is yet only available for Python 3.5.

Step 2: Install Anaconda

Follow through the on-screen instructions Next->Next->Next-> then :

Step 3: Open up Anaconda Navigator on your machine

The following packges will be preinstalled in the Navigator:

Step 4: Now go to the Environments tab

on the left side of the Navigator

Once your new environment for Python 3.5 has been created it would appear like this

Now from the search packages box, type-in and download the following packages:

  1. Jupyter
  2. Scikit-learn
  3. qtconsole
  4. matplotlib
  5. numpy
  6. pandas
  7. pip
  8. scipy

Step 5:

Once all above packages are installed, open up a terminal from your newly created Environment.

Once the terminal opens up type in the following for installing Theano:

conda install theano pygpu

Let the download and installtion finish. After this type in the following for insatlling Tensorflow:

For CPU

pip install --ignore-installed --upgrade https://storage.googleapis.com/tensorflow/windows/cpu/tensorflow-1.1.0-cp35-cp35m-win_amd64.whl

For GPU

pip install --ignore-installed --upgrade https://storage.googleapis.com/tensorflow/windows/gpu/tensorflow_gpu-1.1.0-cp35-cp35m-win_amd64.whl

Once tensorflow has been successfully installed, type the following for installing Keras:

pip install git+git://github.com/fchollet/keras.git

Once everything has been installed,go to next Step. If not search for your specific error on Google, you will find numerous discussions and answers on StackOverflow. Otherwise ping me.

Step 6: Testing

Now to test whether scikit-learn, Theano , Tensorflow and Keras are working properly; open up a terminal just like the previous step but with python

Once the terminal opens up, it should appear like this.

Now type the following commands to test their working

import tensorflow as tf                                                                                            
import theano
import keras

If there are no errors, then Congratulations you have successfully setup your Environment for machine learning and deep learning.

If some errors pops up, copy the error content as search for solution on Google and stack overflow. This will only help you later in fixing other such minor issue.

Otherwise ping me :D

comments powered by Disqus