Error on Google Colab saying Requires CUDA, which is not available on your system

1.1k views Asked by At

I am trying to run the following code on Google colab from this library: https://github.com/colmap/pycolmap I use Google Colab because it offers preinstalled CUDA

output_path: pathlib.Path
image_dir: pathlib.Path

output_path.mkdir()
mvs_path = output_path / "mvs"
database_path = output_path / "database.db"

pycolmap.extract_features(database_path, image_dir)
pycolmap.match_exhaustive(database_path)
maps = pycolmap.incremental_mapping(database_path, image_dir, output_path)
maps[0].write(output_path)
# dense reconstruction
pycolmap.undistort_images(mvs_path, output_path, image_dir)
pycolmap.patch_match_stereo(mvs_path)  # requires compilation with CUDA
pycolmap.stereo_fusion(mvs_path / "dense.ply", mvs_path)


However, I am getting error saying : Dense stereo reconstruction requires CUDA, which is not available on your system.

  ----> 2 pycolmap.patch_match_stereo(mvs_path)  # requires compilation with CUDA
          3 pycolmap.stereo_fusion(mvs_path / "dense.ply", mvs_path)
    
    RuntimeError: [mvs.cc:38] ERROR: Dense stereo reconstruction requires CUDA, which is not available on your system.

Can someone explain why? Thank you.

When I check for CUDA, it says available

nvcc: NVIDIA (R) Cuda compiler driver
Copyright (c) 2005-2022 NVIDIA Corporation
Built on Wed_Sep_21_10:33:58_PDT_2022
Cuda compilation tools, release 11.8, V11.8.89
Build cuda_11.8.r11.8/compiler.31833905_0

I have also selected GPU using the following Go to Menu > Runtime > Change runtime.

1

There are 1 answers

0
DoneForAiur On BEST ANSWER

According to the documentation:

Note that the COLMAP packages in the default repositories for Linux/Unix/BSD do not come with CUDA support, which requires manual compilation but is relatively easy on these platforms.

There's the steps to install it from source with CUDA enabled.

!git clone https://github.com/colmap/colmap.git
!cd colmap
!git checkout dev
!mkdir build
!cd build
!cmake ..