This is the second in a three-part series that introduces Python to absolute beginners.
Part 1 walks through installing Python and the IDLE interface, while part 2 covers how to install Python via Anaconda. Part 3 covers the essential elements of Python for beginners.
Anaconda is a must-have tool for anyone looking to easily get started with machine learning and data science.
🤖 Table of Contents 🤖
What is Anaconda?
How to install Anaconda
Customizing your workspace
Examples in the wild
What is Anaconda?
Anaconda is an open source distribution of the Python and R programming languages and looks to make getting underway in either of these languages as easy as possible. It’s a data science package that is easy to download and install and works on Mac, Windows, and Linux.
Out of the digital box, the Python variant of Anaconda comes with 250+ of the most popular Python data science packages that are “curated and compiled” and are available pre-loaded in their virtual environment manager so everything just works from the moment you get started – no need to install every.darn.library out there.
Basically, Anaconda is one of the easiest ways get started with Python-based data science and machine learning projects.
Anaconda also has a community of some 6+ million users which is great if you’re searching around for questions online. Plus, with so many different people using the software you can rest assured that the code recommendations and solutions offered up by the community will be pretty legit.
Additionally, Anaconda provides an easy-to-use workspace (aka an integrated development environment or IDE) as standard with their pre-packaged solution and it’s configured to work with all the major machine learning kit.
Since Anaconda already comes with everything a beginner needs to get started with machine learning, it’s pretty easy to get the hang of quickly, even if you’ve never looked at a line of code before.
How to install Anaconda
Now that you’re sold on Anaconda let’s get it onto your computer asap.
Step 1: Download Anaconda here
Navigate to the Anaconda website and click the download icon for your specific operating system. The installation process is very similar for both Mac and Windows.
Once you’ve selected your operating system choose the version of Python that you want to install – get the most recent version. At the time of writing this tutorial that’s Python 3.6 (although later versions are released frequently).
It’s a large file so it might take a few minutes to download – go ahead and grab a drink.
Step 2: Run the installer
Once you’ve downloaded your operating system’s version of Anaconda you’ll need to run the setup file.
Here’s how you install Anaconda on a PC
- Double click the .exe file that you just downloaded.
- Accept the license agreement.
- Select your installation type with ‘Just me’ recommended.
- Choose your install location. If in doubt, just let it install in your computer’s default location.
- Make sure ‘Register Anaconda as my default Python 3.X’ is selected.
- Allow the files to install. This will probably take a few minutes.
- If prompted, you can skip over the optional install of Microsoft VSCode, unless you want it.
- It’s up to you if you want to leave the ‘Learn more about Anaconda Cloud’ and ‘Learn how to get started with Anaconda’ selected. I didn’t.
And how to install Anaconda on a Mac
- Click on the .pkg file that you just downloaded to launch the installer.
- The installer will want to check whether you already have Anaconda installed. Click continue.
- Accept the license agreement.
- Select where you want Anaconda to be installed. If you’re not sure, go with the default location.
- Let the files install. Odds are this is going to take a few minutes.
- Unless you really want it, you can skip the install of Microsoft VSCode by clicking continue.
Et voilà! Anaconda Python is installed.
Step 3: Launch Anaconda
Once Anaconda is downloaded and installed on your computer you’ll need to fire up the program for the first time. If you’re on a PC this means going to your taskbar to search for the application. Begin typing anaconda and then click on the Anaconda Navigator application when it shows up.
If you’re launching Anaconda on a Mac, you’ll find Anaconda in your Applications folder.
Step 4: Install Spyder
Anaconda Python comes with a bunch of different tools for working with Python which is cool if you’re really into Python development. It’s also a prerequisite for making machine learning incredibly easy to get started with.
The tool that we’re particularly interested in at this point is called Spyder (Scientific Python Development Environment) which is an IDE (integrated development environment) that allows you to work with Python and is particularly well suited for machine learning.
Let’s put all of these rainforest-y names in order:
🐍 Anaconda (the company) created 🕷 Spyder (the IDE) which allows you to work with 🐍 Python (the programming language).
Once Anaconda Navigator is up and running all you have to do is click “Launch” on the Spyder option.
This will activate all of the tools available in the Spyder IDE. Again, it might take a few minutes for it to do its thing so be patient- also, depending on your computer’s firewall settings you might get a popup saying your firewall has blocked some features of Python. Go ahead and click “Allow access” if this happens.
Once that’s done you should see the following screen:
Bam. Spyder is now installed and you’re ready to get your ML groove on 🔥🔥
From now on, when you’re ready to work on any Python-based machine learning projects, launch Anaconda and then Spyder.
A Quick Tour of Anaconda Spyder
IDEs are really powerful tools for writing, editing, and debugging code. And while that’s cool and all, there’s a lot of gear in them that we don’t actually need.
In fact, the parts of Spyder that we do need and will be using in other tutorials on Elle Knows Machines are really simple.
Here’s a quick tour of the interface:
- Editor: Type/paste your Python code into the editor.
- Console: The console is where you interact directly with Python. You can type commands into the console and Python will do what you tell it to. Also, this is where any feedback appears – so if you tell Python to do something like load some data from a spreadsheet, the program will tell you in the console if the command was executed. All error messages will show up here as well.
- Help: Spyder provides explanations of the different elements of Python code. So if you’re trying to tell Python to do something you can use the Help section to get a better understanding of what elements you need to include in your code to make it work like you want it to. It uses pretty technical terms so don’t be afraid to spend time googling what the definitions mean in tech-terms. Carefully thinking through the logic of what the code is trying to do also helps.
- File Explorer: When you open Spyder you’ll need to tell the program where your files are, whether that’s your desktop or another folder stored somewhere else on your computer. File Explorer shows you the contents of the folder that Spyder is working from.
- Variable Explorer: Once you import your data into Spyder you can use the Variable Explorer to check it out. What was once a spreadsheet or csv file will be displayed as a table of columns called a matrix or a single column called a vector.
Customizing Your Workspace
There are two things to consider when customizing your workspace:
Does your install of Spyder look like the tutorial’s screen?
If your install of Anaconda looks different to the one shown above then you can easily add or remove panes.
To do this, go to View > Panes> Editor. Here you can select the different panes that you want on your screen. For consistency, I recommend having the following panes selected:
Does your screen look like you want it to?
Spoiler alert: coding doesn’t have to look dull 🤯
You can change the font, make the font larger, change the background to white or black (oh hey, eyestrain) and change the colors.
Style customization can be done in Tools > Preferences.
To change the font style or size go to Tools > Preferences > General > Appearance
To change the colors go to Tools > Preferences > Syntax Coloring. From here you can either create a pre-made color scheme or make your own.
And there you have it! Anaconda, Spyder, and Python, all installed on your computer ready to go.