将Django应用程序部署到Heroku时找不到Pip [英] Pip not found when deploying Django app to Heroku

查看:123
本文介绍了将Django应用程序部署到Heroku时找不到Pip的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试将一个Python 2.7.5 Django应用程序部署到heroku,但是当heroku编译该项目时出现错误。
具体来说,这个问题似乎与PIP,并试图安装它。



第一次我试过,我得到这个错误:没有这样的选项:--allow-all-external。



Heroku输出:

  PS C:\(...)> git push heroku master 
提取仓库,完成。
计数对象:7,完成。
使用多达4个线程的增量压缩。
压缩对象:100%(4/4),完成。
写入对象:100%(4/4),499字节,完成。
共计4(delta 3),重用0(delta 0)

----->获取定制git buildpack ... done
-----> Python应用程序检测到
----->没有提供runtime.txt;假定python-2.7.4。
----->使用Python运行时(python-2.7.4)
----->安装Setuptools(3.6)
/ tmp / buildpack_6eb68b54-a764-4ebb-ab28 -cde543457862 / bin / compile:第186行:cd:/ tmp / buildpack_6eb68b54 -a764-4ebb-ab28-cd
e543457862 / vendor /setuptools-3.6/:没有这样的文件或目录
----->安装Pip(1.5.5)
/ tmp / buildpack_6eb68b54-a764-4ebb-ab28 -cde543457862 / bin / compile:line 193:cd:/ tmp / buildpack_6eb68b54-a764-4ebb-ab28-cd
e543457862 /vendor/pip-1.5.5/:没有这样的文件或目录
----->使用Pip安装依赖关系(1.5.5)

用法:
pip install [options]<需求说明符> ...
pip install [options] -r< requirements file> ...
pip install [options] [-e]< vcs project url> ...
pip install [选项] [-e]<本地项目路径> ...
pip install [选项]<档案网址/路径> ...

没有这样的选项: - 允许所有外部

!推送被拒绝,未能编译Python应用程序

到git@heroku.com:(...)。git
! [remote rejected] master - > master(pre-receive hook refused)
错误:未能将一些文件推送到'git@heroku.com:(...)。git'

然后,我尝试添加一个指定python版本的runtime.txt文件:

  python-2.7.5 

之后,当我尝试再次部署时,当Heroku尝试安装pip时出现不同的错误:
没有这样的文件或目录

heroku提供的输出是这样的:

  C:\(...)> git push heroku master 
提取仓库,完成。
计数对象:10,完成。
使用多达4个线程的增量压缩。
压缩对象:100%(6/6),完成。
写入对象:100%(7/7),770字节,完成。
总计7(增量4),重用0(增量0)

----->获取定制git buildpack ... done
-----> Python应用程序检测到
----->找到python-2.7.4,删除。
----->准备Python运行时(python-2.7.5)
----->安装Setuptools(3.6)
/ tmp / buildpack_06aca65d-4039-4d30-aadb-0746f6052aab / bin / compile:第186行:cd:/ tmp / buildpack_06aca65d-4039-4d30-aadb-07
46f6052aab / vendor /setuptools-3.6/:没有这样的文件或目录
----->安装Pip(1.5.5)
/ tmp / buildpack_06aca65d-4039-4d30-aadb-0746f6052aab / bin / compile:line 193:cd:/ tmp / buildpack_06aca65d-4039-4d30-aadb-07
46f6052aab /vendor/pip-1.5.5/:没有这样的文件或目录
----->使用Pip安装依赖项(1.5.5)
/ tmp / buildpack_06aca65d-4039-4d30-aadb-0746f6052aab / bin / compile:第224行:/app/.heroku/python/bin/pip:没有这样的文件或
目录

!推送被拒绝,未能编译Python应用程序

到git@heroku.com:(...)。git
! [remote rejected] master - > master(pre-receive hook refused)
错误:未能将一些文件推送到'git@heroku.com:(...)。git'

在本地,我使用pip 1.3.1,但是heroku使用1.5.5。这可能是问题吗?任何想法?



预先感谢

解决方案

'使用定制的buildpack,我猜这就是这个问题 - 你的定制buildpack没有包含pip。我建议删除你的自定义buildpack,然后再试一次。



