# Installation

Available for Python 2.7, 3.5, 3.6, 3.7, 3.8 and Linux, Mac, Windows. Requires PyTorch 1.2.0, 1.3.0, 1.3.1, 1.4.0 or 1.5.0.

Install via:

    pip install signatory==<SIGNATORY_VERSION>.<TORCH_VERSION> --no-cache-dir --force-reinstall

where `<SIGNATORY_VERSION>` is the version of Signatory you would like to download (the most recent version is 1.2.1) and `<TORCH_VERSION>` is the version of PyTorch you are using.

Example

For example, if you are using PyTorch 1.3.0 and want Signatory 1.1.4, then you should run:

    pip install signatory==1.1.4.1.3.0 --no-cache-dir --force-reinstall

Yes, this looks a bit odd. This is needed to work around limitations of PyTorch and pip.

Take care not to run `pip install signatory`, as this will likely download the wrong version.

The `--no-cache-dir --force-reinstall` flags are because `pip` doesn’t expect to need to care about versions quite as much as this, so it will sometimes erroneously use inappropriate caches if not told otherwise.

After installation, just `import signatory` inside Python.

If you have any problems with installation then check the FAQ [link redacted for anonymity; see ‘docs’ folder of supplementary material]. If that doesn’t help then feel free to open an issue [link redacted for anonymity; see ‘docs’ folder of supplementary material].

## Install from source

For most use-cases, the prebuilt binaries available as described above should be sufficient. However installing from source is also perfectly feasible, and usually not too tricky.

You’ll need to have a C++ compiler installed and known to `pip`, and furthermore this must be the same compiler that PyTorch uses. (This is `msvc` on Windows, `gcc` on Linux, and `clang` on Macs.) You must have already installed PyTorch. (You don’t have to compile PyTorch itself from source, though!)

Then run either

    pip install signatory==<SIGNATORY_VERSION>.<TORCH_VERSION> --no-binary signatory

(where `<SIGNATORY_VERSION>` and `<TORCH_VERSION>` are as above.)

or

    git clone [link redacted for anonymity]
    cd signatory
    python setup.py install

If you chose the first option then you’ll get just the files necessary to run Signatory.

If you choose the second option then tests, benchmarking code, and code to build the documentation will also be provided. Subsequent to this,

- Tests can be run, see `python command.py test --help`.
  This requires installing iisignature and pytest.
- Speed and memory benchmarks can be performed, see `python command.py benchmark --help`.
  This requires installing matplotlib, iisignature, esig, and memory profiler.
- Documentation can be built via `python command.py docs`.
  This requires installing Sphinx, sphinx_rtd_theme and py2annotate.

Note

If on Linux then the commands stated above should probably work.

If on Windows then it is probably first necessary to run a command of the form

    "C:/Program Files (x86)/Microsoft Visual Studio/2017/Enterprise/VC/Auxiliary/Build/vcvars64.bat"

(the exact command will depend on your operating system and version of Visual Studio).

If on a Mac then the installation command should instead look like either

    MACOSX_DEPLOYMENT_TARGET=10.9 CC=clang CXX=clang++ pip install signatory==<SIGNATORY_VERSION>.<TORCH_VERSION> --no-binary signatory

or

    MACOSX_DEPLOYMENT_TARGET=10.9 CC=clang CXX=clang++ python setup.py install

depending on the choice of installation method.

A helpful point of reference for getting this to work might be the official build scripts [link redacted for anonymity, see ‘code/.github/workflows’ in supplementary material] for Signatory.

Note that PyTorch does not support the following combinations, so Signatory doesn’t either:

- Windows and Python 2.7

- Windows and Python 3.5 and PyTorch 1.4, 1.5

- Python 2.7 and PyTorch 1.5

- Python 3.8 and PyTorch 1.2, 1.3, 1.3.1