# Compiling from Source[[compiling]]

## Linux

To compile from source, you need the following:

* The ability to compile C++ (gcc, make, headers, etc)
* CMake (version 3.22.1 or newer)
* Python 3.10 or newer
* [The CUDA toolkit](https://docs.nvidia.com/cuda/cuda-installation-guide-linux/index.html) (nvcc)

On Ubuntu, install the first two with `apt-get install -y build-essential cmake`.

To install the CUDA toolkit, follow the [instructions from your distro](https://docs.nvidia.com/cuda/cuda-installation-guide-linux/index.html).



To install the package from source, then run

```
pip install -r requirements-dev.txt
cmake -DCOMPUTE_BACKEND=cuda -S .
make
pip install .
```

If you have multiple versions of CUDA installed, or have installed it in a non-standard location, please refer to [cmake CUDA documentation](https://cliutils.gitlab.io/modern-cmake/chapters/packages/CUDA.html) for how to configure the CUDA compiler used.

## Windows

The following is required to install from source on Windows

* [Microsoft Visual Studio](https://visualstudio.microsoft.com/downloads/) with C++ support
* CMake (version 3.22.1 or newer)
* Python 3.10 or newer
* [The CUDA toolkit](https://docs.nvidia.com/cuda/cuda-installation-guide-microsoft-windows/index.html) (nvcc)

To install the CUDA toolkit, follow the [instructions for Windows](https://docs.nvidia.com/cuda/cuda-installation-guide-microsoft-windows/index.html).

To install the package from source, then run
```
pip install -r requirements-dev.txt
cmake -DCOMPUTE_BACKEND=cuda -S .
cmake --build . --config Release
pip install .
```

## Compilation for Kepler Architecture

From version 0.39.1, bitsandbytes no longer includes Kepler binaries in pip installations, requiring manual compilation. Follow the general steps and use `cuda11x_nomatmul_kepler` for Kepler-targeted compilation.
