Environment Setup
This guide will help you set up your development environment for building RAG applications with LlamaIndex.
Prerequisites
- Python 3.8+ - Programming language
- Git - Version control
- Code Editor - VS Code, PyCharm, or your preferred editor
Installation Steps
1. Clone the Repository
git clone https://github.com/llm-stacks/llm-learning-guide.git
cd llm-learning-guide
2. Create Virtual Environment
# Create virtual environment
python -m venv venv
# Activate virtual environment
# On macOS/Linux:
source venv/bin/activate
# On Windows:
venv\Scripts\activate
3. Install Dependencies
pip install -r requirements.txt
4. Environment Variables
Create a .env
file in the project root:
# OpenAI API (recommended)
OPENAI_API_KEY=your_openai_api_key_here
# Or OpenRouter API (alternative)
OPENROUTER_API_KEY=your_openrouter_api_key_here
# Hugging Face (for embeddings)
HUGGINGFACE_API_KEY=your_huggingface_api_key_here
API Key Setup
Option 1: OpenAI API (Recommended)
- Visit OpenAI Platform
- Create an account and navigate to API Keys
- Create a new API key
- Add to your
.env
file
Option 2: OpenRouter API (Alternative)
- Visit OpenRouter
- Sign up and get your API key
- Add to your
.env
file
Verify Installation
Run the verification script:
python verify_setup.py
You should see:
✅ Python environment: OK
✅ Dependencies: OK
✅ API keys: OK
✅ All systems ready!
Next Steps
Now you're ready to build your first RAG application!
👉 Start with: Simple RAG Tutorial
Troubleshooting
Common Issues
Python version error
python --version # Should be 3.8+
API key not found
- Check your
.env
file format - Ensure no extra spaces around the
=
sign - Restart your terminal after adding environment variables
Import errors
pip install --upgrade pip
pip install -r requirements.txt --force-reinstall
Need help? Open an issue on GitHub!