简体   繁体   中英

Pytorch install with anaconda error

I get this error:

C:\Users>conda install pytorch torchvision -c soumith
Fetching package metadata .............

PackageNotFoundError: Package missing in current win-64 channels:
  - pytorch

I got conda install pytorch torchvision -c soumith from Pytorch official website and I have OSX/conda/3.6/none for settings on Pytorch site(should be correct). I am new to conda, any tips how to solve this?

Update: From PyTorch 0.4, there is an official Anaconda channel with packages for Windows as well. You can install the latest pre-built (binary) version of PyTorch (GPU version by default) on windows using:

conda install -c pytorch pytorch

For CPU only version: conda install -c pytorch pytorch-cpu

For specific version of CUDA say CUDA9.1: conda install -c pytorch pytorch cuda91

Official instructions for windows are now available here

Old answer for previous versions (<0.4) of PyTorch on Windows:

It looks like you are on windows (win 64) and you are trying to install pytorch by choosing OSX because you don't have an option listed for win64 on pytorch site . (Correct me if that is not the case, I will revise my answer). -c soumith will use soumith's channel which only has packages for Linux and OSX not for windows. That is why you got that error when you ran conda from a windows machine.

You can install pytorch on windows through conda using this command:

conda install -c peterjc123 pytorch

This will fetch the pytorch package using peterjc123's channel which has packages for Win64.

You can install the torchvision package using pip like this: pip install torchvision

Use the following commands to install pytorch on windows

for Windows 10 and Windows Server 2016, CUDA 8

conda install -c peterjc123 pytorch cuda80

for Windows 10 and Windows Server 2016, CUDA 9

conda install -c peterjc123 pytorch cuda90

for Windows 7/8/8.1 and Windows Server 2008/2012, CUDA 8

conda install -c peterjc123 pytorch_legacy cuda80

On June,2019, The command generated at pytorch will require dependencies before it can be executed successfully. For example I chose stable pytorch 1.1 build with python 3.6 and Cuda 10.0. The command generated by pytorch page was as follows:

conda install pytorch torchvision cudatoolkit=10.0 -c pytorch

But it will not work if you have created a new conda environment like me. The step by step process for setting up pytorch is as follows:

  • First install the cudatoolkit as follows:

conda install -c anaconda cudatoolkit=10.0

  • Then install the mkl_fft as follows:

conda install -c anaconda mkl_fft

  • Assuming you will face no more dependency issues. Use the following command to setup pytorch:

conda install -c pytorch pytorch

This worked for me. But I had setup my new conda environment with scikit-learn and jupyter notebook before starting the pytorch setup. So if any dependency problem arise, it would be a good idea to install both scikit-learn and jupyter notebook as well.

I have face similar problem because I have installed pytorch cpu only version. I tried everything and update pytorch to gpu version but nothing helped. Simple solution is to create new environment and then install pytorch gpu version. It resolve my problem

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM