Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

691
Views
No matching distribution found for torch==1.5.0+cpu on Heroku

I am trying to deploy my Django app which uses a machine learning model. And the machine learning model requires pytorch to execute. When i am trying to deploy it is giving me this error

ERROR: Could not find a version that satisfies the requirement torch==1.5.0+cpu (from -r /tmp/build_4518392d43f43bc52f067241a9661c92/requirements.txt (line 23)) (from versions: 0.1.2, 0.1.2.post1, 0.1.2.post2, 0.4.1, 0.4.1.post2, 1.0.0, 1.0.1, 1.0.1.post2, 1.1.0, 1.2.0, 1.3.0, 1.3.1, 1.4.0, 1.5.0)
       ERROR: No matching distribution found for torch==1.5.0+cpu (from -r /tmp/build_4518392d43f43bc52f067241a9661c92/requirements.txt (line 23))
 !     Push rejected, failed to compile Python app.
 !     Push failed

My requirements.txt is

asgiref==3.2.7
certifi==2020.4.5.1
chardet==3.0.4
cycler==0.10.0
dj-database-url==0.5.0
Django==3.0.6
django-heroku==0.3.1
future==0.18.2
gunicorn==20.0.4
idna==2.9
imageio==2.8.0
kiwisolver==1.2.0
matplotlib==3.2.1
numpy==1.18.4
Pillow==7.1.2
psycopg2==2.8.5
pyparsing==2.4.7
python-dateutil==2.8.1
pytz==2020.1
requests==2.23.0
six==1.14.0
sqlparse==0.3.1
torch==1.5.0+cpu
torchvision==0.6.0+cpu
urllib3==1.25.9
whitenoise==5.0.1

And runtime.txt is python-3.7.5
However installing it on my computer is not giving any type of error when i use command pip install torch==1.5.0+cpu I am using python 3.7.5 and pip 20.0.2.
Complete code is here.
How to solve this issue i really need to deploy my app. Thanks

over 4 years ago · Santiago Trujillo
5 answers
Answer question

0

I'm not a torch expert, but I've seen a similar issue with other AI packages that require C compilers and/or additional libraries.

  1. See if there is a "buildpack" available on Heroku that will install those dependencies, or

  2. Change to using the "container" method of distribution, where you build and push docker images to heroku as your deployment strategy.

over 4 years ago · Santiago Trujillo Report

0

PyTorch does not distribute the CPU only versions over PyPI. They are only available through their custom registry.

If you select the CPU only version on PyTorch - Get Started Locally you get the following instructions:

pip install torch==1.5.0+cpu torchvision==0.6.0+cpu -f https://download.pytorch.org/whl/torch_stable.html

Since you're not manually executing the pip install, you cannot simply add the -f https://download.pytorch.org/whl/torch_stable.html.

As an alternative, you can put it into your requirements.txt as a standalone line. It shouldn't really matter where exactly you put it, but it is commonly put at the very top.

-f https://download.pytorch.org/whl/torch_stable.html
asgiref==3.2.7
certifi==2020.4.5.1
chardet==3.0.4
cycler==0.10.0
dj-database-url==0.5.0
Django==3.0.6
django-heroku==0.3.1
future==0.18.2
gunicorn==20.0.4
idna==2.9
imageio==2.8.0
kiwisolver==1.2.0
matplotlib==3.2.1
numpy==1.18.4
Pillow==7.1.2
psycopg2==2.8.5
pyparsing==2.4.7
python-dateutil==2.8.1
pytz==2020.1
requests==2.23.0
six==1.14.0
sqlparse==0.3.1
torch==1.5.0+cpu
torchvision==0.6.0+cpu
urllib3==1.25.9
whitenoise==5.0.1
over 4 years ago · Santiago Trujillo Report

0

I tried my project to install torch 1.5.0 but it is supporting my local machine but when I deploying it in Heroku it is getting an error. when I put below requiremenmts.txt it is working fine always remember it needs to give initially from line no.1 requirements.txt: 1 -f https://download.pytorch.org/whl/torch_stable.html 2 torch== 1.8.1+cpu 3. torchvision==0.9.1+cpu

over 4 years ago · Santiago Trujillo Report

0

Just adding this for those still having issues.

Make sure you have -f https://download.pytorch.org/whl/torch_stable.html at the start of your requirements.txt

over 4 years ago · Santiago Trujillo Report

0

Make sure you are not using too new or too old version of Python, in my case, I was using FROM python:3 in my Dockerfile. I changed it to From python:3.7 and the error went away.

over 4 years ago · Santiago Trujillo Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!