在 Heroku 中设置 Python Conda 环境

Setting up Python Conda Environment in Heroku

提问人:Sterling Butters 提问时间:3/10/2019 最后编辑:Sterling Butters 更新时间:6/30/2019 访问量:2254

问:

背景

我在我的项目目录中创建了一个 heroku 实例,使用此处的 conda 环境指南:conda-buildpack

错误

sterlingbutters$ git push heroku master
Counting objects: 7, done.
Delta compression using up to 8 threads.
Compressing objects: 100% (7/7), done.
Writing objects: 100% (7/7), 2.68 KiB | 2.68 MiB/s, done.
Total 7 (delta 1), reused 0 (delta 0)
remote: Compressing source files... done.
remote: Building source:
remote: 
remote: -----> Python/Conda app detected
remote: -----> Preparing Python/Miniconda Environment (3.8.3)
remote: /app/tmp/buildpacks/2abac4b7166986c6b1b33fcacccb13fb4e2036a9358f31ed8886bbf37c9987c7fbb8243090f0438ebbf02852a1cbeb1b5cae47f67dc2670115ce6d7bd2468300/bin/steps/conda_compile: line 9: conda: command not found
remote:  !     Push rejected, failed to compile Python/Conda app.
remote: 
remote:  !     Push failed
remote: Verifying deploy...
remote: 
remote: !       Push rejected to openmc-dash-interface.
remote: 
To https://git.heroku.com/openmc-dash-interface.git
 ! [remote rejected] master -> master (pre-receive hook declined)
error: failed to push some refs to 'https://git.heroku.com/openmc-dash-interface.git'

关于可能导致错误的原因的任何想法?

其他要求

  • 部署 python 应用程序后,我仍然需要添加 conda 通道才能安装特定包。我该怎么做?
  • 有些包要求在 conda 上没有兼容版本,只有 PyPI(),在 heroku 中使用 conda 环境会丧失使用 pip 的能力吗?pip

更新:我想我弄清楚了我的附加要求和内容:environment.yml

name: openmc-dash-interface
channels:
    - conda-forge
dependencies:
- python=3.6
- anaconda
- openmc
- pip
- pip:
  - dash
  - plotly
  - dash-core-components
  - dash-html-components
  - dash-daq
  - numpy
  - pandas
  - gunicorn

但在构建时仍然出现错误

提前感谢您的任何/所有帮助

蟒蛇 heroku pip anaconda conda

评论

0赞 Sterling Butters 3/11/2019
根据这里的帖子: groups.google.com/a/continuum.io/forum/#!topic/conda/... 支持 pip 和 conda 包 - 但仍然不确定如何指定所需的 pkg 管理器environment.yml
0赞 Sterling Butters 3/11/2019
对上述评论的回答:stackoverflow.com/questions/35245401/......

答:

2赞 Sterling Butters 3/11/2019 #1

此构建包似乎不支持 Python3:https://github.com/heroku-python/conda-buildpack/issues/14

但是,存在其他第三方构建包,它们似乎支持 Python3: https://elements.heroku.com/buildpacks/trib3/conda-buildpack https://elements.heroku.com/buildpacks/teamupstart/conda-buildpack

也许:https://github.com/pl31/heroku-buildpack-conda