3

我正在尝试在 Heroku 上部署一个使用 matplotlib 的 Web 应用程序。这个问题是相关的,但似乎并没有解决我的具体问题。更准确地说,我正在部署一个重复的应用程序“登台”用于测试目的。当我运行命令时:

git push staging master

将我的应用程序推送到 Heroku 我收到了意想不到的 Heroku 推送拒绝:

           ============================================================================
           BUILDING MATPLOTLIB
                       matplotlib: 1.1.1
                           python: 2.7.2 (default, Oct 31 2011, 16:22:04)  [GCC 4.4.3]
                         platform: linux2

           REQUIRED DEPENDENCIES
                            numpy: no
                                   * You must install numpy 1.4 or later to build
                                   * matplotlib.
           Complete output from command python setup.py egg_info:
           basedirlist is: ['/usr/local', '/usr']

       ============================================================================

       BUILDING MATPLOTLIB

                   matplotlib: 1.1.1

                       python: 2.7.2 (default, Oct 31 2011, 16:22:04)  [GCC 4.4.3]

                     platform: linux2



       REQUIRED DEPENDENCIES

                        numpy: no

                               * You must install numpy 1.4 or later to build

                               * matplotlib.

       ----------------------------------------
       Command python setup.py egg_info failed with error code 1 in /tmp/build_sj82km4g47z3/.heroku/venv/build/matplotlib
       Storing complete log in /app/.pip/pip.log
 !     Heroku push rejected, failed to compile Python app

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

出乎意料,因为我认为我已经解决了这个问题。事实上,我的生产应用程序运行良好。我通过有一个两层需求文件来解决它。

要求.txt:

numpy==1.6.2
-r ./prod-requirements.txt

产品要求.txt:

matplotlib==1.1.1
other requirements... 

显然我已经忘记了我是如何实际解决这个问题的。我记得由于 matplotlib 依赖于 numpy 的方式以及 Heroku 如何通过 pip 安装需求,这很棘手。这是我所指的问题。可以做什么?提前致谢。

4

1 回答 1

3

我通过从 prod-requirements.txt 文件中删除 matplotlib 解决了这个问题(请参阅原始问题)。然后部署,然后将 matplotlib 添加到我的 prod-requirements.txt 文件中,然后再次部署。我假设这就是通过 requirements.txt 实现的目标:

numpy==1.6.2
-r ./prod-requirements.txt

然后将 matplotlib=1.1.1 放入 prod-requirements 文件中。但显然不是。似乎我可以只用一个需求文件来实现这一点。

于 2012-12-26T00:37:04.853 回答