open-mmlab / mmcv

OpenMMLab Computer Vision Foundation
https://mmcv.readthedocs.io/en/latest/
Apache License 2.0
5.92k stars 1.66k forks source link

[Bug] Windows - failed to build mmcv using pip in conda #3017

Closed DemersM closed 10 months ago

DemersM commented 10 months ago

Prerequisite

Environment

OS: Windows 10 Virtual env: Conda CUDA: 11.8 Pytorch: 2.1.2

Reproduces the problem - code sample

``

Reproduces the problem - command or script

(c:\conda\openmmlab) H:\>conda install cuda -c nvidia/label/cuda-11.8.0
c:\conda\openmmlab) H:\>nvcc --version
nvcc: NVIDIA (R) Cuda compiler driver
Copyright (c) 2005-2022 NVIDIA Corporation
Built on Wed_Sep_21_10:41:10_Pacific_Daylight_Time_2022
Cuda compilation tools, release 11.8, V11.8.89
Build cuda_11.8.r11.8/compiler.31833905_0
(c:\conda\openmmlab) H:\>conda install pytorch torchvision torchaudio pytorch-cuda=11.8 -c pytorch -c nvidia
(c:\conda\openmmlab) H:\>python
Python 3.11.7 | packaged by Anaconda, Inc. | (main, Dec 15 2023, 18:05:47) [MSC v.1916 64 bit (AMD64)] on win32
Type "help", "copyright", "credits" or "license" for more information.
>>> import torch
>>> torch.__version__
'2.1.2'
(c:\conda\openmmlab) H:\>pip install "mmcv>=2.0.0" -f https://download.openmmlab.com/mmcv/dist/cu118/torch2.1.2/index.html

Reproduces the problem - error message

      C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v11.0\include\crt/host_config.h(158): fatal error C1189: #error:  -- unsupported Microsoft Visual Studio version! Only the versions between 2015 and 2019 (inclusive) are supported!
      active_rotated_filter_cuda.cu
      error: command 'C:\\Program Files\\NVIDIA GPU Computing Toolkit\\CUDA\\v11.0\\bin\\nvcc.exe' failed with exit code 2
      [end of output]

  note: This error originates from a subprocess, and is likely not a problem with pip.
  ERROR: Failed building wheel for mmcv
  Running setup.py clean for mmcv
Failed to build mmcv
ERROR: Could not build wheels for mmcv, which is required to install pyproject.toml-based projects

Additional information

Failed to build mmcv using pip in conda environment, because pip is using wrong nvcc installation from Windows instead of nvcc installed within conda environment.

I cannot use mim because I dont have enough privilege and I got Access denied error.

I would expect the build to use nvcc that was installed in the conda environement instead of the C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v11.0\bin\nvcc.exe