dumbledad
dumbledad

Reputation: 17527

Specifying a version number and the 'cpuonly' option in YAML for a conda environment config

My YAML config file for my conda environment looks like this (cut down)

name: proj36
channels:
  - defaults
  - pytorch
dependencies:
  - numpy
  - pandas==0.25.3
  - python==3.6.10
  - pytorch==1.2.0
  - torchvision==0.4.0

If I was installing pytorch and torchvision from the command prompt I could specify the cpuonly version like this

conda install pytorch==1.2.0 torchvision==0.4.0 cpuonly -c pytorch

How should I add the cpuonly option in my YAML config file without losing the version number?

I have tried

- pytorch==1.2.0 cpuonly

which gives the error

ResolvePackageNotFound:  
    - pytorch==1.2.0=cpuonly 

and

- pytorch==1.2.0, cpuonly

which gives the error

ResolvePackageNotFound:  
    - pytorch[version='1.2.0,cpuonly']

What is the correct syntax?

(Bonus points if you can point me at some documentation where I might have worked out what to do.)

Upvotes: 1

Views: 526

Answers (1)

dumbledad
dumbledad

Reputation: 17527

Got it, I needed to add the cpuonly as another item at the end of the YAML dependencies list.

name: proj36
channels:
  - defaults
  - pytorch
dependencies:
  - numpy
  - pandas==0.25.3
  - python==3.6.10
  - pytorch==1.2.0
  - torchvision==0.4.0
  - cpuonly

Upvotes: 1

Related Questions