首页 > 解决方案 > 使用 Anaconda 将 Django 应用程序部署到 Heroku 时出现“没有这样的选项:--allow-all-external”

问题描述

我使用 Django 1.11.20 和 Python 2.7。我的应用程序是使用 Heroku 部署的。

由于我需要 NumPy / SciPy 并且 Heroku 的 slug 大小限制为 500Mb,因此我通过以下三个 Heroku buildpacks 使用 Anaconda:

该网站在去年一直运行良好,并且几个月没有更新。

我最近对该站点进行了一些小改动,将其部署到 Heroku 时出现以下错误。

我不明白到底是什么问题。

有什么线索吗?

        -----> Deleting 0 files matching .slugignore patterns.
        -----> Python/Conda app detected
        added pinned file in /app/.heroku/miniconda/conda-meta/pinned
        Collecting package metadata: ...working... done
        Solving environment: ...working... done
        ## Package Plan ##
          environment location: /app/.heroku/miniconda
          added / updated specs:
            - nomkl
        The following packages will be downloaded:
            package                    |            build
            ---------------------------|-----------------
            nomkl-3.0                  |                0          48 KB
            ------------------------------------------------------------
                                                   Total:          48 KB
        The following packages will be UPDATED:
          nomkl                                               1.0-0 --> 3.0-0
        Proceed ([y]/n)? 
        Downloading and Extracting Packages
        Preparing transaction: ...working... done
        Verifying transaction: ...working... done
        Executing transaction: ...working... done
        -----> Installing dependencies using Conda
               Collecting package metadata: ...working... done
               Solving environment: ...working... 
               The environment is inconsistent, please check the package plan             carefully
           The following packages are causing the inconsistency:

                 - defaults/linux-64::readline==7.0=h7b6447c_5
                 - defaults/linux-64::zlib==1.2.11=h7b6447c_3
                 - defaults/linux-64::python==2.7.15=h9bab390_6
                 - defaults/linux-64::scipy==0.17.1=np111py27_nomkl_0
                 - defaults/linux-64::pycparser==2.18=py27_0
                 - defaults/linux-64::ncurses==6.1=he6710b0_1
                 - defaults/linux-64::pysocks==1.6.7=py27he2db6d2_1
                 - defaults/linux-64::pycosat==0.6.3=py27ha4109ae_0
                 - defaults/linux-64::sqlite==3.26.0=h7b6447c_0
                 - defaults/linux-64::pycrypto==2.6.1=py27_0
                 - defaults/linux-64::openssl==1.1.1c=h7b6447c_1
                 - defaults/linux-64::libgcc-ng==8.2.0=hdf63c60_1
                 - defaults/linux-64::scikit-learn==0.17.1=np111py27_nomkl_1
                 - defaults/linux-64::six==1.10.0=py27_0
                 - defaults/linux-64::numpy==1.11.0=py27_nomkl_1
                 - defaults/linux-64::certifi==2019.3.9=py27_0
                 - defaults/linux-64::asn1crypto==0.22.0=py27_0
                 - defaults/linux-64::wheel==0.29.0=py27_0
                 - defaults/linux-64::urllib3==1.22=py27ha55213b_0
                 - defaults/linux-64::packaging==16.8=py27_0
                 - defaults/linux-64::cryptography==2.5=py27h1ba5d50_0
                 - defaults/linux-64::pyparsing==2.2.0=py27_0
                 - defaults/linux-64::ruamel_yaml==0.11.14=py27_1
                 - defaults/linux-64::libedit==3.1.20181209=hc058e9b_0
                 - defaults/linux-64::idna==2.6=py27_0
                 - defaults/linux-64::pyopenssl==17.0.0=py27_0
                 - defaults/linux-64::conda==4.6.14=py27_0
                 - defaults/linux-64::ipaddress==1.0.18=py27_0
                 - defaults/linux-64::cffi==1.10.0=py27_0
                 - defaults/linux-64::enum34==1.1.6=py27_0
                 - defaults/linux-64::requests==2.18.4=py27hc5b0589_1
                 - defaults/linux-64::tk==8.6.8=hbc83047_0
                 - defaults/linux-64::pyyaml==3.11=py27_1
                 - defaults/linux-64::pip==9.0.1=py27_1
                 - defaults/linux-64::chardet==3.0.4=py27hfa10054_1
                 - defaults/linux-64::futures==3.2.0=py27h7b459c0_0
                 - defaults/linux-64::setuptools==36.5.0=py27h68b189e_0
               done
            ==> WARNING: A newer version of conda exists. <==
          current version: 4.6.14
          latest version: 4.7.10
    Please update conda by running
        $ conda update -n base -c defaults conda

           ## Package Plan ##

             environment location: /app/.heroku/miniconda

             added / updated specs:
               - nomkl==1.0=0
               - numpy==1.11.0=py27_nomkl_1
               - scikit-learn==0.17.1=np111py27_nomkl_1
               - scipy==0.17.1=np111py27_nomkl_0


           The following packages will be downloaded:

               package                    |            build
           ---------------------------|-----------------
           _libgcc_mutex-0.1          |             main           3 KB
           certifi-2019.6.16          |           py27_0         154 KB
           libgcc-ng-9.1.0            |       hdf63c60_0         8.1 MB
           nomkl-1.0                  |                0          402 B
           pip-19.1.1                 |           py27_0         1.8 MB
           python-2.7.16              |       h9bab390_0        12.8 MB
           setuptools-41.0.1          |           py27_0         640 KB
           sqlite-3.29.0              |       h7b6447c_0         1.9 MB
           wheel-0.33.4               |           py27_0          39 KB
           ------------------------------------------------------------
                                                  Total:        25.4 MB

   The following NEW packages will be INSTALLED:

     _libgcc_mutex      pkgs/main/linux-64::_libgcc_mutex-0.1-main

   The following packages will be UPDATED:

     certifi                                   2019.3.9-py27_0 --> 2019.6.16-py27_0
     libgcc-ng                                8.2.0-hdf63c60_1 --> 9.1.0-hdf63c60_0
     pip                           pkgs/free::pip-9.0.1-py27_1 --> pkgs/main::pip-19.1.1-py27_0
     python                                  2.7.15-h9bab390_6 --> 2.7.16-h9bab390_0
     setuptools                          36.5.0-py27h68b189e_0 --> 41.0.1-py27_0
     sqlite                                  3.26.0-h7b6447c_0 --> 3.29.0-h7b6447c_0
     wheel                      pkgs/free::wheel-0.29.0-py27_0 --> pkgs/main::wheel-0.33.4-py27_0

   The following packages will be DOWNGRADED:

     nomkl                                               3.0-0 --> 1.0-0



   Downloading and Extracting Packages

   Preparing transaction: ...working... done
   Verifying transaction: ...working... done
   Executing transaction: ...working... done
-----> Installing dependencies using Pip
Usage:   
  pip install [options] <requirement specifier> [package-index-options] ...
  pip install [options] -r <requirements file> [package-index-options] ...
  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/Conda app.
 !     Push failed

标签: pythondjangoherokudeploymentanaconda

解决方案


您使用pip的是相当新的版本 19.1.1。

我不知道您之前使用的是什么版本,但该--allow-all-external选项在8.0 版(2016 年 1 月发布)中已弃用,并在pip10.0(2018 年初发布)中删除。pip

更新您的应用程序使其不需要--allow-all-external(更好的选择),或者,如果您绝对必须,使用pip早于 8.0.0 的版本。考虑到 8.0 是多久之前发布的,我强烈建议不要使用最后一个选项。


推荐阅读