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.
That file is impossible for human to deal with, you can only deal with Pipfile . But Pipfile is not strict enough to reproduce a totally same environment. So that's why we also need a Pipfile. lock .
The Pipfile. lock is intended to specify, based on the packages present in Pipfile, which specific version of those should be used, avoiding the risks of automatically upgrading packages that depend upon each other and breaking your project dependency tree.
You might also want to add --ignore-pipfile to pipenv install , as to not accidentally modify the lock-file on each test run. This causes Pipenv to ignore changes to the Pipfile and (more importantly) prevents it from adding the current environment to Pipfile.
$ pipenv lock is used to create a Pipfile. lock , which declares all dependencies (and sub-dependencies) of your project, their latest available versions, and the current hashes for the downloaded files.
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. :)
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
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With