我正在尝试将python flask应用程序推送到heroku。我有一个requirements.txt文件,但是我无法弄清楚如何安装在Requirements.txt文件中安装依赖项之一所需的先决条件。我在我的requirements.txt文件中有一个github存储库作为依赖项,但这需要安装Cython
和numpy
。将Cython
和numpy
添加到我的requirements.txt文件中时,即使在requirements.txt文件的github回购之前有Cython
和numpy
时,它也会显示错误。
错误日志
File "/Users/sayam/Desktop/ti-heroku/venv3/src/detectron/setup.py", line 12, in <module>
from Cython.Build import cythonize
ImportError: No module named Cython.Build
----------------------------------------
ERROR: Command errored out with exit status 1: python setup.py egg_info Check the logs for full command output.
requirements.txt
Cython==0.29.14
numpy==1.16.5
-e git+https://github.com/facebookresearch/densepose@35e69d110b432704c2183cd6aea531f4f695edbe#egg=Detectron
请注意,以前在requirements.txt文件中提到了Cython和numpy,但仍然会出错。
我在这里指的github存储库的setup.py文件中包含以下内容。
# Copyright (c) Facebook, Inc. and its affiliates.
# All rights reserved.
#
# This source code is licensed under the license found in the
# LICENSE file in the root directory of this source tree.
##############################################################################
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
from Cython.Build import cythonize
from setuptools import Extension
from setuptools import setup
import numpy as np
_NP_INCLUDE_DIRS = np.get_include()
# Extension modules
ext_modules = [
Extension(
name='detectron.utils.cython_bbox',
sources=[
'detectron/utils/cython_bbox.pyx'
],
extra_compile_args=[
'-Wno-cpp'
],
include_dirs=[
_NP_INCLUDE_DIRS
]
),
Extension(
name='detectron.utils.cython_nms',
sources=[
'detectron/utils/cython_nms.pyx'
],
extra_compile_args=[
'-Wno-cpp'
],
include_dirs=[
_NP_INCLUDE_DIRS
]
)
]
setup(
name='Detectron',
packages=['detectron'],
ext_modules=cythonize(ext_modules)
)
此外,由于它是Heroku,因此在运行requirements.txt文件之前,我无法手动执行pip install Cython
和pip install numpy
。
请提出解决此问题的方法。