Skip to content

Instantly share code, notes, and snippets.

@jimlinntu
Last active June 4, 2025 05:36
Show Gist options
  • Select an option

  • Save jimlinntu/d685de7352a878989125f04fe1289be1 to your computer and use it in GitHub Desktop.

Select an option

Save jimlinntu/d685de7352a878989125f04fe1289be1 to your computer and use it in GitHub Desktop.
Dockerfile for colmap
FROM nvidia/cuda:11.7.1-devel-ubuntu22.04
ARG COLMAP_VERSION=3.8
ARG CUDA_ARCHITECTURES=75
# Prevent stop building ubuntu at time zone selection.
ENV DEBIAN_FRONTEND=noninteractive
# Prepare and empty machine for building.
RUN apt-get update && apt-get install -y \
git \
cmake \
ninja-build \
build-essential \
libboost-program-options-dev \
libboost-filesystem-dev \
libboost-graph-dev \
libboost-system-dev \
libboost-test-dev \
libeigen3-dev \
libflann-dev \
libfreeimage-dev \
libmetis-dev \
libgoogle-glog-dev \
libgflags-dev \
libsqlite3-dev \
libglew-dev \
qtbase5-dev \
libqt5opengl5-dev \
libcgal-dev \
libceres-dev
# Build and install COLMAP.
RUN git clone https://github.com/colmap/colmap.git
RUN cd colmap && \
git reset --hard ${COLMAP_VERSION} && \
mkdir build && \
cd build && \
cmake .. -GNinja -DCMAKE_CUDA_ARCHITECTURES=${CUDA_ARCHITECTURES} && \
ninja && \
ninja install && \
cd .. && rm -rf colmap
@jimlinntu
Copy link
Copy Markdown
Author

ARG CUDA_ARCHITECTURES=75 is obtained from:

$ docker run -it --rm --gpus all nvidia/cuda:12.2.0-runtime-ubuntu22.04  nvidia-smi --query-gpu=compute_cap --format=csv
...
compute_cap
7.5

which result in 75 (from 7.5)

Ref: colmap/colmap#2464

@jimlinntu
Copy link
Copy Markdown
Author

jimlinntu commented Jun 4, 2025

Encounter this during:
Downloading vocab tree... ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━╸ 100% 0:00:01 ────────────────────────────────────────────── 💀 💀 💀 ERROR 💀 💀 💀 ─────────────────────────────────────────────── Error running command: /mnt/jim/colmap_dir/docker_colmap vocab_tree_matcher --database_path .../preprocess_dataset2/colmap/database.db --SiftMatching.use_gpu 1 --VocabTreeMatching.vocab_tree_path "/home/jimlin7777/.local/share/nerfstudio/vocab_tree.fbow" ────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────`

I think this is due to NerfStudio's fixed vocab

https://github.com/nerfstudio-project/nerfstudio/blob/2adcc380c6c846fe032b1fe55ad2c960e170a215/nerfstudio/process_data/colmap_utils.py#L76

E0604 04:49:52.877377    28 visual_index.cc:665] Check failed: file_version == 1 (32762 vs. 1) Failed to read faiss index. This may be caused by reading a legacy flann-based index, because COLMAP switched from flann to faiss in May 2025. If you want to upgrade your existing flann-based index to faiss, you can check out COLMAP commit c7a58462b813e406c304a9dafb475b87036924cf and apply the vocab_tree_upgrader command.
terminate called after throwing an instance of 'std::invalid_argument'
  what():  [visual_index.cc:665] Check failed: file_version == 1 (32762 vs. 1) Failed to read faiss index. This may be caused by reading a legacy flann-based index, because COLMAP switched from flann to faiss in May 2025. If you want to upgrade your existing flann-based index to faiss, you can check out COLMAP commit c7a58462b813e406c304a9dafb475b87036924cf and apply the vocab_tree_upgrader command.
*** Aborted at 1749012592 (unix time) try "date -d @1749012592" if you are using GNU date ***
PC: @                0x0 (unknown)
*** SIGABRT (@0x3e900000001) received by PID 1 (TID 0x7efe331db000) from PID 1; stack trace: ***
    @     0x7efe412c5046 (unknown)
    @     0x7efe3f008520 (unknown)
    @     0x7efe3f05c9fc pthread_kill
    @     0x7efe3f008476 raise
    @     0x7efe3efee7f3 abort
    @     0x7efe3f398b9e (unknown)
    @     0x7efe3f3a420c (unknown)
    @     0x7efe3f3a4277 std::terminate()
    @     0x7efe3f3a44d8 __cxa_throw
    @     0x559c189efde2 colmap::LogMessageFatalThrow<>::~LogMessageFatalThrow()
    @     0x559c18a87f9c colmap::retrieval::VisualIndex::Read()
    @     0x559c18faf7ac colmap::VocabTreePairGenerator::VocabTreePairGenerator()
    @     0x559c18a4a5d8 _ZNSt17_Function_handlerIFSt10unique_ptrIN6colmap13PairGeneratorESt14default_deleteIS2_EEvEZNS1_29CreateVocabTreeFeatureMatcherERKNS1_24VocabTreeMatchingOptionsERKNS1_19SiftMatchingOptionsERKNS1_22TwoViewGeometryOptionsERKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEEEUlvE_E9_M_invokeERKSt9_Any_data
    @     0x559c18a4bd82 colmap::(anonymous namespace)::FeatureMatcherThread::Run()
    @     0x559c18b6b8c6 colmap::Thread::RunFunc()
    @     0x7efe3f3d2253 (unknown)
    @     0x7efe3f05aac3 (unknown)
    @     0x7efe3f0eba04 clone

Trying to downgrade to colmap 3.8 from colmap/colmap@43de802

Might need to refer to older Dockerfile: https://github.com/colmap/colmap/blob/43de802cfb3ed2bd155150e7e5e3e8c8dd5aaa3e/docker/Dockerfile

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment