-
Notifications
You must be signed in to change notification settings - Fork 0
Installation
The simplest way to install fastaccess is via pip:
pip install fastaccessThis will install the pure Python version, which works on all platforms with no dependencies.
For better performance (up to 14x faster indexing), install from source to build the C++ backend:
Required:
- Python 3.8 or higher
- C++17 compatible compiler
- CMake 3.15 or higher
- zlib development headers
Platform-specific requirements:
sudo apt-get update
sudo apt-get install -y build-essential cmake zlib1g-dev python3-dev# Install Xcode Command Line Tools
xcode-select --install
# Install CMake via Homebrew (if needed)
brew install cmake- Install Visual Studio 2019 or later with C++ development tools
- Install CMake
- zlib is bundled with most Python distributions on Windows
Clone the repository and install in development mode:
git clone https://github.com/nuniz/FASTAccess.git
cd FASTAccess
pip install -e .Or install development dependencies:
pip install -e ".[dev]"This includes pytest, pytest-cov, and mypy for testing and type checking.
Check if the C++ backend was successfully built:
from fastaccess import using_cpp_backend
if using_cpp_backend():
print("✓ C++ backend is active")
else:
print("✗ Using pure Python backend")| Method | C++ Backend | Use Case |
|---|---|---|
pip install fastaccess |
✗ No | Quick install, no compilation needed |
pip install -e . |
✓ Yes | Best performance, development |
pip install -e ".[dev]" |
✓ Yes | Development with testing tools |
Issue: Installation completes but C++ backend is not available.
Check:
from fastaccess import using_cpp_backend
print(using_cpp_backend()) # Should print TrueCommon causes:
-
Missing compiler
- Linux: Install
build-essential - macOS: Run
xcode-select --install - Windows: Install Visual Studio with C++ tools
- Linux: Install
-
CMake version too old
cmake --version # Should be 3.15+Update via package manager or download from cmake.org
-
Missing zlib headers
- Linux:
sudo apt-get install zlib1g-dev - macOS: Usually included with Xcode
- Windows: Usually included with Python
- Linux:
-
Check build logs
pip install -e . -v # Verbose output
Look for compilation errors in the output.
Issue: ModuleNotFoundError: No module named 'fastaccess'
Solution: Make sure you're in the correct environment:
pip list | grep fastaccessIf not listed, reinstall:
pip install fastaccessIssue: Error when opening .fa.gz files
Check: Python's gzip module (part of stdlib, should always work):
import gzip # Should not raise errorIssue: PermissionError when trying to save .fidx cache
Solution: Use a custom cache directory:
from fastaccess import FastaStore
# FASTA in read-only location
fa = FastaStore("/readonly/genome.fa", cache_dir="/tmp/fasta_cache")- Most compatible platform for C++ backend
- Use system package manager for dependencies
- Works on all major distributions (Ubuntu, Debian, CentOS, Fedora)
- Both Intel (x86_64) and Apple Silicon (arm64) supported
- Xcode Command Line Tools required
- C++ backend builds successfully on macOS 10.15+
- Pure Python backend always works
- C++ backend requires Visual Studio
- Use PowerShell or Command Prompt (not Git Bash) for building
Recommended installation in a virtual environment:
# Using venv
python -m venv fastaccess-env
source fastaccess-env/bin/activate # Linux/macOS
# or
fastaccess-env\Scripts\activate # Windows
pip install fastaccess# Using conda
conda create -n fastaccess python=3.10
conda activate fastaccess
pip install fastaccessTo upgrade to the latest version:
pip install --upgrade fastaccessFrom source:
cd FASTAccess
git pull
pip install -e . --force-reinstallpip uninstall fastaccessThis will remove the package but not the cache files (.fidx files). To also remove cache files, delete them manually:
find /path/to/fasta/files -name "*.fidx" -delete