Pipfile.lock out of date



我正在尝试将一个大型django项目部署到heroku。我安装了 Heroku CLI,登录,创建了一个应用程序并运行:

git push heroku master

我有一个 Pipfile 和要求.txt已经设置好了。我添加了一个运行时.txt以指定我需要python 2.7。这也在Pipfile中。这是我从推送到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'

出于某种原因,它尝试安装python 3,它也不喜欢我的Pipfile.lock文件。我尝试删除它并使用pipenv安装再次生成它,但这并没有改变任何东西。

在处理项目时遇到同样的问题,在你推送到 Heroku 的分支中,运行

pipenv lock

它将更新 Pipfile.lock 文件。 :)

更新我的管道:pip install pipenv --upgrade然后做:pipenv lock然后执行提交

为我修复了这个问题

我删除了Pipfile.lock并提交了删除。Heroku 的构建过程抱怨它不存在,但它确实部署成功......

-----> 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

如果已经创建了 Pipfile,请将其删除并再次推送部署。它应该重新安装依赖项。这就是对我有用的东西。

我今天遇到了同样的问题,所以我通过更新我的pipenv -pip install pipenv --upgrade然后点击pipenv lock来解决下面提到的那个人。这是要走的路,并且解决了大多数情况。另外,在那之后不要忘记git add,提交和推送到heroku!希望对您有所帮助!

处理此问题的最简单方法是运行:pipenv lock然后git commit -am "updated pipfile"git push && git push heroku master

这些命令与其他答案中列出的其他一些命令完全相同,但这些命令可能会做得更快一些。

您应该提供以下任一:

  1. Pipfile和相应的Pipfile.lock

  1. requirements.txt(可选runtime.txt)

如果您使用的是Pipfile,请git rm requirements.txt runtime.txt并确保git add Pipfile Pipfile.lock.git commit,然后尝试git push到Heroku。

https://devcenter.heroku.com/articles/python-runtimes

我遇到了同样的问题,这是由于指向Pipfile.lock的符号链接。

在我的本地mac OS环境中克隆存储库后,由于某些原因,原始链接有点损坏,这导致推送到Heroku时Your Pipfile.lock (3b2ba9) is out of date. Expected: (83a5b4)

只需删除"旧"符号链接并从我的本地环境重新创建它即可解决问题。

使用 Heroku CLI,我正在从未master的本地分支运行git push heroku master,当出现此确切错误时:

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...

master分支部署修复了它。

如果要将本地分支推送到未master的 Heroku 主节点,请运行git push heroku branchname:master

另一个提示:如果您已对Pipfile.lock进行了更新并且没有看到任何更改,请务必执行git add .git commit -m "whatever"。 :)

最新更新