在使用鏡像新建了一個(gè)cuda11.2-python3.9
容器配置環(huán)境的過程中需要安裝PyTorch。一開始我直接使用 pip install torch
來進(jìn)行安裝,但是運(yùn)行程序時(shí)出現(xiàn)報(bào)錯(cuò):
RuntimeError: The NVIDIA driver on your system is too old (found version 11020). Please update your GPU driver by downloading and installing a new version from the URL: http://www.nvidia.com/Download/index.aspx Alternatively, go to: https://pytorch.org to install a PyTorch version that has been compiled with your version of the CUDA driver.
這個(gè)錯(cuò)誤表明目前系統(tǒng)上安裝的 NVIDIA 驅(qū)動(dòng)程序版本太舊,不滿足 PyTorch 對(duì) cuda驅(qū)動(dòng)程序的要求。根據(jù)提示我們可以選擇更新NVIDIA 驅(qū)動(dòng),或者安裝適當(dāng)版本的PyTorch。這里我選擇了更新PyTorch。
首先通過 nvcc -V
指令查看cuda版本,得知為版本11.2
在官方安裝pytorch2.0的文檔中,最低cuda版本為11.8.因此我們需要安裝一個(gè)舊版pytorch文章來源:http://www.zghlxwxcb.cn/news/detail-759968.html
在官方的舊版pytorch與cuda版本對(duì)應(yīng)中可以找到支持版本11.2以下的最高版本是v1.12.1,通過安裝指令:文章來源地址http://www.zghlxwxcb.cn/news/detail-759968.html
# CUDA 10.2
conda install pytorch==1.12.1 torchvision==0.13.1 torchaudio==0.12.1 cudatoolkit=10.2 -c pytorch
到了這里,關(guān)于使用ubuntu cuda11.2安裝pytorch的文章就介紹完了。如果您還想了解更多內(nèi)容,請(qǐng)?jiān)谟疑辖撬阉鱐OY模板網(wǎng)以前的文章或繼續(xù)瀏覽下面的相關(guān)文章,希望大家以后多多支持TOY模板網(wǎng)!