如何获得pip使用正确版本的cython来构建Heroku推送的需求

时间:2017-09-28 21:15:31

标签: python ubuntu heroku

操作系统:基于Ubuntu 14.04 LTS的Biolinux 8

我没有经验,这是我的第一篇文章,只是学习开发前端Web应用程序。 (基本N00B)

我第一次尝试将我的应用部署到heroku。 本教程中提供的测试应用程序在Web和本地都可以顺利运行。

在使用 Flask 设置我的应用程序的过程中,我运行了pip freeze > requirements.txt,它被放到了我的repo的根文件夹中。

已生成Procfile和网络应用程序文件

生成的文件在第1行有此条目;

  

用Cython == 0.20.1.post0

当我运行git push heroku master时,我得到了以下输出;

remote: Compressing source files... done.  
remote: Building source:
remote:
remote: -----> Python app detected
remote: -----> Installing python-3.6.2
remote: -----> Installing pip
remote: -----> Installing requirements with pip
remote:        Collecting Cython==0.20.1.post0 (from -r /tmp/build_63aace3295cb1453f6de1395392f3225/requirements.txt (line 1))
remote:        Could not find a version that satisfies the requirement Cython==0.20.1.post0 
               (from -r /tmp/build_63aace3295cb1453f6de1395392f3225/requirements.txt (line 1)) 
               (from versions: 0.9.6.5, 0.9.6.6, 0.9.6.7, 0.9.6.8, 0.9.6.10b0, 0.9.6.10, 0.9.6.10.1, 0.9.6.11b0, 0.9.6.11, 
               0.9.6.12, 0.9.6.13, 0.9.6.13.1, 0.9.6.14, 0.9.8, 
               0.9.8.1, 0.9.8.1.1, 0.10, 0.10.1, 0.10.2, 0.10.3, 0.11, 0.11.1, 0.11.2, 0.11.3, 0.12, 0.12.1, 0.13,
               0.14, 0.14.1, 0.15, 0.15.1, 0.16, 0.17, 0.17.1, 0.17.2, 0.17.3, 0.17.4, 0.18, 0.19, 0.19.1, 0.19.2, 
               0.20, 0.20.1, 0.20.2, 0.21, 0.21.1, 0.21.2, 0.22, 0.22.1, 
               0.23, 0.23.1, 0.23.2, 0.23.3, 0.23.4, 0.23.5, 0.24, 0.24.1, 0.25, 0.25.1, 0.25.2, 0.26, 0.26.1, 0.27)
remote:        No matching distribution found for Cython==0.20.1.post0 (from -r /tmp/build_63aace3295cb1453f6de1395392f3225/requirements.txt (line 1))
remote:  !     Push rejected, failed to compile Python app.
remote:
remote:  !     Push failed
remote: Verifying deploy...
remote:
remote: !       Push rejected to limitless-wave-64303.
remote:
To https://git.heroku.com/limitless-wave-64303.git
 ! [remote rejected] master -> master (pre-receive hook declined)
error: failed to push some refs to 'https://git.heroku.com/limitless-wave-64303.git'

我从requirements.txt文件中删除了有问题的Cython版本 但显然这不是导致问题的文件。

我试图重新启动,希望能够清除/ tmp文件夹中生成新requirements.txt文件但没有运气。

我已将Cython升级到版本0.24,但当我尝试推送时,pip仍会搜索Cython版本0.20.1.post0

如何获取pip来修复它的需求文件并使用有效版本的Cython或根本不使用?似乎Cython甚至不需要部署

2 个答案:

答案 0 :(得分:0)

尝试使用pip3而不是pip。所以在你的例子中,你会跑 pip3冷冻> requirements.txt。或者你可以用pip3别名pip。祝你好运。

答案 1 :(得分:0)

我想出了解决方法。

在包含具有未知版本依赖项的requirements.txt文件的repo上运行container.registerInstance(RoundService, roundService); container.registerInstance(CommunicationService, service); viewModel = container.get(Communications); component = StageComponent .withResources(PLATFORM.moduleName('path/to/real/communications')) .inView('<communications></communications>') .boundTo(viewModel); component.bootstrap(aurelia => { aurelia.use.standardConfiguration() .plugin(PLATFORM.moduleName("aurelia-validation")); }); 将损坏它。

因此修复了需求文件, 我需要再次运行heroku create,以便构建一个加载“干净”需求文件的远程。

感谢您的帮助!