Skip to content

Development Environment Setup ​

πŸ› οΈ Setting Up Your AI Development Environment ​

Setting up your development environment for AI projects

🐍 Python Environment ​

Installing Python ​

bash
# Install Python 3.8+ (recommended: 3.9 or 3.10)
# Download from python.org or use package manager

# macOS with Homebrew
brew install python@3.10

# Ubuntu/Debian
sudo apt update
sudo apt install python3.10 python3.10-pip python3.10-venv

# Windows
# Download from python.org and run installer

Setting Up Virtual Environment ​

bash
# Create virtual environment
python -m venv ai-env

# Activate (macOS/Linux)
source ai-env/bin/activate

# Activate (Windows)
ai-env\Scripts\activate

# Install essential packages
pip install jupyter pandas numpy matplotlib seaborn

πŸ“¦ Essential Python Packages ​

Core AI/ML Libraries ​

bash
# Install essential AI libraries
pip install openai langchain chromadb sentence-transformers
pip install transformers torch torchvision torchaudio
pip install scikit-learn pandas numpy matplotlib

For LangChain Development ​

bash
pip install langchain langchain-openai langchain-community
pip install langchain-chroma langchain-pinecone
pip install streamlit gradio  # For building UIs

For Vector Database Work ​

bash
pip install chromadb pinecone-client qdrant-client
pip install sentence-transformers faiss-cpu

πŸ”§ Development Tools ​

Code Editor Setup ​

  • VS Code: Install Python extension, Jupyter extension
  • PyCharm: Professional IDE for Python development
  • Jupyter Lab: Web-based interactive development

Essential VS Code Extensions ​

  • Python
  • Jupyter
  • GitHub Copilot
  • Markdown All in One
  • Git Lens

Git Configuration ​

bash
git config --global user.name "Your Name"
git config --global user.email "your.email@example.com"

πŸš€ Quick Start Template ​

Basic AI Project Structure ​

my-ai-project/
β”œβ”€β”€ .env                 # API keys and secrets
β”œβ”€β”€ requirements.txt     # Python dependencies
β”œβ”€β”€ main.py             # Main application
β”œβ”€β”€ notebooks/          # Jupyter notebooks
β”œβ”€β”€ data/               # Data files
β”œβ”€β”€ models/             # Saved models
└── docs/               # Documentation

Sample requirements.txt ​

txt
openai>=1.0.0
langchain>=0.1.0
chromadb>=0.4.0
sentence-transformers>=2.2.0
streamlit>=1.28.0
python-dotenv>=1.0.0

Environment Variables (.env) ​

bash
OPENAI_API_KEY=your_openai_api_key_here
PINECONE_API_KEY=your_pinecone_api_key_here
ANTHROPIC_API_KEY=your_anthropic_api_key_here

🐳 Docker Setup (Optional) ​

Dockerfile for AI Projects ​

dockerfile
FROM python:3.10-slim

WORKDIR /app

COPY requirements.txt .
RUN pip install -r requirements.txt

COPY . .

EXPOSE 8501

CMD ["streamlit", "run", "app.py"]

Docker Compose for Development ​

yaml
version: '3.8'
services:
  ai-app:
    build: .
    ports:
      - "8501:8501"
    environment:
      - OPENAI_API_KEY=${OPENAI_API_KEY}
    volumes:
      - ./data:/app/data

☁️ Cloud Development Options ​

GitHub Codespaces ​

  • Full VS Code environment in the browser
  • Pre-configured with Python and common tools
  • Good for experimentation and learning

Google Colab ​

  • Free Jupyter notebooks with GPU access
  • Great for experimentation and learning
  • Limited session time and storage

Replit ​

  • Browser-based IDE
  • Good for quick prototypes
  • Easy sharing and collaboration

πŸ”‘ API Key Management ​

Getting API Keys ​

  1. OpenAI: Sign up at platform.openai.com
  2. Anthropic: Apply for access at anthropic.com
  3. Pinecone: Create account at pinecone.io
  4. Cohere: Sign up at cohere.com

Secure Key Storage ​

python
# Use python-dotenv for local development
from dotenv import load_dotenv
import os

load_dotenv()
api_key = os.getenv('OPENAI_API_KEY')

Environment Variables in Production ​

  • Use cloud provider's secret management
  • AWS Secrets Manager, Azure Key Vault, etc.
  • Never commit API keys to git repositories

πŸ§ͺ Testing Your Setup ​

Quick Test Script ​

python
# test_setup.py
import openai
import langchain
import chromadb
from sentence_transformers import SentenceTransformer

print("Testing AI development environment...")

# Test OpenAI (if you have API key)
# client = openai.OpenAI()
# print("βœ… OpenAI client created")

# Test sentence transformers
model = SentenceTransformer('all-MiniLM-L6-v2')
print("βœ… Sentence transformer loaded")

# Test ChromaDB
client = chromadb.Client()
print("βœ… ChromaDB client created")

print("πŸŽ‰ Environment setup complete!")

πŸ“š Next Steps ​

Once your environment is set up:

  1. Run the test script to verify everything works
  2. Try the basic examples in each technology section
  3. Build your first simple project (e.g., document Q&A)
  4. Explore the frameworks and experiment with different models

Your development environment is now ready for AI application development!

Released under the MIT License.