Setting up Python

Introduction

The steps to installing Python are seemingly straightforward but can result in an array of different bugs. For INFO 511, I’ve chosen a workflow that will standardize your installations and (hopefully) prevent these bugs.

Installing VS Code

For all OS:

  1. See the following link: https://code.visualstudio.com/download

  1. Run through your device’s appropriate installation.

Installing Bash

For PC

  1. Open Windows PowerShell as Administrator
  2. Type wsl –install and press Enter
  3. Restart your computer
  4. Open the Microsoft Store.
  5. Install a Linux distribution (e.g., Ubuntu).
    1. Search for “Ubuntu” (or any other preferred distribution) and click “Install”.
  6. Set up your Linux environment.
    1. Once installed, open the Linux distribution from the Start menu and follow the setup instructions.

For Mac:

  1. You already have zsh, which is a Bash Shell 😊

Open a Bash Shell terminal

For PC:

  1. Press CTRL + ALT + T simultaneously to open the terminal.
  2. Type bash then press Enter
  3. You should have a Bash shell ready.

For Mac:

Do one of the following:

  1. Click the Launchpad icon in the Dock, type Terminal in the search field, then click Terminal.
  2. In the Finder , open the /Applications/Utilities folder, then double-click Terminal.

Install Homebrew

For Mac and PC:

  1. Homebrew is a package manager for macOS and Linux that makes it easy to install software. In open Bash Terminal, type:
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
  1. Run through any installation steps found within the terminal.

Install Miniconda (via Homebrew)

For both Mac and PC

  1. Type the install command into the open terminal:
brew install --cask miniconda
  1. Fun the following to setup your shell:
conda init "$(basename "${SHELL}")"

Install Python3

For Mac and PC:

  1. Run the following in your terminal (check the latest Python3 version):
conda create -y -n py38 python=3.12.4 pip

For PC (Bash)

  1. Run the following in your terminal (this step may not work given permissions):
echo "conda activate py38" >> ~/.bashrc

For Mac (Zsh)

  1. Run the following in your terminal (this step may not work given permissions):
echo "conda activate py38" >> ~/.zshrc

For Mac and PC:

  1. Run the following in your terminal:
conda activate py38
pip install -U pip
pip install pytest
pip cache purge
conda clean -y -av
python -V
pip -V
  1. Restart your computer + Open VSCode

Prepare VS Code for Python

  1. Once VS Code is open, click on the Explorer:

  1. Click “Clone Repository”:

  1. Paste the following into the text input that pops up in the top-middle: https://github.com/INFO-511-F24/ae-00-unvotes.git, which can be found at the ae-00-unvotes exercise GitHub page:

  1. Click “Open”:

  1. Select the unvotes.ipynb file:

  1. Click the “Select Kernel” button in the top-right above the Jupyter Notebook:

  1. Select “Python Environments” from the middle-center drop-down options:

  1. From the options, select the one with “Homebrew” or “Miniconda” within in (this may look different for you than me:

Install Python Packages

  1. Type the following into your terminal:
pip install numpy pandas matplotlib seaborn scikit-learn scipy statsmodels nltk jupyter notebook jupyterlab ipython plotly xlrd openpyxl requests beautifulsoup4 lxml

Move onto setting up Git