Human face created like digital circuitry surrounded by digits

Machine Learning on Windows : Installing tooling and setting up an environment

Please follow and share!
Twitter
Facebook
LinkedIn
RSS

I have recently started studying a fantastic Machine Learning Book named Hands-On Machine Learning with Scikit-Learn, Keras & TensorFlow (2nd Edition). I am only on the second chapter, but even so – this book has been well worth the purchase price.

Hands-On Machine Learning with Scikit-Learn, Keras & Tensorflow
Hands-On Machine Learning with Scikit-Learn, Keras & Tensorflow Book Cover

There’s only one aspect that made it slightly more difficult to get started – all of the intro material in the first chapter assumes you are running on a Linux machine. I am a Windows user – so I needed to seek out an alternate way to get my learning started with my platform of choice.

Step 1 – Install Python 3 and pip

This one, I need to go off of memory because I already had Python and pip installed on my machine – so forgive me if I forget something. You need to download the latest release of Python 3 for Windows. Press the link for the latest version (typically near the top of the screen) – and that will bring you to the download page for that version. Scroll towards the bottom of the page and there will be a list of files. Keep it simple and download and run the Windows x86-64 executable installer. Ensure you add Python to your PATH environment variable (available as an option in the installer – mine is in C:\Users\myuser\AppData\local\Programs\Python\Python38)

Pyton Installer Window
Python Installer

Next you’ll need to download the get-pip.py script. You can get the raw script directly from GitHub. (Right click the previous link, select save target as.. and save get-pip.py to your desktop). Because we already have Python installed, it’s just a matter of double-clicking on the script and letting it do its thing (a console window will open and close when it is finished). Now we need to ensure that we add pip to our path environment variable. It is located in your Python installation location in the Scripts folder – in my case it is in C:\Users\myusername\AppData\Local\Programs\Python\Python38\Scripts.

Verify the paths are entered correctly by opening a command prompt and executing the pip command.

Command Window with pip command executed
Command Window with pip command executed

Step 2 – Download and Install Anaconda

The next item that will be needed is a tool called Anaconda. Download and run the Anaconda Distribution Windows Installer for Python 3. When running the installer, when you get to the installation options, be sure to uncheck both checkboxes (do not add anaconda to the path, and do not make it the default python installation for the system as we have already downloaded and installed Python).

Anaconda Installation Options
Anaconda Installation Options

This installation is not a speedy one, so use patience and wait for it to complete.

Step 3 – Begin a project by creating an environment

After the installation has completed. In the Start Menu, you should now have application called Anaconda Navigator. Start this application (and be ready for console windows popping up and disappearing, it’s a normal thing). In the application, select Environments from the left menu, and in the Environments List pane, press the Create button to create a new workspace/environment.

Anaconda Navigator Create Environment Menu
Anaconda Navigator Create Environment Menu

In the Create Environment form, give your environment a name, select the proper Python version, then press the Create button.

Anaconda Create Environment Form
Anaconda Create Environment Form

Step 4 – Install the required packages for your project

In order to follow along with the second chapter in this book, I needed to install some package dependencies into my environment. In the Environment List, ensure that you have the environment that you just created selected from the list. In the third pane, it shows you the packages that are already installed and available for use.

The additional packages required for this chapter are: jupyter, matplotlib, numpy, pandas, scipy, and sklearn (**search for scikit-learn instead of sklearn **). Install these packages in your environment from the packages pane (third pane) by selecting All from the drop-down filter, and searching for each package individually. You do not need to install them one at a time, search for one, check the box, search for the next, check the box, and so on. After you have searched and checked each one – press the Apply button and wait for the packages to install.

Anaconda Install Packages
Anaconda Install Packages

Step 5 – Open the Environment using Jupyter Notebooks

In the Environments list (middle pane) – ensure your environment is selected and press the play button, this will display a context menu where you will select Open with Jupyter Notebook. This will automatically fire up the Jupyter server and a web browser will display showing you the Jupyter web interface.

Anaconda Open Environment with Jupyter Notebook
Anaconda Open Environment with Jupyter Notebook

In the upper right of the Jupyter web interface, there is a New button, press this button and under the Notebook section, select Python3.

Jupyter Web Interface Create New Python 3 Notebook
Jupyter Web Interface Create New Python 3 Notebook

Now you are off to the races to continue with the guidance presented in Chapter 2 – have fun!

Jupyter Notebook executing Hello World
Jupyter Notebook executing Hello World
Sampling of the Chapter 2 Jupyter Notebook
Sampling of the Chapter 2 Jupyter Notebook
Please follow and share!
Twitter
Facebook
LinkedIn
RSS

Comments

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.