Skip to main content

setup

Install virtual environment, dependencies, and initialize database.

Syntax

Options

--skip-deps
flag
Skip dependency installation (useful when re-running setup after manual changes)

What It Does

  1. Creates virtual environment at .venv/ (skips if exists)
  2. Installs Python dependencies from requirements.txt
  3. Installs Playwright Chromium for browser automation
  4. Creates .env file from .env.example (if missing)
  5. Tests data directory permissions by writing a test file
  6. Runs database migrations via Alembic
  7. Configures Claude Code permissions (if using Claude Code agent)

Output

Platform Notes

Linux

Playwright Chromium requires system dependencies. If browser fails to launch:
This command requires sudo as it installs system packages (libglib, libnss3, etc.).

Windows

Use scrapai or scrapai.bat instead of ./scrapai:

Skip Dependencies

Runs migrations and permission checks without reinstalling packages:

verify

Verify environment setup without installing anything. Useful for troubleshooting or CI/CD pipelines.

Syntax

What It Checks

  1. Virtual environment exists at .venv/
  2. Core dependencies installed (scrapy, sqlalchemy, alembic)
  3. Database initialized (checks current Alembic revision)

Output

Success

Missing Setup

Claude Code Permissions

Setup configures Claude Code agent permissions in .claude/settings.local.json.

Allow List

Deny List

These permissions ensure the agent writes config (JSON), not code (Python). This is a core security principle of scrapai’s agent safety model.

Environment Variables

The .env file created by setup:

Troubleshooting

Permission Denied (Linux/macOS)

Make the script executable:

Python Version

Requires Python 3.9 or higher:

Virtual Environment Issues

Delete and recreate:

Database Migration Errors

Check DATABASE_URL in .env and ensure database is accessible:

Next Steps

Spider Management

Import and manage spider configurations

Crawling

Run your first test crawl