ubuntu22.04へ非推奨のcuda11.6をインストール
$ sudo apt install --no-install-recommends nvidia-driver-510
$ sudo apt install nvidia-prime
$ sudo apt install nvidia-cuda-toolkit
https://stackoverflow.com/questions/70340812/how-to-install-pytorch-with-cuda-support-with-pip-in-visual-studio
python
Python 3.9.13 (tags/v3.9.13:6de2ca5, May 17 2022, 16:36:42) [MSC v.1929 64 bit (AMD64)] on win32
Type "help", "copyright", "credits" or "license" for more information.
>>> import torch
>>> print(torch.__version__)
1.13.1+cpu
---------------------------
> nvidia-smi
Sat Mar 11 11:43:37 2023
+-----------------------------------------------------------------------------+
| NVIDIA-SMI 510.06 Driver Version: 510.06 CUDA Version: 11.6 |
|-------------------------------+----------------------+----------------------+
pip3 install torch==1.13.1+cu116 -f https://download.pytorch.org/whl/cu116/torch_stable.html
> pip3 install torch==1.13.1+cu116 -f https://download.pytorch.org/whl/cu116/torch_stable.html
Looking in links: https://download.pytorch.org/whl/cu116/torch_stable.html
Collecting torch==1.13.1+cu116
Downloading https://download.pytorch.org/whl/cu116/torch-1.13.1%2Bcu116-cp39-cp39-win_amd64.whl (2434.0 MB)
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 2.4/2.4 GB 562.9 kB/s eta 0:00:00
Requirement already satisfied: typing-extensions in c:\users\ei2k-\appdata\local\packages\pythonsoftwarefoundation.python.3.9_qbz5n2kfra8p0\localcache\local-packages\python39\site-packages (from torch==1.13.1+cu116) (4.0.1)
Installing collected packages: torch
Attempting uninstall: torch
Found existing installation: torch 1.13.1
Uninstalling torch-1.13.1:
Successfully uninstalled torch-1.13.1
Successfully installed torch-1.13.1+cu116
PS C:\Users\ei2k-> python
Python 3.9.13 (tags/v3.9.13:6de2ca5, May 17 2022, 16:36:42) [MSC v.1929 64 bit (AMD64)] on win32
Type "help", "copyright", "credits" or "license" for more information.
>>> import torch
>>> print(torch.__version__)
1.13.1+cu116
>>>