9

I have a pip requirements file that includes specific cpu-only versions of torch and torchvision. I can use the following pip command to successfully install my requirements.

pip install --requirement azure-pipelines-requirements.txt --find-links https://download.pytorch.org/whl/torch_stable.html

My requirements file looks like this

coverage
dataclasses
joblib
matplotlib
mypy
numpy
pandas
param
pylint
pyro-ppl==1.2.1
pyyaml
scikit-learn
scipy
seaborn
torch==1.4.0+cpu
torchvision==0.5.0+cpu 
visdom

This works from bash, but how do I invoke pip with the find-links option from inside a conda environment yaml file? My current attempt looks like this

name: build  
dependencies:  
  - python=3.6  
  - pip  
  - pip:  
    - --requirement azure-pipelines-requirements.txt --find-links https://download.pytorch.org/whl/torch_stable.html  

But when I invoke

conda env create --file azure-pipeline-environment.yml

I get this error.

Pip subprocess error:
ERROR: Could not find a version that satisfies the requirement torch==1.4.0+cpu (from -r E:\Users\tim\Source\Talia\azure-pipelines-requirements.txt (line 25)) (from versions: 0.1.2, 0.1.2.post1, 0.1.2.post2)
ERROR: No matching distribution found for torch==1.4.0+cpu (from -r E:\Users\tim\Source\Talia\azure-pipelines-requirements.txt (line 25))

CondaEnvException: Pip failed

How do I specify the find-links option when invoking pip from a conda environment yaml file?

dumbledad
  • 16,305
  • 23
  • 120
  • 273

2 Answers2

15

This example shows how to specify options for pip

Specify the global pip option first:

name: build  
dependencies:  
  - python=3.6  
  - pip  
  - pip:
    - --find-links https://download.pytorch.org/whl/torch_stable.html
    - --requirement azure-pipelines-requirements.txt  
FlyingTeller
  • 17,638
  • 3
  • 38
  • 53
6

Found the answer in the pip documentation here. I can add the find-links option to my requirements file, so my conda environment yaml file becomes

name: build
dependencies:
  - python=3.6
  - pip
  - pip:
    - --requirement azure-pipelines-requirements.txt

and my pip requirements file becomes

--find-links https://download.pytorch.org/whl/torch_stable.html
coverage
dataclasses
joblib
matplotlib
mypy
numpy
pandas
param
pylint
pyro-ppl==1.2.1
pyyaml
scikit-learn
scipy
seaborn
torch==1.4.0+cpu
torchvision==0.5.0+cpu 
visdom
dumbledad
  • 16,305
  • 23
  • 120
  • 273