Reputation: 1014
I'm trying to deploy a large django project to heroku. I installed Heroku CLI, logged in, created an app and ran:
git push heroku master
I have a Pipfile and requirements.txt already set up. I added a runtime.txt to specify that I need python 2.7. This is also in the Pipfile. This is what I get from pushing to heroku:
$ git push heroku master
Counting objects: 12159, done.
Delta compression using up to 2 threads.
Compressing objects: 100% (4853/4853), done.
Writing objects: 100% (12159/12159), 20.94 MiB | 1.82 MiB/s, done.
Total 12159 (delta 6859), reused 12036 (delta 6751)
remote: Compressing source files... done.
remote: Building source:
remote:
remote: -----> Python app detected
remote: -----> Installing python-3.6.4
remote: -----> Installing pip
remote: -----> Installing dependencies with Pipenv 11.8.2…
remote: Your Pipfile.lock (3b2ba9) is out of date. Expected: (83a5b4).
remote: Aborting deploy.
remote: ! Push rejected, failed to compile Python app.
remote:
remote: ! Push failed
remote: Verifying deploy....
remote:
remote: ! Push rejected to camp-infinity.
remote:
To https://git.heroku.com/camp-infinity.git
! [remote rejected] master -> master (pre-receive hook declined)
error: failed to push some refs to 'https://git.heroku.com/camp-infinity.git'
For some reason it tries to install python 3, and it also doesn't like my Pipfile.lock file. I've tried deleting it and generating it again with pipenv install but that didn't change anything.
Upvotes: 57
Views: 72845
Reputation: 681
The simplest way to deal with this is to run :
pipenv lock
and then git commit -am "updated pipfile"
,
git push && git push heroku master
These commands do the same exact thing as some of the other commands listed in other answer but well, these might do it a bit faster.
Upvotes: 3
Reputation: 998
I have experienced the same problem today, so I solved in the way, the guy mentioned below, by updating my pipenv - pip install pipenv --upgrade
and then hitting pipenv lock
. This is the way to go, and solves the most cases. Also, after that do not forget to git add, commit and to push to heroku! Hope that helps!
Upvotes: 2
Reputation: 111
If there is already a Pipfile created, delete it and push deploy it again. It should re-install your dependencies. That is what worked for me.
Upvotes: 3
Reputation: 91
Updating my pipenv: pip install pipenv --upgrade
then doing: pipenv lock
then do a commit
fixed this for me
Upvotes: 9
Reputation: 1
Just another tip: Make sure to do a git add .
and git commit -m "whatever"
if you've made updates to your Pipfile.lock
and don't see any changes. :)
Upvotes: -2
Reputation: 1
Using the Heroku CLI, I was running git push heroku master
from a local branch that was not master
, when this exact error appeared:
remote: -----> Python app detected
remote: -----> Installing pip
remote: -----> Installing dependencies with Pipenv 2018.5.18…
remote: Your Pipfile.lock (38bf21) is out of date. Expected: (e4987e).
remote: Aborting deploy.
remote: ! Push rejected, failed to compile Python app.
remote:
remote: ! Push failed
remote: Verifying deploy...
Deploying from the master
branch fixed it.
If you want to push a local branch to the Heroku master that is not master
, run git push heroku branchname:master
.
Upvotes: 0
Reputation: 154
I removed the Pipfile.lock
and commited it's deletion. Heroku's build process complained about it not being there, but it did deploy successfully...
-----> Python app detected
! No 'Pipfile.lock' found! We recommend you commit this into your repository.
-----> Installing pip
-----> Installing dependencies with Pipenv 11.8.2…
Installing dependencies from Pipfile…
-----> Discovering process types
Procfile declares types -> worker
-----> Compressing...
Done: 189.9M
-----> Launching...
Released v5
Upvotes: 3
Reputation: 11172
I had the same problem and it was due to a symbolic link pointing to Pipfile.lock.
After cloning the repo on my local mac OS environment, for some reasons, the original link was kind of broken and this resulted in Your Pipfile.lock (3b2ba9) is out of date. Expected: (83a5b4)
when pushing to Heroku.
Just deleting the "old" symbolic link and recreating it from my local env solved the issue.
Upvotes: 1
Reputation: 1095
Experienced the same problem while working on a project, in the branch you are pushing to Heroku, run
pipenv lock
and it will update the Pipfile.lock file. :)
Upvotes: 95
Reputation: 2528
You should provide either a:
Pipfile
and corresponding Pipfile.lock
or
requirements.txt
(and optionally runtime.txt
)If you are using a Pipfile
then git rm requirements.txt runtime.txt
and make sure to git add Pipfile Pipfile.lock
. git commit
and then try your git push
to heroku.
https://devcenter.heroku.com/articles/python-runtimes
Upvotes: 1