Linuxでcuda用torchをインストールするにはどうすればよいですか?

Linuxでcuda用torchをインストールするにはどうすればよいですか?

cuda用のpytorchをインストールしたいのですが、パッケージの競合が発生します。この問題をどのように解決しますか?

$ uname -r
3.10.0-1160.71.1.el7.x86_64

$ python -c "import torch; print(torch.version.cuda)"
None

$ nvidia-smi
Tue May  9 10:56:44 2023       
+-----------------------------------------------------------------------------+
| NVIDIA-SMI 470.57.02    Driver Version: 470.57.02    CUDA Version: 11.4     |

$ python --version
Python 3.11.3

$ conda install -y pytorch==1.9

Found conflicts! Looking for incompatible packages.
This can take several minutes.  Press CTRL-C to abort.
failed                                                                                                                                

UnsatisfiableError: The following specifications were found
to be incompatible with the existing python installation in your environment:

Specifications:

  - pytorch==1.9 -> python[version='2.7.*|3.5.*|3.6.*|3.6.12|3.6.12|3.7.10|3.7.10|3.7.12|3.8.12|3.8.16|3.9.16|>=3.10,<3.11.0a0|>=3.11,<3.12.0a0|3.9.10|3.7.9|3.6.9|3.6.9|3.6.9|>=2.7,<2.8.0a0|3.6.9|>=3.5,<3.6.0a0|3.4.*|>=3.8|3.8.*|>=3.7|>=3.6|>=3.5|3.9.*|3.7.*|>=3.6,<3.7',build='1_73_pypy|3_73_pypy|5_73_pypy|1_73_pypy|0_73_pypy|0_73_pypy|5_73_pypy|4_73_pypy|2_73_pypy|0_73_pypy']
  - pytorch==1.9 -> python[version='>=3.6,<3.7.0a0|>=3.7,<3.8.0a0|>=3.8,<3.9.0a0|>=3.9,<3.10.0a0']

Your python: python=3.11

If python is on the left-most side of the chain, that's the version you've asked for.
When python appears to the right, that indicates that the thing on the left is somehow
not available for the python version you are constrained to. Note that conda will not
change your python version to a different minor version unless you explicitly specify
that.

The following specifications were found to be incompatible with your system:

  - feature:/linux-64::__glibc==2.17=0
  - feature:|@/linux-64::__glibc==2.17=0
  - pytorch==1.9 -> __glibc[version='>=2.17|>=2.17,<3.0.a0']

Your installed version is: 2.17

Note that strict channel priority may have removed packages required for satisfiability.

ベストアンサー1

おすすめ記事