你可以运行以下命令删除你的buildpack:

  heroku config:unset BUILDPACK_URL 


I'm trying to deploy a python 2.7.5 Django app to heroku, but I'm getting an error when heroku compiles the project. Specifically, the problem seems to be with pip, and when trying to install it.

The first i tried, I got this error: "no such option: --allow-all-external".

Heroku Output:

PS C:\(...)> git push heroku master
Fetching repository, done.
Counting objects: 7, done.
Delta compression using up to 4 threads.
Compressing objects: 100% (4/4), done.
Writing objects: 100% (4/4), 499 bytes, done.
Total 4 (delta 3), reused 0 (delta 0)

-----> Fetching custom git buildpack... done
-----> Python app detected
-----> No runtime.txt provided; assuming python-2.7.4.
-----> Using Python runtime (python-2.7.4)
-----> Installing Setuptools (3.6)
/tmp/buildpack_6eb68b54-a764-4ebb-ab28-cde543457862/bin/compile: line 186: cd: /tmp/buildpack_6eb68b54-a764-4ebb-ab28-cd
e543457862/vendor/setuptools-3.6/: No such file or directory
-----> Installing Pip (1.5.5)
/tmp/buildpack_6eb68b54-a764-4ebb-ab28-cde543457862/bin/compile: line 193: cd: /tmp/buildpack_6eb68b54-a764-4ebb-ab28-cd
e543457862/vendor/pip-1.5.5/: No such file or directory
-----> Installing dependencies using Pip (1.5.5)

Usage:
  pip install [options] <requirement specifier> ...
  pip install [options] -r <requirements file> ...
  pip install [options] [-e] <vcs project url> ...
  pip install [options] [-e] <local project path> ...
  pip install [options] <archive url/path> ...

no such option: --allow-all-external

 !     Push rejected, failed to compile Python app

To git@heroku.com:(...).git
 ! [remote rejected] master -> master (pre-receive hook declined)
error: failed to push some refs to 'git@heroku.com:(...).git'

Then, i tried adding a runtime.txt file specifying the python version:

python-2.7.5

After that, when I tried to deploy again, i got a diferent error when Heroku tried to install pip: "No such file or directory"

The output given by heroku is this:

C:\(...)> git push heroku master
Fetching repository, done.
Counting objects: 10, done.
Delta compression using up to 4 threads.
Compressing objects: 100% (6/6), done.
Writing objects: 100% (7/7), 770 bytes, done.
Total 7 (delta 4), reused 0 (delta 0)

-----> Fetching custom git buildpack... done
-----> Python app detected
-----> Found python-2.7.4, removing.
-----> Preparing Python runtime (python-2.7.5)
-----> Installing Setuptools (3.6)
/tmp/buildpack_06aca65d-4039-4d30-aadb-0746f6052aab/bin/compile: line 186: cd: /tmp/buildpack_06aca65d-4039-4d30-aadb-07
46f6052aab/vendor/setuptools-3.6/: No such file or directory
-----> Installing Pip (1.5.5)
/tmp/buildpack_06aca65d-4039-4d30-aadb-0746f6052aab/bin/compile: line 193: cd: /tmp/buildpack_06aca65d-4039-4d30-aadb-07
46f6052aab/vendor/pip-1.5.5/: No such file or directory
-----> Installing dependencies using Pip (1.5.5)
/tmp/buildpack_06aca65d-4039-4d30-aadb-0746f6052aab/bin/compile: line 224: /app/.heroku/python/bin/pip: No such file or
directory

 !     Push rejected, failed to compile Python app

To git@heroku.com:(...).git
 ! [remote rejected] master -> master (pre-receive hook declined)
error: failed to push some refs to 'git@heroku.com:(...).git'

Locally, I use pip 1.3.1, but heroku uses 1.5.5. Could this be the problem? Any thoughts?

Thanks in advance

解决方案

It looks like you're using a custom buildpack, and I'm guessing that's the issue here -- your custom buildpack does not have pip included. I'd suggest removing your custom buildpack, then trying again.

You can remove your buildpack by running:

heroku config:unset BUILDPACK_URL

这篇关于将Django应用程序部署到Heroku时找不到Pip的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