Installing gsplat and Preparing for Training

Verify that CUDA Toolkit is installed

Before installing PyTorch or building gsplat, verify that the CUDA Toolkit is installed and accessible. In Command Prompt, run:

nvcc --version

If installed correctly, you should see output similar to:

nvcc: NVIDIA (R) Cuda compiler driver
Copyright (c) 2005-2024 NVIDIA Corporation
Built on Fri_Jun_14_16:44:19_Pacific_Daylight_Time_2024
Cuda compilation tools, release 12.6, V12.6.20
Build cuda_12.6.r12.6/compiler.34431801_0

If the command is not recognized or no version is shown, install the CUDA Toolkit from the NVIDIA website. Older versions are available from the CUDA Toolkit archive.

Open a developer-enabled terminal

To build gsplat, use a terminal with the Visual C++ environment initialized.

Option A: Developer Command Prompt

  • Open the Start Menu
  • Launch: Developer Command Prompt for VS 2022

Option B: Use vcvars64.bat manually

  • Open Command Prompt
  • Run the setup script (adjust the path if needed):
"C:\Program Files (x86)\Microsoft Visual Studio\2022\BuildTools\VC\Auxiliary\Build\vcvars64.bat"

After running the script, the terminal will be configured with the necessary environment variables.

Create and activate a Conda environment

If not installed, download Miniconda or Anaconda.

Create and activate a new environment:

conda create -y -n gsplat python=3.10
conda activate gsplat

Install PyTorch with CUDA support

Visit the PyTorch installation page and choose the configuration matching your Python and CUDA version.

For CUDA 12.6, run:

pip install torch torchvision torchaudio --index-url https://download.pytorch.org/whl/cu126

Verify that PyTorch detects CUDA:

python -c "import torch; print(torch.cuda.is_available())"

Expected output:

True

Clone the gsplat repository

git clone --recursive https://github.com/nerfstudio-project/gsplat.git
cd gsplat

Here’s your reviewed and formatted markdown section following the Google Developer Documentation style guide, avoiding em-dashes and using consistent formatting:

Build gsplat

To build gsplat, run the following command:

set DISTUTILS_USE_SDK=1
pip install .

This sets the DISTUTILS_USE_SDK environment variable to avoid the following warning:

UserWarning: It seems that the VC environment is activated but DISTUTILS_USE_SDK is not set...

Install additional dependencies for examples

Navigate to the examples folder and install dependencies:

cd examples
pip install -r requirements.txt

Download example dataset

Clone the dataset repository:

git clone <URL_TO_EXAMPLE_DATA>

Replace <DATA_PATH> and <OUTPUT_PATH> with your actual paths.

Run training

Start training with the following command:

python simple_trainer.py default ^
  --eval_steps -1 ^
  --disable_viewer ^
  --data_factor 4 ^
  --data_dir <DATA_PATH> ^
  --result_dir <OUTPUT_PATH>

Replace <DATA_PATH> and <OUTPUT_PATH> with valid paths. If everything is set up correctly, the script should start and display a training progress bar.

Known issue on Windows: pycolmap binary parsing error

On Windows, you might encounter the following error when running the training script:

Error with pycolmap:
...
num\_cameras = struct.unpack('L', f.read(8))\[0]

This error is caused by mismatched struct unpacking logic in the Windows version. As of this writing, the fix has not yet been merged into the official pycolmap repository. For details, see the related pull request: https://github.com/rmbrualla/pycolmap/pull/2

To work around the issue, uninstall the original package and install a patched version from a community fork:

pip uninstall pycolmap -y
pip install git+https://github.com/mathijshenquet/pycolmap

© 2025 SmartDataScan.
This section is licensed under a Creative Commons Attribution-NonCommercial-ShareAlike 4.0 International License.