pythonazurepippytorchrequirements.txt

Is there a way I can install a pytorch version that is not in pip library on an Azure deployment?


I have a flask application that uses pytorch at one point. However I cannot seem to deploy this successfully due to pytorch versions that are only available pip install from URL

The only version of pytorch with Cuda enabled that seems to work with my python version of 3.12 is one that I found here: https://stackoverflow.com/a/77597368/24421235 and is downloaded with: pip3 install --pre torch torchvision torchaudio --index-url https://download.pytorch.org/whl/nightly/cu118

This means locally my application works completely fine however when trying to deploy my web app with a requirements.txt the version that azure tries to install is non existent

attempting local pip install of the version shown by pip requirements still gives error

Is there a way around this?

github repo https://github.com/jamiemitch121/Flask_Image_Creation_Site


Solution

  • There should be no need to use the pre-release nightly build for cuda 11.8 and python 3.12, at least there seems to be installation candidates in https://download.pytorch.org/whl/cu118 for python 3.12:

    torch-2.2.0+cu118-cp312-cp312-linux_x86_64.whl
    torch-2.2.0+cu118-cp312-cp312-win_amd64.whl

    You can specify the index url to search for packages directly in your requirements.txt.

    You can make your requirements.txt like this:

    --index-url https://download.pytorch.org/whl/cu118
    --extra-index-url=https://pypi.org/simple
    torch
    torchvision
    torchaudio
    <other packages>