環境
- Anaconda 4.10.3
- Microsoft Windows 10.0.22000.318(21H2)
- PowerShell 7.2.0
現象
PyTorchをインストールする際に、PackagesNotFoundError
が出た。
実行例
(test) PS C:\Users\USERNAME> conda install pytorch torchvision torchaudio cpuonly -c pytorch
Collecting package metadata (current_repodata.json): done
Solving environment: failed with initial frozen solve. Retrying with flexible solve.
Collecting package metadata (repodata.json): done
Solving environment: failed with initial frozen solve. Retrying with flexible solve.
PackagesNotFoundError: The following packages are not available from current channels:
- python=3.1
Current channels:
- https://conda.anaconda.org/pytorch/win-64
- https://conda.anaconda.org/pytorch/noarch
- https://repo.anaconda.com/pkgs/main/win-64
- https://repo.anaconda.com/pkgs/main/noarch
- https://repo.anaconda.com/pkgs/r/win-64
- https://repo.anaconda.com/pkgs/r/noarch
- https://repo.anaconda.com/pkgs/msys2/win-64
- https://repo.anaconda.com/pkgs/msys2/noarch
To search for alternate channels that may provide the conda package you're
looking for, navigate to
https://anaconda.org
and use the search bar at the top of the page.
原因
python 3.10 is the find version with two digits in the minor version.
conda doesn't seem to like it. In particular, noarch: python packages
seem to get installed to lib/python/3.1/site-packages instead of
lib/python/3.10/site-packages.
(Not compatible with python 3.10 · Issue #10969 · conda/conda)
Python 3.10はマイナーバージョンが2桁であり、condaが3.10を3.1と認識するようだ。
対応
とりあえず、conda install python=3.9
でPython 3.9をインストールすることで対応した。