Setting Up Python

Installing and Setting Up Python

Python is the programming language of choice for all kinds of coders, traders, data analysts and AI scientist alike! Installing and setting up Python provides you with a dynamically type-checked and garbage-collected modern programming language. It supports multiple programming paradigms, including structured (particularly procedural), object-oriented and functional programming. It is often described as a “batteries included” language due to its comprehensive standard library. For the basics see this post.

Before making use of Python you need a Python environment on your computer, a Jupyter notebook or an online platform (Github) ready for use. Setting up a Python environment and the necessary tools for coding, especially for trading and analytics, involves a few key steps. Here’s a short guide to help you install Python and the required tools, including Jupyter Notebook, GitHub, and others.

Download Python

  1. Go to the official Python website.
    1. Download the latest version of Python (preferably the latest stable version, e.g., Python 3.11 or 3.12).
    2. During installation: Check the box “Add Python to PATH”.
    3. Select the Customize installation option to ensure pip (Python package manager) and IDLE are installed.

Verify Installation

  1. Open a terminal (Command Prompt on Windows, Terminal on macOS/Linux).
  2. Type: python –version

Install pip

  • Pip is typically included with Python. Verify it by typing: pip –version</li>
  • If not installed, run: python -m ensurepip

Installing and Using Virtual Environments

Virtual environments allow you to create isolated environments for your Python projects, preventing conflicts between dependencies.</p>

Installing venv

  • venv comes pre-installed with Python 3. If not: pip install virtualenv

Create a Virtual Environment

  • Navigate to your project direct

cd path/to/your/project

  1. Create a virtual environment: python -m venv venv_name
  2. Activate the virtual environment: venv_name\Scripts\activate

Install Dependencies

  • Use pip to install libraries in the environment: pip install pandas matplotlib jupyterlab

Installing Jupyter Notebooks

Jupyter Logo

Install Jupyter

  1. Activate your virtual environment.
  2. Install Jupyter Notebook: pip install notebook

Start Jupyter

  • Launch Jupyter Notebook: jupyter notebook
  • A web interface will open where you can create and run Python notebooks.

Get JupyterLab (Optional)

  • Install JupyterLab for a more modern interface: pip install jupyterlab
  • Launch JupyterLab: jupyter-lab

Using GitHub

GitHub Logo

GitHub is ideal for working online with version control and possibilities for collaboration.

Install Git

  1. Download Git from git-scm.com.
  2. Install it with default settings.

Set Up Git

Configure your username and email:                                                                        –

  • git config –global user.name “Your Name”
  • git config –global user.email “your.email@example.com”

Clone a Repository

  • To start working on an existing project: git clone https://github.com/username/repository.git

Installing IDEs

An local Integrated Development Environment is a bare necessity. Most coders use VS Code.

Visual Studio Code (VS Code)

  1. Download VS Code.
  2. Install the Python extension from the Extensions Marketplace.

Related Stories