Say I'm using the PythonVirtualenvOperator and have PyTorch as a requirement. When calling "pip freeze" I get
#requirements.txt
.
.
torch==1.8.1+cpu
and defining my task as
#tasks.py
from airflow.operators.python import PythonVirtualenvOperator
t1= PythonVirtualenvOperator(
task_id = "test",
python_version = "3.7",
python_callable = test_func,
requirements = ["torch==1.8.1+cpu"]
)
throws the ERROR: Could not find a version that satisfies the requirement torch==1.8.1+cpu.
In the documentation from PyTorch we install it by pip3 install torch==1.8.1+cpu torchvision==0.9.1+cpu torchaudio===0.8.1 -f https://download.pytorch.org/whl/torch_stable.html i.e downloading it from their webpage and not from pip (if I understand it correctly), which might be why pip fails in the venv. Thus I would like to make the venv (created by airflow for the PythonVirtualOperator) to download torch from the link specified above, instead of pip.
Is that doable? And is there a difference between torch==1.8.1+cpu and just torch==1.8.1 when using the cpu i.e does it make a difference if I just remove the +cpu?