Reputation: 123
I am using conda 4.8.3 with Python 3.7, I am writing environment files to specify the dependencies of my project. I would like to write several files to be able to install several environments:
To get a basic (CPU) installation one would write : conda env update --file main.yml
To get an installation with GPU compatibility would then add conda env update --file gpu.yml
Here is my question : at the moment I cannot find the right way to specify the 'CPU-only' criteria for pytorch in an environment file, does anyone know if it is doable?
The command usually used for that purpose is conda install pytorch torchvision cpuonly -c pytorch
, but I cannot find a way to specify it in the yml file.
On the pytorch channel site , there is a pytorch-cpu
package, but its version is quite outdated (1.1.0, while the current main is 1.6.0)
Here is my main.yml
environment file:
name: my_env
channels:
- intel
- conda-forge
- pytorch
dependencies:
- numpy
- scipy
- scikit-image
- matplotlib
- wxpython
- colorama
- dill
- protobuf
- pytorch # How to specify the 'cpu' criteria here??
- torchvision
- pip:
- -r env/requirements.txt
Upvotes: 4
Views: 2299
Reputation: 46
In case anyone else is looking for the answer -- I tried what AMC suggested in a comment above. I can confirm that adding the line:
- cpuonly
to my environment.yml file forced the CPU version of pytorch to be downloaded.
Upvotes: 3