Skip to content

[CRITICAL BUILD FAILURE] simple-knn / gaussian_rasterizer compilation fails with 'ModuleNotFoundError: No module named 'torch' #24

@juhwan0423

Description

@juhwan0423

Hello,
Thank you for open-sourcing MAGiC-SLAM. I am attempting to set up the environment on a multi-GPU Windows/WSL2 machine but
am countering a persistent and critical failure during dependency installation.
The issue is that the PyTorch C++ extension build process for simple-knn and gaussian_rasterizer fails to recognize the installed torch module.

  1. Environment Details

Host OS: Windows 10 Pro / WSL2 (Ubuntu)
Hardware:** NVIDIA RTX A6000 * 4 (Multi-GPU setup)
Installation Method: Miniconda3 / Conda Virtual Environment (following the official guide)
Target Versions (Official Requirements):
* Python: 3.11
* PyTorch: 2.5.1 (with CUDA 12.4 / 12.1 / 11.8 (I tried everything))
* Faiss-GPU: 1.8.0

  1. Steps to Reproduce

The build fails at the pip install -r requirements.txt stage, specifically when attempting to compile the PyTorch extensions.

  1. Create Conda Environment: conda create -n magic-slam python=3.11

  2. Install Core Dependencies: conda install pytorch==2.5.1 ... faiss-gpu=1.8.0 ... -c pytorch -c nvidia -c conda-forge -y (This step succeeds after resolving channel conflicts.)

  3. Attempt Pip Install: pip install -r requirements.txt

  4. Detailed Error Log (Root Cause)

The installation fails with a subprocess-exited-with-error where the core failure reason is: ModuleNotFoundError: No module named 'torch'
This occurs during the 'getting requirements to build wheel' phase for simple_knn. Also, gaussian-rasterizer too.
Even if I detoured that error with --no-build-isolation, the build can be done but gaussian-rasterizer makes an error in the runtime.

  1. Technical Analysis and Attempts to Fix

The root cause appears to be a conflict between the project's build system (setup.py / pyproject.toml) and modern Pip's Isolated Build Environment:

  1. Torch Exists: torch is confirmed to be installed and available at the Conda path (/home/han/miniconda3/envs/magic-slam/lib/python3.11/site-packages).
  2. Path Loss: The temporary sub-process Pip creates for building simple-knn fails to inherit the necessary PYTHONPATH from the active Conda environment.
  3. Workaround Failure: Standard workarounds, including manually exporting PYTHONPATH and using the --no-build-isolation flag, do not resolve the issue, indicating a deeper dependency issue within the extension's setup script.

Furthermore, running a simple import fails inside the Conda environment build process:

Traceback points to:

from torch.utils.cpp_extension import CUDAExtension, BuildExtension
... which fails because 'torch' cannot be found by the subprocess.

  1. Request for Guidance
    Could you please provide guidance or look into updating the build configuration for simple-knn and gaussian_rasterizer to explicitly handle modern Pip's isolation mechanism?

Perhaps specifying required CUDA paths within the setup script, or providing a Conda package for simple-knn, would resolve this persistent issue across different Linux distributions.

Thank you for your time and assistance!

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions