2.1. Software installation#

Hands-on experience with Python coding is an essential part of mastering the skill of programming. To do this on your laptop, you will need to install the necessary software.

This page guides you through the installation steps for:

  • Visual Studio Code (VS Code)

  • Git

  • Miniconda

When installing individual components, you always have to make sure to follow the appropriate instructions depending on the operating system of your laptop (Windows, macOS, or Linux).

Where both textual and video instructions are available, we recommend following the video ones, as they include extra tips and tricks and are generally easier to follow. Make sure to follow the installation order as presented in this book or in the installation guide playlist, which contains all the videos in the specific required sequence:

Windows installation and setup playlist

macOS installation and setup playlist

2.1.1. Visual Studio Code#

To write Python code, you will use an integrated development environment (IDE) called Visual Studio Code (VS Code), which you can use to write, test, and debug your code. VS Code generally works well on various operating systems (Windows, macOS, Linux) and supports multiple programming languages besides Python, which may come in handy in the future should you decide to use another language. Of course, there is a choice of available IDEs, so in the future you may also choose to use a different one (PyCharm and Spyder are popular choices).

Installation steps:

  1. Go to Download Visual Studio Code.

  2. Download the .exe file for Windows.

  3. Follow the default settings.

  4. This will directly launch a VS Code window. If you notice a “release note” opened as a tab in VS code, you can close the tab.

You now have VS Code installed. We will go through its setup and basic usage on the next book page.

Installation steps:

  1. Navigate to this website and click on the Download icon for Mac. The download will happen either immediately, or you may need to press “Allow” when asked whether you want to allow the download.

../../_images/VSCode_Mac_1.png
  1. Navigate to the downloaded file. The downloaded file will be either:

  • A zip file: double-click on it to unzip it, and then open the unzipped VS Code application, or

  • VS Code application: double-click on it to open it. If you’re asked whether you’re sure if you want to open this app, press “Open”. VS Code should then open and you should see the screen such as this:

../../_images/VSCode_Mac_2.png

You now have VS Code installed. We will go through its setup and basic usage on the next book page.

  1. Go to Download Visual Studio Code. Installation guide can be found here. Otherwise, you can follow the instructions below.

  2. Select the tar.gz based on your Linux system.

  3. Use your terminal to extract the tarball (tar.gz): tar -xvf code-*.tar.gz. Navigate into the extracted folder (e.g., cd VSCode-linux-x64) and run the application using ./code.

  4. In general, once the installation is complete, you can launch Visual Studio Code by:

  • Searching for “Visual Studio Code” in your application menu, or

  • Typing code in the terminal. This should directly launch a VS Code window.

Optional: alternative steps 2 and 3.

Option 1. If you download .deb in step 2 (for Debian/Ubuntu), to install VS Code you need to open a terminal and use the cd command to navigate to the directory where the downloaded file is located (typically ~/Downloads/). Then install the package using sudo dpkg -i code_*.deb. If there are dependency issues, run sudo apt-get install -f .

Option 2. If you download .rpm in step 2 (for Fedora), to install VS Code you need to open the terminal and use the cd command to navigate to the directory where the downloaded file is located (typically ~/Downloads/). Then install the package using sudo dnf install code-*.rpm

2.1.2. Git#

Git is a tool used for code management. It’s a free and open-source version control system (see Version Control System in Computer glossary). Git is incredibily useful (and therefore very widely used) for tracking changes in your code, for sharing code, and for collaborating on code with others. Any programming endeavours you may encounter at your future work will almost certainly include working with Git.

Installation steps:

  1. Go to Git - Downloading Package.

  2. From the standalone installers, pick the Windows version your computer has and download.

  3. Run the .exe file and stay with the default settings until you need to choose the default editor. Select “use VS code as Git’s default editor” from the drop-down menu.

Installation steps: Open the Spotlight search by pressing command + Space, type in “Terminal”, and open the Terminal application on you computer. Type in git --version and press Enter. Depending on the outcome of this action, you should follow scenario 1, 2, or 3.

Scenario 1

Running git --version in terminal displayed Git version, which looks like this:

../../_images/git1.png

Note that the exact version displayed may be different than 2.39.5 and that is alright. If a version was displayed, you’re all set.

Scenario 2

Running git --version in terminal gave a longer message which mentions XCode, and a new window popped up prompting you to install it. In this case, agree to install and follow the installation instructions. Once it’s done, go back to terminal and try running git --version again. This time, you should get the outcome shown in Scenario 1, and then you’re all set.

Scenario 3

If even after installing XCode (Scenario 2) the terminal doesn’t display Git version, i.e., if there is no Git on your computer, you can choose to either follow these instructions or install Homebrew first (see the Homebrew section just below in the book) and then install Git using Homebrew:

Install Git with Homebrew:

brew install git

After installation, verify that Git is installed by running:

git --version
  1. Open a terminal.

  2. Run the appropriate command for your Linux distribution:

    For Debian/Ubuntu:

    sudo apt-get install git
    

    For Fedora:

    sudo dnf install git
    
  3. After installation, verify that Git is installed by running:

    git --version
    

    This command will display the installed Git version.

2.1.3. Homebrew (optional)#

Homebrew is a package manager for macOS and Linux that simplifies the installation of software and tools. Think of it as an app store for command-line tools and applications. Instead of manually downloading and installing software, Homebrew automates the process with simple commands.

Homebrew is particularly useful for installing development tools, libraries, and utilities that aren’t available through the standard macOS App Store or Linux package managers. For example, it can be used to install Git (if not already present), Python packages, and many other developer tools.

  1. Open the Terminal application.

  2. Copy and paste the following command into your terminal and press Enter:

/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
  1. Follow the on-screen instructions. You may be prompted to enter your password. Note that when typing your password in the Terminal, the characters will not be displayed for security reasons. Don’t worry — your input is still being registered, so just type your password as usual and press Enter.

  2. Once installation is complete, verify that Homebrew is installed by running:

brew --version

This should display the installed Homebrew version.

  1. Open your terminal.

  2. Copy and paste the following command into your terminal and press Enter (do not use sudo):

/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
  1. Follow the instructions displayed in the terminal during installation.

  2. After installation completes, add Homebrew to your PATH by running these commands:

echo 'eval "$(~/.linuxbrew/bin/brew shellenv)"' >> ~/.bashrc
eval "$(~/.linuxbrew/bin/brew shellenv)"
  1. Verify that Homebrew is installed correctly by running:

brew --version

This should display the installed Homebrew version.

2.1.4. Miniconda#

Miniconda is a minimal installer for conda and a small version of Anaconda. It is a distribution of Python programming language, which comes with some pre-installed packages, such as pip.

Before you start using Python, you need to install Miniconda. We will also need a few packages that are not included in Miniconda; we will set this up on the next book page.

Installation steps:

  1. Go to Miniconda installer page.

  2. Select Windows and provide your email address. The log into your email account and click on the download link. Scroll down to Miniconda section and select Windows installation file for download.

  3. Run .exe file and start installation.

  4. Follow the default settings; in the step when you can choose recommended settings (by clicking third tickbox), select those.

  5. Check if you have miniconda3 folder in the path: C:\Users\yourUserName.

  6. Open Anaconda Prompt which was installed with Miniconda.

  7. Type conda to see the possible commands.

  8. Try the conda list command to see if the installation is successful.

../../_images/miniconda1.png
  1. Make Conda available in Git Bash:

Since this course uses Git Bash to teach Unix-style commands (which are standard in scientific computing and bioinformatics), you need to make conda commands available in Git Bash. To do so, follow these steps:

  • In the Anaconda Prompt window, run the following command: conda init bash

  • Close all terminals. (Anaconda Prompt, Git Bash, etc.)

  • Open Git Bash and verify that conda works by typing conda --version.

This step is essential for the rest of the course, as we will be using Git Bash terminal with Unix-style commands rather than Windows Command Prompt (CMD) or PowerShell.

Installation steps:

  1. Click on the Apple symbol in the top left corner of your screen and then click About This Mac. Take note of the type of processor/chip you have (Intel vs. M1/M2/M3); this will inform your choices in this installation.

  2. Go to this website. Select macOS and provide your email address. The log into your email account and click on the download link. Scroll down to Miniconda section and select macOS installation file for download.

  3. Click on the link “Download the .pkg installer” in the first installation step and select the corresponding file from the table:

  • “Miniconda3 macOS Intel x86 64-bit pkg” if your laptop has an Intel chip.

  • “Miniconda3 macOS Apple M1 64-bit pkg” file if your laptop has an M1, M2, or M3 chip. This will download a .pkg file into your Downloads folder.

  1. Return to the previous webpage with installation instructions and follow steps 3 and 4: navigate to the downloaded .pkg, double-click on it, and follow the instructions. Accept the default settings. When installation is finished, you can move the installer to the Bin.

  2. Let’s verify whether the installation was successful by following steps 5 and 6. First, use cmd + space bar to open the Spotlight search on your Mac. Type in “terminal” to open the terminal application. This will look like this:

../../_images/Miniconda_Mac_1.png
  1. Type in conda list and press Enter. If your Miniconda installation was successful, you will get output like this (you can also scroll up to see the entire list of installed packages):

../../_images/Miniconda_Mac_2.png
  1. Before starting the installation, it’s helpful to know your system’s architecture (e.g., x86_64 or ARM). This will help ensure you download the correct version of Miniconda. You can find this information using the following command in your terminal:

uname -m

If the output is x86_64, your system has a standard Intel/AMD 64-bit processor. If the output is aarch64, your system has an ARM processor.

  1. Go to the Miniconda website. Select Linux and provide your email address. The log into your email account and click on the download link. Scroll down to Miniconda section and select Linux installation file for download.

  2. Once the installer is downloaded, navigate to the folder where it is saved (typically your Downloads/ folder). You can do this using the cd command in your terminal. Make the installer executable with the chmod command and then run it, e.g.:

chmod +x Miniconda3-latest-Linux-x86_64.sh
./Miniconda3-latest-Linux-x86_64.sh

During the installation follow the prompts and review the license agreement. Accept the default installation location. At the end, it will ask if you want to initialize Miniconda (conda init). Confirm by typing yes.

  1. To check if the installation was successful, close your current terminal and open a new one. Then, type conda list. If your Miniconda installation was successful, you will see a list of installed packages (check the macOS tab in these instructions to see an example).

  2. During installation, if you accepted the conda init prompt (which modifies the shell’s startup files), conda commands should already be available in any terminal session. You can check this by opening a new terminal and running conda list. Otherwise, if you chose not to let the installer modify your PATH, it is useful to add Miniconda to your PATH manually. To do so, add the following line to the end of your .bashrc or .zshrc file (depending on your shell) and then run with source:

export PATH="$HOME/miniconda3/bin:$PATH"
source ~/.bashrc  # or source ~/.zshrc