Installation
================

**Requirements**

* Python >= 3.9
* Numpy >= 1.9
* Scipy >= 1.7
* scikit-learn

**Optional (but strongly recommended) dependencies**

* Cupy


**Installation**

Starting with version 0.4.5, xGPR is available for certain platforms as a
precompiled binary / wheel. To install, run:::

  pip install xGPR

Wheels are available only for Python >= 3.9, for 64 bit Linux and (if you want to
use GPU, which is recommended for training) Cuda 11 or later.
You can install the binary even if you do not have a Cuda GPU; without a
Cuda GPU, however, xGPR will only run in CPU-only mode.


**Compiling from source**


If you are using another unsupported platform or if you encounter an error
with installation of the pre-built binary, you can compile from source. This
is the best option in general because it ensures the package is optimized
for your particular platform but is slightly trickier. To do this, run:::

  pip install --no-binary xGPR xGPR --verbose

We recommend running with the ``--verbose`` flag since this will ensure that
any error messages generated by CMake as it tries to compile the code are
printed to your terminal.

Note that xGPR is built by CMake. CMake will automatically try to find
appropriate compilers (a C++ compiler and if present nvcc for cuda code).
This means that your C++ compiler and nvcc should be in a known location. So, for
example, if your compiler is g++, if you run:::

  g++ --version
  nvcc --version

on your command line, you should get something that is not ``nvcc not found``.
If it cannot find a C++ compiler, xGPR will not compile. If it cannot find
nvcc, it *will* compile but the resulting package will be CPU-only (i.e. you
will not be able to run xGPR on Cuda). If CMake could not find nvcc and
required dependencies, you will see the message:::

  No CUDA

early on in the output if you run ``pip`` with the ``--verbose`` flag. If this
occurs, the best thing to do is to check your cuda installation and make sure
that:::

  nvcc --version

returns a valid version.

Also note that while in principle there is nothing to
prevent xGPR from being compiled for Windows / Mac, we have not done any testing
on these platforms at this time, so it may be possible to encounter issues we
have not yet encountered when compiling for these platforms.

If you encounter problems you are not able to resolve, please report an issue
on github -- see the contact / about section on the main page.
