Ron Cohen
Ron Cohen

Reputation: 2925

Installing PyTorch via Conda

Objective: Create a conda environment with pytorch and torchvision. Anaconda Navigator 1.8.3, python 3.6, MacOS 10.13.4.

What I've tried:

pytorch 0.3.1, torch 0.3.1, and torchvision 0.2.0 now appear as installed in the root environment. However, the root environment is no longer cloneable; the clone button is gray/disabled (it used be enabled/cloneable). I could use the root environment as a fallback but the main point of conda is to be able to create separate and disposable environments. What am I missing?

UPDATE -----------------

Running conda install -c pytorch pytorch yields: # All requested packages already installed. But if I activate the pytorch environment and list the packages therein, there is no package containing the word "torch". If I then do conda search pytorch I get PackagesNotFoundError: The following packages are not available from current channels: - pytorch. If I activate the base environment and then do conda list then pytorch is in the package list for base. So how does one create a separate environment containing pytorch?

Upvotes: 11

Views: 35229

Answers (2)

Rich Lysakowski PhD
Rich Lysakowski PhD

Reputation: 3110

I struggled with this and was reminded to RTFM (Read The F'ing Manual) documentation...

See Verify the installation with import torch not pytorch. which is from Pytorch

Upvotes: 1

RomualdM
RomualdM

Reputation: 943

You seem to have installed PyTorch in your base environment, you therefore cannot use it from your other "pytorch" env.

Either:

  • directly create a new environment (let's call it pytorch_env) with PyTorch: conda create -n pytorch_env -c pytorch pytorch torchvision

  • switch to the pytorch environment you have already created with: source activate pytorch_env and then install PyTorch in it: conda install -c pytorch pytorch torchvision

Upvotes: 21

Related Questions