Python for Beginners #1— Installing Python

code more
7 min readMay 1, 2021

Install Anaconda for Windows, Mac, and Linux (Ubuntu)

Story time before we begin

I started out my career at an insurance company in France. Like most students right out of college, I was still very much under the impression that I had to know and do everything right to move up the career ladder. Almost as if there was an exam at the end of the year and that was when promotions were handed out. (Yes, I was this naive lol.)

I had one interesting conversation with one of my mentors at the time who insisted that I should not focus on being good at everything, but rather focus on one thing and do it well enough to stand out. Once I had this one thing mastered I could move to the next and do the same. He insisted that I should never shy away from a challenge, however intimidating it may be. This is probably the best career advice I’ve gotten and I pass it on to my younger readers. Pick your spots, the rest will come sure enough.

His passion for data science was infectious and that rubbed off on me. He was especially interested in Python and goaded me to write simple programs to automate tasks within the office. And that, my friends, is how my journey into Python programming began.

Now, the first thing you ask, after deciding to learn Python is, of course, how to I even get it on my computer. In some companies, sadly, they will actually only install the interpreter. Example of the here.

This means that you have to write your code in a text file and run it on the command line. If there’s an error in the code (a bug), then you have to rerun everything. This was actually how people used to code in the past. Imagine if you have something running for 1 hour only to find out it has a bug. Ayayai.

Introducing the Anaconda IDE

To help people fix errors in (debug) their code, IDEs were developed. IDE stands for Integrated Development Environment. This means that you have everything in one place. You only have to write code and you get to see the results of what you write line by line. So if there is a bug, you can do your debugging very fast.

One of the most popular IDEs out there is Anaconda. Anaconda actually comes with both Python and R so it’s today’s data scientist’s dream. That’s what we’ll be installing in this tutorial.

Table of Contents

  1. Anaconda on Windows
  2. Anaconda on Mac
  3. Anaconda on Linux
  4. Google Colab

Anaconda Installation on Windows

We will go through all the steps in detail but to give an overview:

  1. Go to the Anaconda Website and choose the 64-Bit installer
  2. Run the installer once downloaded
  3. Start your new life as a Pythonista

Of course, the devil is in the detail so let's get to it:

1) Anaconda Website

The website should look something like this:

You just have to click download, and you will be directed to the bottom of the page.

Here you have both 32 and 64-bit Anaconda versions for Windows, Mac, and Linux.

Since you’re on Windows, you just have to select the 64 bit and let the download run.

If you’re wondering about this 32 and 64-bit business, all you need to know is that unless you’re running on a very old computer with an old version of Windows or for specific cases, you won’t need the 32-bit version.

2) Find your download and run it

If you’re on your personal computer, you can run this as an administrator. Otherwise, on a company computer, you will only be able, on most occasions, to install this as a simple user. Small details though.

3) The “Next” phase of installation

As with pretty much every software these days, you have to go through the Nexts. On anaconda, your page should look like this:

I’m supposed to tell you to read the License Agreement and Agree but if you didn’t I’m not snitching.

4) Python for you or for all users?

Again, this depends on whether you’re on your personal computer or the company’s in which case, you’ll probably have to choose ‘Just Me’.

The choice above will influence your default installation location. Take note of this as well.

5) Environment variables

I’ve had a few problems with this so I’ll recommend that you not add Anaconda to PATH variables because it’ll cause some problems in the future.

6) Start the installation

We can now start the installation.

Once finished, you just click ‘Next’. PyCharm is another IDE. I don’t think you need two.

And you’re done!

Anaconda Installation on Mac

Similar to Windows, we have the same outline:

  1. Go to the Anaconda Website and choose the 64-Bit installer
  2. Run the installer once downloaded
  3. Start your new life as a Pythonista

Let's get to it:

1) Anaconda Website

The website should look something like this:

You just have to click download and you will be directed to the bottom of the page.

Here you have both 32 and 64-bit Anaconda versions for Windows, Mac, and Linux.

Since you’re on Mac, you just have to select the 64 bit and let the download run.

If you’re wondering about this 32 and 64-bit business, all you need to know is that unless you’re running on a very old computer with an old version of Windows or for specific cases, you won’t need the 32-bit version.

2) Find your download and install it

Much like you would any other app, you run the installer:

This might be the only challenge you run into but typically the installation is smooth sailing.

Generally, though, your installation should appear on the Applications folder.

Advanced problems: conda install

I have to be honest: I’ve barely ever used conda. I’ve always used pip instead because it started off as a fallback because of problems I had with conda before when I was a bit less experienced.

However, if you’re a conda user, you might have a very small problem when you start using conda:

For example, you get this error if you type conda list to your terminal

caleb@Calebs-MacBook-Pro ~ % conda list
zsh: command not found: conda

The solution is sourcing the conda env:

source /opt/anaconda3/bin/activate

Or if your anaconda folder is in the home directory:

source ~/anaconda3/bin/activate

Anaconda Installation on Ubuntu

If you swear by Linux and specifically Ubuntu, I got you covered as well. You clearly must be the curious type, so I’ll suppose that you will want to do this on the Terminal.

At the time of writing, I’m using Ubuntu 20.04. This obviously might change in the future, but my guess is that the structure remains the same.

  1. We first install packages relating to the Anaconda GUI
sudo apt install libgl1-mesa-glx libegl1-mesa libxrandr2 libxrandr2 libxss1 libxcursor1 libxcomposite1 libasound2 libxi6 libxtst6

2. Get the package installation script (Check for the latest version here). wget is used to download the package from the internet.

wget -P /tmp https://repo.anaconda.com/archive/Anaconda3-2020.11-Linux-x86_64.sh

3. Run the script to start installation based on where you saved your download:

bash /Downloads/Anaconda3–2020.11-Linux-x86_64.sh

4. Your output should resemble the following:

Welcome to Anaconda3 2020.02In order to continue the installation process, please review the license
agreement.
Please, press ENTER to continue
>>>

5. Accept the terms & conditions & choose the installation location. I just left mine at the default:

Anaconda3 will now be installed into this location:
/home/linuxize/anaconda3
- Press ENTER to confirm the location
— Press CTRL-C to abort the installation
— Or specify a different location below

6. The last thing to do is activating the installation by typing:

source ~/.bashrc

7. Enjoy Python 😉

Computer too slow? Google Colab to the rescue

Say you want to run a very heavy piece of code and you don’t think your computer can handle it. Then Google Colab is what you need. If you have your Gmail account, then you should have access via Google Drive.

You can check it out here. The aim is to provide free computation power for programs that need a lot of computational power. There’s no catch: it's actually free. So use it!

--

--

No responses yet