Installation¶
This guide covers how to install Spectrans for both usage and development.
Platform Requirements¶
Important: Spectrans currently supports Linux and macOS only. Windows is not supported at this time.
Requirements¶
Spectrans requires Python 3.13 or later and has the following dependencies:
- PyTorch: >= 2.5.0 (for neural network operations)
- NumPy: >= 2.0.0 (for numerical computations)
- Pydantic: >= 2.0.0 (for configuration management)
- PyYAML: >= 6.0.2 (for YAML configuration files)
- einops: >= 0.8.0 (for tensor operations)
Installation Options¶
Option 1: Install from PyPI (Recommended for Users)¶
This installs the latest stable version from PyPI with all required dependencies.
Option 2: Development Installation¶
For contributors or users who want the latest features:
Step 1: Clone the Repository¶
Step 2: Create Virtual Environment¶
We recommend using Python 3.13 with a virtual environment:
# Create virtual environment
python3.13 -m venv venv
# Activate virtual environment
source venv/bin/activate # On macOS/Linux
# or
venv\Scripts\activate # On Windows
Step 3: Install in Development Mode¶
This installs:
- The main package in editable mode
- Development dependencies (pytest, mypy, ruff, etc.)
- Documentation dependencies (mkdocs, etc.)
Verify Installation¶
Test your installation by running:
import spectrans
import torch
# Check version
print(f"Spectrans version: {spectrans.__version__}")
# Quick functionality test
from spectrans.models import FNet
model = FNet(
vocab_size=1000,
hidden_dim=256,
num_layers=6,
max_sequence_length=128,
num_classes=2
)
# Test forward pass
input_ids = torch.randint(0, 1000, (2, 64))
output = model(input_ids=input_ids)
print(f"Output shape: {output.shape}") # Should be (2, 2)
print("✓ Installation successful!")
Development Setup¶
For contributors and developers, see the Contributing Guide for complete development setup instructions including pre-commit hooks, testing, and code quality tools.
GPU Support¶
Spectrans automatically uses CUDA if available:
Getting Help¶
If you encounter installation issues:
- Ensure you're using Python 3.13+
- Try reinstalling:
pip install --upgrade spectrans - Check existing issues
- For development setup, see the Contributing Guide
Next Steps¶
- Follow the Quick Start Guide to build your first model
- See the Contributing Guide for development setup
- Explore Examples for common use cases
- Read the API Reference for detailed documentation