# Install KDB-X and the cuVS Module

_This page explains how to install KDB-X with a cuVS-enabled license, install the required dependencies, and run the application on a host or in an NVIDIA container._

## Install KDB-X

Install KDB-X by following the [KDB-X install guide](../../../get_started/kdb-x-install.md).

## Download the cuVS module

> **Note**
>
> These instructions use the default KDB-X installation location `$HOME/.kx`. If you installed KDB-X elsewhere, adjust the commands to match your installation path.
>
Download the cuVS module from the [KX downloads portal](https://portal.dl.kx.com/).
```bash
curl -L -O https://portal.dl.kx.com/assets/raw/kdb-x/modules/cuvs/~latest~/l64-cuvs.zip
```

Extract the contents of the zip file to the KDB-X installation directory. The default location is `$HOME/.kx/mod/kx/cuvs`.
```bash
unzip l64-cuvs.zip -d $HOME/.kx/mod/kx/cuvs/
```

The folder structure looks similar to:
```bash
~/.kx/mod/kx/
├── ai
├── cuvs/l64/cuvs.so ← (cuVS module)
├── kurl
├── objstor
├── pq
└── rest.q_
```

For more information on modules, refer to [modules](../../module-index.md).

## Install dependencies

The cuVS module requires CUDA 13.1 and cuVS 25.10 runtime libraries.

This script will download several gigabytes of CUDA dependencies required for cuVS. Installation time will vary depending on your internet connection speed.

Run the installation script to download and install them:
```bash
cd $HOME/.kx/mod/kx/cuvs/
./install_deps.sh
```

The script prompts for an installation directory. The default is `$HOME/miniforge3`.

> **Note**
>
> Installation may take several minutes and will download several GBs of CUDA dependencies depending on your internet connection.
>
## Configure the library path

Add an alias to scope the library path to the `q` process only:
```bash
alias q='LD_LIBRARY_PATH="$HOME/miniforge3/lib:$LD_LIBRARY_PATH" q'
```

This tells `q` where to find the installed CUDA and cuVS libraries without affecting any other tools in your shell. The installation script manages its own CUDA environment independently of your host system. The CUDA version displayed by `nvidia-smi` reflects your host system's driver and is not affected by this installation.

> **Warning**
>
> Setting `LD_LIBRARY_PATH` globally in your shell profile can cause other system tools to behave unexpectedly, as the dynamic linker will pick up miniforge libraries for every process in the shell. The alias above scopes the path to `q` only, leaving all other tools unaffected.
>
> **Tip**
>
> Add this alias to your `~/.bashrc` or `~/.zshrc` so it persists across sessions. After editing, reload the file:
>
> ```bash
> source ~/.bashrc   # or source ~/.zshrc
> ```
>
## Test the cuVS module

Start a q session and verify that the cuVS module loads:
```q
.cuvs:use`kx.cuvs
```
If the module loads successfully, the command returns without error.
