Installation
This guide provides detailed installation instructions for XunLong on different operating systems.
System Requirements
Minimum Requirements
- Operating System: macOS, Linux, or Windows 10/11
- Python: 3.10 or higher
- Memory: 4GB RAM minimum, 8GB recommended
- Disk Space: 2GB free space
- Internet Connection: Required for LLM API calls and web search
Recommended Setup
- Python: 3.11 or 3.12
- Memory: 16GB RAM for better performance
- Disk Space: 5GB for storing generated projects
- Network: Stable high-speed internet connection
Step-by-Step Installation
1. Install Python
::: tabs
== macOS
Using Homebrew (Recommended):
# Install Homebrew if not already installed
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
# Install Python
brew install python@3.11
# Verify installation
python3 --versionUsing Official Installer: Download from python.org
== Linux (Ubuntu/Debian)
# Update package list
sudo apt update
# Install Python 3.11
sudo apt install python3.11 python3.11-venv python3-pip
# Verify installation
python3.11 --version== Linux (CentOS/RHEL)
# Install Python 3.11
sudo dnf install python3.11 python3.11-pip
# Verify installation
python3.11 --version== Windows
Using Python Installer:
- Download from python.org
- Run installer
- ✅ Check "Add Python to PATH"
- Click "Install Now"
Verify installation:
python --version:::
2. Clone the Repository
# Using HTTPS
git clone https://github.com/jaguarliuu/xunlong.git
cd XunLong
# Or using SSH
git clone git@github.com:jaguarliuu/xunlong.git
cd XunLongNo Git?
If you don't have Git installed:
- macOS:
brew install git - Linux:
sudo apt install git - Windows: Download from git-scm.com
3. Create Virtual Environment
::: tabs
== macOS/Linux
# Create virtual environment
python3 -m venv venv
# Activate virtual environment
source venv/bin/activate
# Your prompt should now show (venv)== Windows (PowerShell)
# Create virtual environment
python -m venv venv
# Activate virtual environment
.\venv\Scripts\Activate.ps1
# If you get execution policy error:
Set-ExecutionPolicy -ExecutionPolicy RemoteSigned -Scope CurrentUser== Windows (Command Prompt)
# Create virtual environment
python -m venv venv
# Activate virtual environment
venv\Scripts\activate.bat:::
Keep Virtual Environment Activated
Always activate the virtual environment before running XunLong. You'll see (venv) in your terminal prompt when activated.
4. Install Python Dependencies
# Upgrade pip
pip install --upgrade pip
# Install dependencies
pip install -r requirements.txtThis will install all required packages including:
- LangChain & LangGraph
- OpenAI/Anthropic clients
- Playwright
- Export libraries (WeasyPrint, python-pptx, python-docx)
5. Install System Dependencies
For PDF Export (WeasyPrint)
::: tabs
== macOS
# Install system libraries
brew install pango gdk-pixbuf libffi== Ubuntu/Debian
# Install required libraries
sudo apt-get update
sudo apt-get install -y \
libpango-1.0-0 \
libpangoft2-1.0-0 \
libpangocairo-1.0-0 \
libgdk-pixbuf2.0-0 \
libffi-dev \
shared-mime-info== CentOS/RHEL
# Install required libraries
sudo yum install -y \
pango \
gdk-pixbuf2 \
libffi-devel== Windows
WeasyPrint on Windows requires GTK+:
- Download GTK+ installer from gtk.org
- Install to default location
- Add GTK+ to PATH
Alternative: Use WSL (Windows Subsystem for Linux) for easier setup.
:::
For Web Search (Playwright)
# Install Playwright browsers
playwright install chromium
# Or install all browsers
playwright installTroubleshooting Playwright
If you encounter issues:
# Install system dependencies for Playwright
playwright install-deps chromium
# On Ubuntu/Debian
sudo apt-get install -y \
libnss3 \
libnspr4 \
libatk1.0-0 \
libatk-bridge2.0-0 \
libcups2 \
libdrm2 \
libxkbcommon0 \
libxcomposite1 \
libxdamage1 \
libxfixes3 \
libxrandr2 \
libgbm1 \
libasound26. Configure Environment Variables
Create .env File
# Copy example configuration
cp .env.example .env
# Edit the file
nano .env # or vim .env, or use your favorite editorConfigure LLM Provider
Choose one of the following providers and add your API key:
# OpenAI Configuration
OPENAI_API_KEY=sk-proj-xxxxxxxxxxxxx
OPENAI_BASE_URL=https://api.openai.com/v1
OPENAI_MODEL=gpt-4o
# Optional: Set as default provider
DEFAULT_LLM_PROVIDER=openai# Anthropic Configuration
ANTHROPIC_API_KEY=sk-ant-xxxxxxxxxxxxx
ANTHROPIC_MODEL=claude-3-5-sonnet-20251022
# Optional: Set as default provider
DEFAULT_LLM_PROVIDER=anthropic# DeepSeek Configuration
DEEPSEEK_API_KEY=sk-xxxxxxxxxxxxx
DEEPSEEK_BASE_URL=https://api.deepseek.com/v1
DEEPSEEK_MODEL=deepseek-chat
# Optional: Set as default provider
DEFAULT_LLM_PROVIDER=deepseekOptional: Add Search API
# Perplexity Search (Recommended)
PERPLEXITY_API_KEY=pplx-xxxxxxxxxxxxx
PERPLEXITY_MODEL=sonarOptional: Add Observability
# LangFuse Configuration
LANGFUSE_PUBLIC_KEY=pk-xxxxxxxxxxxxx
LANGFUSE_SECRET_KEY=sk-xxxxxxxxxxxxx
LANGFUSE_HOST=https://cloud.langfuse.comGetting API Keys
- OpenAI: platform.openai.com
- Anthropic: console.anthropic.com
- DeepSeek: platform.deepseek.com
- Perplexity: perplexity.ai/settings/api
- LangFuse: cloud.langfuse.com
7. Verify Installation
Run the verification script:
python -c "
import sys
print(f'Python version: {sys.version}')
try:
import langchain
print('✅ LangChain installed')
except ImportError:
print('❌ LangChain not installed')
try:
import playwright
print('✅ Playwright installed')
except ImportError:
print('❌ Playwright not installed')
try:
import weasyprint
print('✅ WeasyPrint installed')
except ImportError:
print('❌ WeasyPrint not installed')
print('Installation check complete!')
"8. Test Your Installation
Generate your first report:
python xunlong.py report "Test Report" --verboseIf successful, you should see:
- Search progress indicators
- Content generation steps
- Final report saved to
storage/directory
Post-Installation
Update XunLong
# Pull latest changes
git pull origin master
# Update dependencies
pip install -r requirements.txt --upgrade
# Update Playwright browsers
playwright install chromiumUninstallation
# Deactivate virtual environment
deactivate
# Remove virtual environment
rm -rf venv
# Remove generated projects (optional)
rm -rf storage/
# Remove configuration
rm .envTroubleshooting
Common Issues
Issue: ModuleNotFoundError
Solution:
# Make sure virtual environment is activated
source venv/bin/activate # macOS/Linux
# or
.\venv\Scripts\Activate.ps1 # Windows
# Reinstall dependencies
pip install -r requirements.txtIssue: WeasyPrint fails on macOS
Solution:
# Reinstall with proper library paths
brew reinstall pango gdk-pixbuf libffi
# Set library path
export DYLD_LIBRARY_PATH=/opt/homebrew/lib:$DYLD_LIBRARY_PATH
# Try again
python xunlong.py export <project_id> pdfIssue: Playwright browser not found
Solution:
# Reinstall browsers
playwright install chromium --force
# Or install with dependencies
playwright install chromium --with-depsIssue: Permission denied on Linux
Solution:
# Make script executable
chmod +x xunlong.py
# Or run with python
python xunlong.py report "Test"Issue: API key not found
Solution:
- Check
.envfile exists in project root - Verify API key format (no quotes, no spaces)
- Ensure environment variables are loaded
- Try restarting your terminal
Getting Help
If you're still having issues:
- Check the FAQ
- Search GitHub Issues
- Create a new issue with:
- Your OS and Python version
- Full error message
- Steps to reproduce
Next Steps
Now that XunLong is installed:
- 📖 Read the Getting Started Guide
- 🏗️ Understand the Architecture
- 📊 Try Report Generation
- 📖 Explore Fiction Writing
- 🎨 Create PPT Presentations