Intro to Programming: Get your Computer Ready to Run Python

Welcome to another article in our Intro to Programming series. In this article we'll cover the steps required to make sure your computer is properly setup for Python.

There's never been a better time to run Python. Not only is it easy to install Python on your computer, but you can also use online services (many that are free) to access a virtual environment that has Python already installed.

Installing Python Locally

Python typically comes pre-installed on many computers. In fact, it's very likely that your computer already has Python on it, whether you are using a Mac or a Windows machine. However, by now you also know that there are many versions of Python. So to simplify all this and to make sure that you have the correct version of Python on your system, we will install the free Anaconda distribution.

A Python distribution is a bundle of code that includes a specific version of Python, as well as additional packages that you would need for more advanced tasks such as data analysis and machine learning. Anaconda is one such distribution. It was built by a company called Continuum Analytics and was later offered to the world for free (they do have paid products related to this software as well). The Anaconda distribution significantly simplifies getting started with Python. It essentially is like a basket of goodies, that has all the tools you need to get started with Python, as well as some extra tools, that are useful if you're doing data science, for example. The best thing is that it's free, easy to install, and available for Windows, Mac and Linux computers.

To install Anaconda, you can visit the downloads link at https://www.anaconda.com/products/individual. Scroll down past the marketing material and you will reach the section of the page that has links to the actual software to download.

On this page, you have the option to select your version of Python. As I mentioned earlier, we will be focusing on Python 3, so hit the download button for 3.7 (or whichever latest version you find). If you're seeing different versions than in this article, that's ok. As long as the version you select is at least 3.7, it will be perfect. The reason you might see different versions is that the Python community constantly improves and updates the language, so new versions are released frequently.

Before you click download, make sure you have enough space on your computer. The Anaconda distribution is a fairly large piece of software. There is a smaller version of it, called Miniconda, available at https://docs.conda.io/en/latest/miniconda.html, but I recommend that you download Anaconda if you are not very comfortable working with the command line yet.

One word of caution here for Windows users. There is a step in the installation process that asks you to choose whether to add Anaconda to your PATH environment variable. The Anaconda installation typically recommends not adding Anaconda to the PATH environment variable, but we recommend that you do. What that will do is actually make it easier to work with Python on the command line, at the expense of "hiding" the original Python version that your computer came installed with. But since that version is very likely outdated by now, we recommend that you check the box that allows you to add Anaconda to your PATH environment variable. You can always modify your PATH environment variable later to undo this change if somehow (unlikely) you notice that certain other software on your computer no longer works as expected.

If you are run into any issues during the installation, it's always good to use your preferred search engine to see if anyone else has run into similar problems. It's unlikely that you'll have any problems installing it. But if you do, remember: whatever problem you have, the internet has already seen it, so doing a search will typically help you find solutions to most of your problems. Well, at least the ones that are Python related.

Ok, so now your computer should be all set and ready to go. In our next article we will cover how to actually make use of the Anaconda distribution to write Python code.

Python in the Cloud

If you're in a hurry / don't have enough space on your computer / are super excited to get started and don't want to wait for the download to finish, you can also use any of the services that offer Python environments for free in the cloud.

One that we really like is Google Colab. If you have a Google account, this service will be available to you for free.

Full disclosure: Google Colab is not always free. If you want to throw more resources behind your Python environment, Google will charge you based on how many resources you use. However, the default environment setup, though not very powerful, is perfect for the beginner and is also free.

To access Google Colab, first log into your Google account, and then visit https://colab.research.google.com. Their design changes from time to time, but at the time of the writing of this article, this is what you should expect to see once that page loads:

Once you click the New Notebook button, a new page will open, where you can begin to write and run Python code.

What you see here is a notebook environment. You are now ready to write Python code! In our next article we will cover how to use this environment to write and run Python code. Stay tuned!