Pip not found when deploying Django app to Heroku

2019-06-02 05:13发布

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

1条回答
Lonely孤独者°
2楼-- · 2019-06-02 06:03

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
查看更多
登录 后发表回答