15

I'm trying to push a Django app onto Heroku, but am getting the following error upon running git push heroku master:

Counting objects: 80, done.
Delta compression using up to 8 threads.
Compressing objects: 100% (74/74), done.
Writing objects: 100% (80/80), 990.21 KiB | 0 bytes/s, done.
Total 80 (delta 20), reused 0 (delta 0)
remote: Compressing source files... done.
remote: Building source:
remote: 
remote: -----> Python app detected
remote:  !     The latest version of Python 2 is python-2.7.14 (you are using 
python-2.7.12, which is unsupported).
remote:  !     We recommend upgrading by specifying the latest version 
(python-2.7.14).
remote:        Learn More: https://devcenter.heroku.com/articles/python-
runtimes
remote: -----> Installing python-2.7.12
remote: -----> Installing pip
remote: -----> Installing requirements with pip
remote:        Collecting alabaster==0.7.7 (from -r 
/tmp/build_a1f6d188f9e0e61e01076a73d4e10542/requirements.txt (line 1))
remote:          Downloading alabaster-0.7.7-py2.py3-none-any.whl
remote:        Collecting anaconda-client==1.4.0 (from -r 
/tmp/build_a1f6d188f9e0e61e01076a73d4e10542/requirements.txt (line 2))
remote:          Could not find a version that satisfies the requirement 
anaconda-client==1.4.0 (from -r 
/tmp/build_a1f6d188f9e0e61e01076a73d4e10542/requirements.txt (line 2)) (from 
versions: 1.1.1, 1.2.2)
remote:        No matching distribution found for anaconda-client==1.4.0 (from 
-r /tmp/build_a1f6d188f9e0e61e01076a73d4e10542/requirements.txt (line 2))
remote:  !     Push rejected, failed to compile Python app.
remote: 
remote:  !     Push failed
remote: Verifying deploy...
remote: 
remote: !   Push rejected to demo-freshstart.

Seems like it has something to do with Anaconda, but I see Anaconda pretty early on in my requirements.txt, so thinking it could just be the first thing it's getting caught up on for some other reason.

Tms91
  • 3,456
  • 6
  • 40
  • 74
user3294779
  • 593
  • 2
  • 7
  • 23
  • 1
    Are you sure you need `anacond-client` in your requirements? What does your app use it for? – Alasdair Nov 15 '17 at 11:30
  • I don't need it but pip freeze < requirements.txt seems to be adding it. Should I just manually remove it from requirements.txt? – user3294779 Nov 15 '17 at 17:30
  • When I remove the reference to anacond-client in requirements.txt it still shows the same error – user3294779 Nov 15 '17 at 17:35
  • 2
    Did you commit the change to requirements before pushing? Is there something else in the requirements they depends on anaconda-client? – Alasdair Nov 15 '17 at 20:02
  • If you are using pip freeze > requirements.txt with a separate conda env it will put a number of dependencies in the file that will fail when you push to Heroku. You can individually delete unnecessary dependencies in the requirements.txt or start with a trimmed version like in the Heroku docs: https://devcenter.heroku.com/articles/python-pip – dsugasa Sep 18 '18 at 14:34

6 Answers6

14

For every message

No matching distribution found for X

that you get, you have to manually do:

1 - at the line of requirements.txt where X appears, remove ==<version number>
2 - save the file
3 - commit
4 - push

do it again for the next error reported by the prompt, until you reach the end of the list cointained in requirements.txt.

(In case your X is psycopg2, substitute it with psycopg2-binary).


The same result can be achieved by installing and running pip-chill

pip install pip_chill
pip-chill --no-version > requirements.txt

Note: this is a last-resource solution, so, before implementing it, see if you can solve the problem by following the instructions of this answer

Tms91
  • 3,456
  • 6
  • 40
  • 74
7

Have you created environment in the conda ?

If so, after you activate the env. you need to conda install pip to activate pip install, otherwise your pip freeze would go back to the default anaconda environment. (thats why you are seeing them there)

  1. conda install pip
  2. pip install all the available packages again. (e.g. pip install django)
  3. pip freeze > requirements.txt

Please see myth 5 below https://jakevdp.github.io/blog/2016/08/25/conda-myths-and-misconceptions/

Rodrigue
  • 3,617
  • 2
  • 37
  • 49
Steve Cheung
  • 107
  • 6
  • hi, i've tried your process, but it still generate the same requriements.txt with anaconda-client – dingx May 06 '19 at 11:00
2

The solution for this error is pretty simple:

  1. I hope you already have created requirements.txt file in your app folder, you ran pip > freeze command and made a commit and pushed.

When you do that pip can also automatically add modules to the file, Pip can also install a dependency from your local codebase automatically. That can be a problem.

  1. Simply go to your requirement.txt file and look for anaconda-client==1.4.0 (or error starting with "No matching distribution found for" a module) and remove it from the file.

  2. Save the file, commit and push.

I had the similar problem and error with conda and i took the same steps and it worked for me.

I hope it helps some of you guys.

Appy Sharma
  • 149
  • 1
  • 6
2

The error is possibly caused by the fact that Anaconda libraries have changed and the version 1.4.0 and the others have been removed, so that they no longer exist.

Some of these are:

anaconda-client==1.7.2
anaconda-navigator==1.9.7
anaconda-project==0.8.2
blaze==0.11.3    
clyent==1.2.2    
conda==4.9.2
conda-build==3.20.5
conda-package-handling==1.3.11
...

(==removed versions)

Try to fix the problem by just updating all the libraries in your environment:

conda update -n base conda
conda update --all

then

pip freeze>requirements.txt
git add .
git commit -m "something"
git push heroku master
Tms91
  • 3,456
  • 6
  • 40
  • 74
  • This post helped me significantly, I erased from the dependency list one by one all the packages that caused errors. Surprisingly though, after the last package was successfully installed, Heroku continued to install some other packages not on the list. One of them (python-javabridge) causes an error that I've been trying for 2 days to sort out. Now, instead, I am just trying to figure out why heroku is installing packages that are taken out of the list and how to prevent this. Any insight will be very greatly appreciated!! Running git show requirements.txt shows the updated text file. – ISquared Jan 06 '21 at 22:17
  • I wrote this second answer because the first one is a "last resource" solution. Instead of removing the libraries listed in requirements.txt, try to update them. Follow the instructions in this answer – Tms91 Jan 06 '21 at 22:51
  • Sorry I should have mentioned, I updated all packages first as you suggested, the errors persisted, only th6en I began deleting the problematic packages. I am trying to understand why other packages keep being installed that are not on the list, I can not find any info on this online. – ISquared Jan 06 '21 at 23:07
  • and after you updated them you also added and committed? – Tms91 Jan 06 '21 at 23:40
  • Yes, I am not sure if the veryyyy first time I did git add . after updating the txt file, but I had to restart the entire deployment process several times anyway (including shutting down Spyder), with the updated dependencies list. Doing git show requirements.txt shows indeed the updated list, not the original one. The python-javabridge error I get I have described here: https://stackoverflow.com/questions/65594909/heroku-fails-to-bundle-python-javabridge-javahome-not-found – ISquared Jan 07 '21 at 00:19
1

According to PyPI, there's no such thing as anaconda-client version 1.4.0: the highest version is 1.2.2.

Daniel Roseman
  • 588,541
  • 66
  • 880
  • 895
0
Could not find a version that satisfies the requirement 
anaconda-client==1.4.0 (from -r 
/tmp/build_a1f6d188f9e0e61e01076a73d4e10542/requirements.txt (line 2))
(from  versions: 1.1.1, 1.2.2)

Hello, It may be too late, yet helpful for someone else. I got the same issue (but with a different package), and here is what I did (and it works!)

The package was a must for my project, so I could not remove it

  • replaced my package version with the available ones in requirments.txt which in your case is 1.1.1 or 1.2.2
  • then git heroku master
Hagar
  • 1