How to install pytorch in Anaconda with conda or pip?

后端 未结 9 1228
星月不相逢
星月不相逢 2020-12-16 11:50

I am trying to install pytorch in Anaconda to work with Python 3.5 in Windows. Following the instructions in pytorch.org I introduced the following code in Anaconda:

相关标签:
9条回答
  • 2020-12-16 12:12

    For me it worked doing this:

    Uninstall the previous version: go to C:\users\username\anaconda3 and run the anaconda-uninstall.exe

    Install again anaconda

    then run the following commands on the anaconda pompt:

    conda create -n my_env python=2.7

    conda activate my_env

    start the gui app

    conda install -c peterjc123 pytorch

    anaconda-navigator

    0 讨论(0)
  • 2020-12-16 12:13

    Go to the official PyTorch.org and follow the steps accordingly.

    Select your preferences and you will see an appropriate command below on the page.

    If you don't have GPU in the system, set CUDA as None

    Example command:

    conda install pytorch-cpu torchvision-cpu -c pytorch
    
    0 讨论(0)
  • 2020-12-16 12:20

    Can you please try with below steps

    1. conda create -n pytorch_env python=3.5
    2. source activate pytorch_env
    3. conda install -c soumith pytorch
    4. python

      > import torch

    You can even find pytorch after you execute command conda list.

    0 讨论(0)
  • 2020-12-16 12:25

    For windows python 3.6 and above without cuda

    pip install torch==1.2.0+cpu torchvision==0.4.0+cpu -f https://download.pytorch.org/whl/torch_stable.html
    
    0 讨论(0)
  • 2020-12-16 12:29

    The following worked for me. First install MKL:

    conda install -c anaconda mkl
    

    After this, install pytorch and torchvision:

    conda install -c pytorch pytorch torchvision
    
    0 讨论(0)
  • 2020-12-16 12:31

    For linux, cuda9.0, python3.6:

    pip3 install http://download.pytorch.org/whl/cu90/torch-0.3.1-cp36-cp36m-linux_x86_64.whl

    pip3 install torchvision

    For other cuda/python version: check website: https://ptorch.com/news/145.html

    0 讨论(0)
提交回复
热议问题