65

My app is deployed on heroku.

When I push my code via git push heroku master. It gives me this error

Collecting pkg-resources==0.0.0 (from -r requirements.txt (line 14))
remote:          Could not find a version that satisfies the requirement pkg-resources==0.0.0 (from -r requirements.txt (line 14)) (from versions: )
remote:        No matching distribution found for pkg-resources==0.0.0 (from -r requirements.txt (line 14))
remote:  !     Push rejected, failed to compile Python app.

requirement.txt

amqp==2.1.1
billiard==3.5.0.2
boto==2.42.0
celery==4.0.0
dj-database-url==0.4.1
Django==1.10.2
django-appconf==1.0.2
django-model-utils==2.6
django-storages==1.5.1
djangorestframework==3.4.7
gunicorn==19.6.0
Jinja2==2.8
kombu==4.0.0
MarkupSafe==0.23
optional-django==0.1.0
pep8==1.7.0
pkg-resources==0.0.0
psycopg2==2.6.2
pyflakes==1.3.0
pytz==2016.7
rcssmin==1.0.6
requests==2.12.1
rjsmin==1.0.12
vine==1.1.3
whitenoise==3.2.2

Note: Its working perfectly fine on my local server.

My Question is why is not working on heroku but working on local. ???

Sayse
  • 42,633
  • 14
  • 77
  • 146
Mahammad Adil Azeem
  • 9,112
  • 13
  • 57
  • 84
  • 1
    please comment the 14 line in requirement.txt and push the code – Afsal Salim Nov 18 '16 at 06:38
  • I get that. But why its working on local and not on heroku – Mahammad Adil Azeem Nov 18 '16 at 06:48
  • it that working properly without that module – Afsal Salim Nov 18 '16 at 06:49
  • 2
    Yes it was working, But i wanted to ask why its not working on heroku – Mahammad Adil Azeem Nov 18 '16 at 06:55
  • i dont know may me heroku cammot find that module – Afsal Salim Nov 18 '16 at 06:59
  • 3
    Possible duplicate of [Why does pip freeze list "pkg-resources==0.0.0"?](http://stackoverflow.com/questions/38992194/why-does-pip-freeze-list-pkg-resources-0-0-0) – Sayse Nov 18 '16 at 07:26
  • 3
    I get that its not a direct duplicate but I'd imagine its because your local version already has it installed and therefore doesn't need to go looking for it – Sayse Nov 18 '16 at 07:27
  • can you show pip freeze output on your local env? – demonno Aug 25 '17 at 08:10
  • The [SO post mentioned above](https://stackoverflow.com/questions/40670602/could-not-find-a-version-that-satisfies-the-requirement-pkg-resources-0-0-0#comment68573207_40670602) speaks to the heart of the issue. I don't know anything about Heroku, but from what I can tell, it uses an OS called _Stack_ which is [built on top of Ubuntu](https://devcenter.heroku.com/articles/stack). I'm wondering if Adil wasn't running a Ubuntu/Debian distro locally, and so his issues only appeared when pushing his code up to Heroku. – Mike Apr 16 '20 at 13:28

5 Answers5

125

Remove Following line from requirements.txt.

pkg-resources==0.0.0

Hamza Zafeer
  • 2,360
  • 13
  • 30
  • 42
Junior Gantin
  • 2,102
  • 1
  • 18
  • 24
32

To avoid having it in requirements.txt everytime you do a freeze, remove it from your virtual environment with pip uninstall pkg-resources==0.0.0

Phares
  • 1,008
  • 13
  • 20
4

Remove pkg-resources==0.0.0 from requirements.txt

if you wish to avoid the problem next time you do a freeze, use pip uninstall pkg-resources==0.0.0

1

cat requirements.txt | grep --invert-match pkg-resources | xargs -n 1 pip install

refer to the link for a more detailed write-up: https://code-specialist.com/python/pkg-resources

BDL
  • 21,052
  • 22
  • 49
  • 55
  • 1
    As it’s currently written, your answer is unclear. Please [edit] to add additional details that will help others understand how this addresses the question asked. You can find more information on how to write good answers [in the help center](/help/how-to-answer). – Community Aug 23 '22 at 01:12
0

It appears Heroku CLI is using dependencies from a different local branch. If you are running:

$ git push origin master

to deploy your application on Heroku, ensure that locally you are switched to master branch.

lwairore
  • 624
  • 1
  • 7
  • 11