aeolusguan / NMRF

[CVPR 2024] Neural Markov Random Field for Stereo Matching
MIT License
101 stars 5 forks source link

Failed to establish the environment: The detected CUDA version (10.1) mismatches the version that was used to compile PyTorch (11.7). Please make sure to use the same CUDA versions. #7

Closed Sissi-lu closed 1 day ago

Sissi-lu commented 2 days ago

Hi, thanks for your wonderful work!

When I establish the environment for running the ops/make.sh. A error occurs as follows:

The detected CUDA version (10.1) mismatches the version that was used to compile PyTorch (11.7). Please make sure to use the same CUDA versions.

However, I have installed the exact pytorch==1.13 and cuda version==11.7. image

How can I solve this problem?

Thanks in advance!

aeolusguan commented 2 days ago

please check the cuda version under the directory from torch.utils import cpp_extension; print(cpp_extension.CUDA_HOME).

Sissi-lu commented 2 days ago

Thank you for your quick response. I checked in this way and found out it is usr/local/cuda-10.1. So what can I do next? Thanks again.

aeolusguan commented 1 day ago

A simple workaround maybe creating a symbolic link to your installed cuda-11.7, i.e., cd /usr/local; sudo ln -s /your/path/to/cuda-11.7 cuda.

Sissi-lu commented 1 day ago

Hi, thank you for your response. I cannot use the sudo order, so I found another way to solve this problem. Write in here to remind me:

  1. conda activate NMRF
  2. select the right cuda-nvcc version in https://anaconda.org/nvidia/repo, e.g., and install with conda conda install nvidia/label/cuda-11.7.0::cuda-nvcc
  3. select the right cuda-libraries-dev in https://anaconda.org/nvidia/cuda-libraries-dev, e.g., conda install nvidia/label/cuda-11.7.0::cuda-libraries-dev
  4. then, running this: export CUDA_HOME=/your/environment/path
  5. run the setup.py to see if there is any wrong
  6. according to the specific error, set the symbolic link to the environment, .e.g., export LD_LIBRARES_PATH=/xxxx/.conda/envs/NMRF/lib ls -la /xxx/.conda/envs/NMRF/lib/libcudart.so

Thank you again for helping me identify the difference between torch.version.cuda and cpp_extension.CUDA_HOME.