#1 Data Analytics Program in India
₹2,499₹1,499Enroll Now
10 min read

Environment Setup

Working in notebooks (Jupyter/Colab) and VS Code; managing environments and packages

What You'll Learn

  • Setting up Python development environments
  • Working with Jupyter Notebooks and Google Colab
  • Using VS Code for Python development
  • Managing virtual environments
  • Installing and managing packages

Development Environments

Jupyter Notebooks:

  • Interactive computing environment
  • Combines code, visualizations, and text
  • Perfect for data analysis and exploration
  • Runs in your browser

Google Colab:

  • Free cloud-based Jupyter notebooks
  • No setup required
  • Free GPU access
  • Easy sharing and collaboration

VS Code:

  • Full-featured code editor
  • Excellent Python support
  • Integrated terminal and debugger
  • Extensions for data science

Virtual Environments

Why use virtual environments?

  • Isolate project dependencies
  • Avoid package conflicts
  • Reproducible environments
  • Clean project structure

Creating virtual environment:

terminal
# Using venv
python -m venv myenv

# Activate on Windows
myenv\Scripts\activate

# Activate on Mac/Linux
source myenv/bin/activate

Package Management

pip - Python package installer:

terminal
# Install package
pip install pandas

# Install specific version
pip install pandas==1.5.0

# Install from requirements.txt
pip install -r requirements.txt

# List installed packages
pip list

# Create requirements.txt
pip freeze > requirements.txt

Essential packages for data analysis:

  • pandas - Data manipulation
  • numpy - Numerical computing
  • matplotlib - Visualization
  • seaborn - Statistical visualization
  • jupyter - Interactive notebooks

Jupyter Notebooks

Starting Jupyter:

terminal
# Install Jupyter
pip install jupyter

# Start Jupyter Notebook
jupyter notebook

# Start JupyterLab
jupyter lab

Notebook shortcuts:

  • Shift + Enter - Run cell
  • Ctrl + Enter - Run cell (stay)
  • A - Insert cell above
  • B - Insert cell below
  • DD - Delete cell
  • M - Convert to Markdown
  • Y - Convert to Code

Google Colab

Getting started:

  1. Go to colab.research.google.com
  2. Sign in with Google account
  3. Create new notebook
  4. Start coding!

Colab advantages:

  • No setup required
  • Free GPU/TPU access
  • Google Drive integration
  • Easy sharing

VS Code Setup

Installing Python extension:

  1. Open VS Code
  2. Go to Extensions (Ctrl+Shift+X)
  3. Search "Python"
  4. Install Microsoft Python extension

Key features:

  • IntelliSense (auto-completion)
  • Debugging
  • Linting
  • Jupyter support
  • Git integration

Best Practices

Project structure:

project/ ├── data/ │ ├── raw/ │ └── processed/ ├── notebooks/ ├── src/ ├── requirements.txt └── README.md

Environment management:

  • One virtual environment per project
  • Keep requirements.txt updated
  • Document dependencies
  • Use .gitignore for venv/

Practice Questions

Test your understanding with these practice questions. Click "Show Answer" to see the solution and "Try Code Editor" to experiment with code.

1

Practice Exercise

What command would you use to create a virtual environment named "data_project"?

starter_code.py
# Type the command to create a virtual environment
# (This is a bash command, not Python code)
2

Practice Exercise

Write Python code to check which packages are installed in your environment

starter_code.py
import pkg_resources

# Get list of installed packages
# Your code here
3

Practice Exercise

How would you install pandas version 2.0.0 specifically?

starter_code.py
# Write the pip command to install pandas 2.0.0
# (This is a bash command)

Practice & Experiment

Test your understanding by running Python code directly in your browser. Try the examples from the article above!

SkillsetMaster - AI, Web Development & Data Analytics Courses