Getting started

Installation

Prerequisites

  • We strongly recommend you install theseus in a venv or conda environment with Python 3.8-3.10.

  • Theseus requires torch installation. To install for your particular CPU/CUDA configuration, follow the instructions in the PyTorch website.

  • For GPU support, Theseus requires nvcc to compile custom CUDA operations. Make sure it matches the version used to compile pytorch with nvcc --version. If not, install it and ensure its location is on your system’s $PATH variable.

  • Theseus also requires suitesparse, which you can install via:
    • sudo apt-get install libsuitesparse-dev (Ubuntu).

    • conda install -c conda-forge suitesparse (Mac).

Installing

pypi

pip install theseus-ai

We currently provide wheels with our CUDA extensions compiled using CUDA 11.6 and Python 3.10. For other CUDA versions, consider installing from source or using our build script.

Note that pypi installation doesn’t include our experimental Theseus Labs. For this, please install from source.

From source

The simplest way to install Theseus from source is by running the following (see further below to also include BaSpaCho)

git clone https://github.com/facebookresearch/theseus.git
pip install -e .
python -m pytest tests

If you are interested in contributing to theseus, instead install using

pip install -e ".[dev]"

and follow the more detailed instructions in CONTRIBUTING.

Installing BaSpaCho extensions from source By default, installing from source doesn’t include our BaSpaCho sparse solver extension. For this, follow these steps:

  1. Compile BaSpaCho from source following instructions here. We recommend using flags -DBLA_STATIC=ON -DBUILD_SHARED_LIBS=OFF.

  2. Run

    
    

    git clone https://github.com/facebookresearch/theseus.git && cd theseus BASPACHO_ROOT_DIR=<path/to/root/baspacho/dir> pip install -e .

    where the BaSpaCho root dir must have binaries in the subdirectory build.

Unit tests

With dev installation, you can run unit tests via

python -m pytest tests

By default, unit tests include tests for our CUDA extensions. You can add the option -m “not cudaext” to skip them when installing without CUDA support. Additionally, the tests for sparse solver BaSpaCho are automatically skipped when its extlib is not compiled.

Tutorials

See tutorials and examples to learn about the API and usage.