# COLMAP Installation Fix for Hugging Face Spaces ## Problem COLMAP cannot be installed via pip - it's a system-level dependency. ## Solution ### Files to Upload to Your Hugging Face Space: 1. **requirements.txt** - Updated (removed colmap) 2. **packages.txt** - NEW FILE (installs COLMAP via apt-get) 3. **app-10.py** - Your existing app (no changes needed) ### Steps to Fix: 1. In your Hugging Face Space repository, replace the old `requirements.txt` with the new one 2. Add the new `packages.txt` file to the root directory of your Space 3. Commit the changes ### What These Files Do: - **requirements.txt**: Installs Python packages via pip - Removed: `colmap` (not a Python package!) - **packages.txt**: Installs system packages via apt-get - Added: `colmap` (system dependency) ## Build Time Warning Installing COLMAP will increase your Space's build time by 1-3 minutes. This is normal. ## GPU Requirements Your app uses: - COLMAP (GPU-accelerated feature extraction) - NeRF training (requires GPU) Make sure your Space is set to use GPU hardware: 1. Go to Space Settings 2. Select "GPU" under Hardware 3. Choose an appropriate GPU tier (T4 or better recommended) ## Testing COLMAP Installation After the Space builds successfully, you can verify COLMAP is installed by checking the logs. Your app already has a check at line 94: ```python result = subprocess.run(["which", "colmap"], capture_output=True, text=True) if result.returncode != 0: return {"status": "colmap_not_found", "message": "COLMAP not installed"} ``` ## Alternative: Custom Dockerfile If `packages.txt` doesn't work for some reason, you can use a custom Dockerfile instead. Let me know if you need help with that approach. ## Troubleshooting ### If COLMAP still not found: - Check the build logs for apt-get errors - Verify `packages.txt` is in the root directory - Make sure there are no extra spaces in packages.txt ### If nerfstudio doesn't work: You may need to add additional system dependencies to packages.txt: ``` colmap libgl1-mesa-glx libglib2.0-0 ``` ### Memory Issues: NeRF training is memory-intensive. If you get OOM errors: - Reduce `max_frames_slider` default (try 50 instead of 100) - Reduce `iterations_slider` default (try 1000 instead of 2000) - Use a larger GPU tier in Space settings ## Expected Build Output After fixing, your build should show: ``` --> RUN apt-get update && apt-get install -y colmap ... ✓ Successfully installed colmap --> RUN pip install --no-cache-dir -r requirements.txt ✓ Successfully installed gradio opencv-python-headless numpy Pillow nerfstudio torch torchvision ``` ## Questions? If you continue having issues, check: 1. Are both files in the root directory? 2. Is packages.txt correctly formatted (just "colmap" on one line)? 3. Did you commit and push the changes?