본문 바로가기

Error and Solve

[에러 해결] RuntimeError: The detected CUDA version mismatches the version that was used to compile pytorch / pytorch-cuda=11.7 -c pytorch

반응형

 

 

RuntimeError: The detected CUDA version mismatches the version that was used to compile pytorch

 

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

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

 

RuntimeError로, cuda랑 pytorch version이 맞지 않다는 에러가 발생했다 

 

패키지 설치 에러로 이 경우에는 pytorch를 다시 설치해줘야 한다. 

 

 

 

 

 

 

 

해결 : pytorch-cuda=11.7 포함하는 패키지 설치 

 

conda install pytorch==2.0.0 torchvision==0.15.0 torchaudio==2.0.0 pytorch-cuda=11.7 -c pytorch -c nvidia

 

conda install pytorch==2.0.0 torchvision==0.15.0 torchaudio==2.0.0 pytorch-cuda=11.7 -c pytorch -c nvidia

 

 

pytroch 관련 패키지를 설치할 때 pytorch-cuda=11.7 -c pytorch 를 꼭 포함시키도록 하자  

 

그리고 뒤에 관련 패키지도 모두 cuda 11.7로 정했으면 11.7에 맞게 설치해야 한다. 

 

 

 

 

 

참고로 nvidia-smi 했을 때 나오는 하드웨어의 cuda 버전보다 패키지의 cuda 버전이 살짝 낮아도 된다. 

높아서는 안된다.

 

 

 

 


참고 

https://velog.io/@jk01019/pytorch-%EC%84%A4%EC%B9%98

 

 

 

끝.

반응형