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 installerSetting 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 matplotlibFor LangChain Development β
bash
pip install langchain langchain-openai langchain-community
pip install langchain-chroma langchain-pinecone
pip install streamlit gradio # For building UIsFor 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/ # DocumentationSample 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.0Environment 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 β
- OpenAI: Sign up at platform.openai.com
- Anthropic: Apply for access at anthropic.com
- Pinecone: Create account at pinecone.io
- 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:
- Run the test script to verify everything works
- Try the basic examples in each technology section
- Build your first simple project (e.g., document Q&A)
- Explore the frameworks and experiment with different models
Your development environment is now ready for AI application development!