Environment:Lucidrains X transformers Python Environment
| Knowledge Sources | |
|---|---|
| Domains | Infrastructure |
| Last Updated | 2026-02-08 18:00 GMT |
Overview
Python 3.9+ environment with pip for installing the x-transformers package and its dependencies.
Description
This environment defines the base Python runtime required to install and use x-transformers. The package is distributed via PyPI and requires Python 3.9 or newer. It uses hatchling as the build backend. This is the minimal environment needed for the `pip install x-transformers` command and is a prerequisite for the PyTorch_CUDA environment.
Usage
Use this environment as the first step in any x-transformers workflow. The Pip_Install implementation requires this environment to be set up before any package installation can occur.
System Requirements
| Category | Requirement | Notes |
|---|---|---|
| OS | Any (Linux, macOS, Windows) | Platform-independent Python package |
| Python | >= 3.9 | Specified in pyproject.toml `requires-python` |
| Disk | 500MB | For package and dependencies installation |
| Build System | pip + hatchling | hatchling is the build backend |
Dependencies
System Packages
- Python 3.9+
- pip (any recent version)
Python Packages
Installed automatically by `pip install x-transformers`:
- `einx` >= 0.3.0
- `einops` >= 0.8.0
- `loguru`
- `packaging` >= 21.0
- `torch` >= 2.0
Credentials
No credentials required for basic installation.
For publishing to PyPI (maintainers only):
- `PYPI_TOKEN`: PyPI API token (used in `.github/workflows/python-publish.yml`)
Quick Install
# Ensure Python 3.9+
python --version
# Install from PyPI
pip install x-transformers
Code Evidence
Python version requirement from `pyproject.toml:9`:
requires-python = ">= 3.9"
Core dependencies from `pyproject.toml:24-30`:
dependencies = [
'einx>=0.3.0',
'einops>=0.8.0',
'loguru',
'packaging>=21.0',
'torch>=2.0',
]
Build system from `pyproject.toml:51-53`:
[build-system]
requires = ["hatchling"]
build-backend = "hatchling.build"
Common Errors
| Error Message | Cause | Solution |
|---|---|---|
| `Python requires >= 3.9` | Python version too old | Install Python 3.9+ from python.org or via pyenv |
| `No matching distribution found for torch>=2.0` | Pip cannot find compatible PyTorch wheel | Check platform compatibility; use `--index-url` for PyTorch wheels |
| `ModuleNotFoundError: No module named 'x_transformers'` | Package not installed | `pip install x-transformers` |
Compatibility Notes
- pyproject.toml classifiers mention Python 3.6 but `requires-python` enforces >= 3.9. The classifier is outdated.
- Optional dependency groups: `examples` (for training scripts), `flash-pack-seq` (for flash attention packed sequences), `test` (for pytest).