Heroku无法在requirements.txt中识别NumPy - python

我在尝试在Heroku上使用Flask运行python-recsys时遇到了困难

python-recsys的要求之一是它需要numpy

我的requirements.txt是

decorator==4.0.4
numpy==1.6.2
Flask==0.10.1
itsdangerous==0.24
Jinja2==2.8
MarkupSafe==0.23
networkx==1.10
git+https://github.com/ocelma/python-recsys.git
scipy==0.16.1
Werkzeug==0.10.4
wheel==0.24.0
Divisi2==2.2.5

产出

Counting objects: 4434, done.
Delta compression using up to 4 threads.
Compressing objects: 100% (4353/4353), done.
Writing objects: 100% (4434/4434), 33.17 MiB | 470 KiB/s, done.
Total 4434 (delta 394), reused 0 (delta 0)
remote: Compressing source files... done.
remote: Building source:
remote: 
remote: -----> Removing .DS_Store files
remote: -----> Python app detected
remote: -----> Installing runtime (python-2.7.10)
remote: -----> Installing dependencies with pip
remote:        Collecting git+https://github.com/ocelma/python-recsys.git          (from -r requirements.txt (line 8))
remote:          Cloning https://github.com/ocelma/python-recsys.git to    /tmp/pip-nCYxck-build
remote:        Collecting decorator==4.0.4 (from -r requirements.txt (line 1))
remote:          Downloading decorator-4.0.4-py2.py3-none-any.whl
remote:        Collecting numpy==1.6.2 (from -r requirements.txt (line 2))
remote:          Downloading numpy-1.6.2.tar.gz (2.6MB)
remote:        Collecting Flask==0.10.1 (from -r requirements.txt (line 3))
remote:          Downloading Flask-0.10.1.tar.gz (544kB)
remote:        Collecting itsdangerous==0.24 (from -r requirements.txt (line 4))
remote:          Downloading itsdangerous-0.24.tar.gz (46kB)
remote:        Collecting Jinja2==2.8 (from -r requirements.txt (line 5))
remote:          Downloading Jinja2-2.8-py2.py3-none-any.whl (263kB)
remote:        Collecting MarkupSafe==0.23 (from -r requirements.txt (line 6))
remote:          Downloading MarkupSafe-0.23.tar.gz
remote:        Collecting networkx==1.10 (from -r requirements.txt (line 7))
remote:          Downloading networkx-1.10.tar.gz (1.2MB)
remote:        Collecting scipy==0.16.1 (from -r requirements.txt (line 9))
remote:          Downloading scipy-0.16.1.tar.gz (12.2MB)
remote:        Collecting Werkzeug==0.10.4 (from -r requirements.txt (line 10))
remote:          Downloading Werkzeug-0.10.4-py2.py3-none-any.whl (293kB)
remote:        Collecting wheel==0.24.0 (from -r requirements.txt (line 11))
remote:          Downloading wheel-0.24.0-py2.py3-none-any.whl (63kB)
remote:        Collecting Divisi2==2.2.5 (from -r requirements.txt (line 12))
remote:          Downloading Divisi2-2.2.5.tar.gz (10.9MB)
remote:            Complete output from command python setup.py egg_info:
remote:            This package requires NumPy.
remote:            
remote:            On a Debian / Ubuntu system, you can run:
remote:              sudo apt-get install python-numpy python-dev
remote:            
remote:            Otherwise it will probably suffice to:
remote:              sudo easy_install numpy
remote:            
remote:            
remote:            ----------------------------------------
remote: Command "python setup.py egg_info" failed with error code 1 in /tmp/pip-    build-U6idSN/Divisi2
remote: 
remote:  !     Push rejected, failed to compile Python app

从输出中似乎已安装了numpy(第2行)
但输出为已卸载

我尝试了不同的变体,包括不同版本的numpy
我试过将numpy需求放在requirements.txt中的不同位置

关于什么导致此错误的任何想法?
有没有更好的方法来安装numpy?

参考方案

我已经按照@MatO的建议进行了修复:

在本地运行python.exe -m pip install python-dev-tools

pip freeze > requirements.txt重新生成requirements.txt

使用git add .添加更改

提交git commit -m "v5"

推送到Heroku git push heroku master

部署后,我可以运行我的应用程序,尽管我得到警告:

警告:您的文件大小(397 MB)超出了我们的软限制(300 MB)
这可能会影响启动时间。

我的应用程序使用了59 MB,现在比不使用virtualenv部署它时要大。

Python sqlite3数据库已锁定 - python

我在Windows上使用Python 3和sqlite3。我正在开发一个使用数据库存储联系人的小型应用程序。我注意到,如果应用程序被强制关闭(通过错误或通过任务管理器结束),则会收到sqlite3错误(sqlite3.OperationalError:数据库已锁定)。我想这是因为在应用程序关闭之前,我没有正确关闭数据库连接。我已经试过了: connectio…

Python:传递记录器是个好主意吗? - python

我的Web服务器的API日志如下:started started succeeded failed 那是同时收到的两个请求。很难说哪一个成功或失败。为了彼此分离请求,我为每个请求创建了一个随机数,并将其用作记录器的名称logger = logging.getLogger(random_number) 日志变成[111] started [222] start…

Python-Excel导出 - python

我有以下代码:import pandas as pd import requests from bs4 import BeautifulSoup res = requests.get("https://www.bankier.pl/gielda/notowania/akcje") soup = BeautifulSoup(res.cont…

Python pytz时区函数返回的时区为9分钟 - python

由于某些原因,我无法从以下代码中找出原因:>>> from pytz import timezone >>> timezone('America/Chicago') 我得到:<DstTzInfo 'America/Chicago' LMT-1 day, 18:09:00 STD…

用大写字母拆分字符串,但忽略AAA Python Regex - python

我的正则表达式:vendor = "MyNameIsJoe. I'mWorkerInAAAinc." ven = re.split(r'(?<=[a-z])[A-Z]|[A-Z](?=[a-z])', vendor) 以大写字母分割字符串,例如:'我的名字是乔。 I'mWorkerInAAAinc”变成…