如何使用requirements.txt在Heroku python Web应用程序中安装Dlib?

时间:2017-10-07 15:58:55

标签: python opencv heroku boost dlib

我构建了一个涉及机器学习的Python Flask Web API,我在Heroku上部署它时遇到了很多麻烦。

问题是,我的应用程序依赖于Dlib(一个库),我似乎找不到在Heroku服务器中安装的方法。我正在试图解决这个问题而失去理智,我可以想象那些可能会遇到这个问题的其他AI开发人员。请帮帮我

这是我到目前为止所做的工作。

我尝试过不使用Buildpack,方法是在我的requirements.txt中指定dlib == 19.4.0及其依赖项,但由于依赖Boost而失败。

我研究了Dlib(https://www.pyimagesearch.com/2017/03/27/how-to-install-dlib/)的依赖关系;

build-essential cmake  # I already have this in my requirements.txt
libgtk-3-dev
libboost-all-dev

此外,

numpy  # I already have this in my requirements.txt
scipy  # I already have this in my requirements.txt
sciKit-Image  # I already have this in my requirements.txt

所以我包括了boost == 0.1,cmake == 0.7.1&我的requirements.txt文件中的boost-py == 1.00。 安装失败,这是构建日志

-----> Python app detected
 !     The latest version of Python 3 is python-3.6.2 (you are using python-3.6.1, which is unsupported).
 !     We recommend upgrading by specifying the latest version (python-3.6.2).
       Learn More: https://devcenter.heroku.com/articles/python-runtimes
-----> Installing python-3.6.1
-----> Installing pip
-----> Installing requirements with pip
       Collecting gunicorn (from -r /tmp/build_910a6f43d62d0d69b0d944c5ae4b3c87/Nuelsian-deployment-0ffa4db157435edabc6f7cb904da61e2379ac163/requirements.txt (line 1))
         Downloading gunicorn-19.7.1-py2.py3-none-any.whl (111kB)
       Collecting boost==0.1 (from -r /tmp/build_910a6f43d62d0d69b0d944c5ae4b3c87/Nuelsian-deployment-0ffa4db157435edabc6f7cb904da61e2379ac163/requirements.txt (line 2))
         Downloading boost-0.1.tar.gz
       Collecting boost-py==1.0.0 (from -r /tmp/build_910a6f43d62d0d69b0d944c5ae4b3c87/Nuelsian-deployment-0ffa4db157435edabc6f7cb904da61e2379ac163/requirements.txt (line 3))
         Downloading boost_py-1.0.0-py3-none-any.whl
       Collecting click==6.7 (from -r /tmp/build_910a6f43d62d0d69b0d944c5ae4b3c87/Nuelsian-deployment-0ffa4db157435edabc6f7cb904da61e2379ac163/requirements.txt (line 4))
         Downloading click-6.7-py2.py3-none-any.whl (71kB)
       Collecting cmake==0.7.1 (from -r /tmp/build_910a6f43d62d0d69b0d944c5ae4b3c87/Nuelsian-deployment-0ffa4db157435edabc6f7cb904da61e2379ac163/requirements.txt (line 5))
         Downloading cmake-0.7.1-cp36-cp36m-manylinux1_x86_64.whl (19.1MB)
       Collecting colorthief==0.2.1 (from -r /tmp/build_910a6f43d62d0d69b0d944c5ae4b3c87/Nuelsian-deployment-0ffa4db157435edabc6f7cb904da61e2379ac163/requirements.txt (line 6))
         Downloading colorthief-0.2.1-py2.py3-none-any.whl
       Collecting cycler==0.10.0 (from -r /tmp/build_910a6f43d62d0d69b0d944c5ae4b3c87/Nuelsian-deployment-0ffa4db157435edabc6f7cb904da61e2379ac163/requirements.txt (line 7))
         Downloading cycler-0.10.0-py2.py3-none-any.whl
       Collecting Flask==0.12.2 (from -r /tmp/build_910a6f43d62d0d69b0d944c5ae4b3c87/Nuelsian-deployment-0ffa4db157435edabc6f7cb904da61e2379ac163/requirements.txt (line 8))
         Downloading Flask-0.12.2-py2.py3-none-any.whl (83kB)
       Collecting Flask-Gunicorn==0.1.1 (from -r /tmp/build_910a6f43d62d0d69b0d944c5ae4b3c87/Nuelsian-deployment-0ffa4db157435edabc6f7cb904da61e2379ac163/requirements.txt (line 9))
         Downloading Flask_Gunicorn-0.1.1-py3-none-any.whl
       Collecting imutils==0.4.3 (from -r /tmp/build_910a6f43d62d0d69b0d944c5ae4b3c87/Nuelsian-deployment-0ffa4db157435edabc6f7cb904da61e2379ac163/requirements.txt (line 10))
         Downloading imutils-0.4.3.tar.gz
       Collecting itsdangerous==0.24 (from -r /tmp/build_910a6f43d62d0d69b0d944c5ae4b3c87/Nuelsian-deployment-0ffa4db157435edabc6f7cb904da61e2379ac163/requirements.txt (line 11))
         Downloading itsdangerous-0.24.tar.gz (46kB)
       Collecting Jinja2==2.9.6 (from -r /tmp/build_910a6f43d62d0d69b0d944c5ae4b3c87/Nuelsian-deployment-0ffa4db157435edabc6f7cb904da61e2379ac163/requirements.txt (line 12))
         Downloading Jinja2-2.9.6-py2.py3-none-any.whl (340kB)
       Collecting jsonify==0.5 (from -r /tmp/build_910a6f43d62d0d69b0d944c5ae4b3c87/Nuelsian-deployment-0ffa4db157435edabc6f7cb904da61e2379ac163/requirements.txt (line 13))
         Downloading jsonify-0.5.tar.gz
       Collecting MarkupSafe==1.0 (from -r /tmp/build_910a6f43d62d0d69b0d944c5ae4b3c87/Nuelsian-deployment-0ffa4db157435edabc6f7cb904da61e2379ac163/requirements.txt (line 14))
         Downloading MarkupSafe-1.0.tar.gz
       Collecting matplotlib==2.0.2 (from -r /tmp/build_910a6f43d62d0d69b0d944c5ae4b3c87/Nuelsian-deployment-0ffa4db157435edabc6f7cb904da61e2379ac163/requirements.txt (line 15))
         Downloading matplotlib-2.0.2-cp36-cp36m-manylinux1_x86_64.whl (14.6MB)
       Collecting numpy==1.13.0 (from -r /tmp/build_910a6f43d62d0d69b0d944c5ae4b3c87/Nuelsian-deployment-0ffa4db157435edabc6f7cb904da61e2379ac163/requirements.txt (line 16))
         Downloading numpy-1.13.0-cp36-cp36m-manylinux1_x86_64.whl (17.0MB)
       Collecting olefile==0.44 (from -r /tmp/build_910a6f43d62d0d69b0d944c5ae4b3c87/Nuelsian-deployment-0ffa4db157435edabc6f7cb904da61e2379ac163/requirements.txt (line 17))
         Downloading olefile-0.44.zip (74kB)
       Collecting opencv-python==3.2.0.7 (from -r /tmp/build_910a6f43d62d0d69b0d944c5ae4b3c87/Nuelsian-deployment-0ffa4db157435edabc6f7cb904da61e2379ac163/requirements.txt (line 18))
         Downloading opencv_python-3.2.0.7-cp36-cp36m-manylinux1_x86_64.whl (6.7MB)
       Collecting Pillow==4.1.1 (from -r /tmp/build_910a6f43d62d0d69b0d944c5ae4b3c87/Nuelsian-deployment-0ffa4db157435edabc6f7cb904da61e2379ac163/requirements.txt (line 19))
         Downloading Pillow-4.1.1-cp36-cp36m-manylinux1_x86_64.whl (5.7MB)
       Collecting pymongo==3.4.0 (from -r /tmp/build_910a6f43d62d0d69b0d944c5ae4b3c87/Nuelsian-deployment-0ffa4db157435edabc6f7cb904da61e2379ac163/requirements.txt (line 20))
         Downloading pymongo-3.4.0.tar.gz (583kB)
       Collecting pyparsing==2.2.0 (from -r /tmp/build_910a6f43d62d0d69b0d944c5ae4b3c87/Nuelsian-deployment-0ffa4db157435edabc6f7cb904da61e2379ac163/requirements.txt (line 21))
         Downloading pyparsing-2.2.0-py2.py3-none-any.whl (56kB)
       Collecting python-dateutil==2.6.0 (from -r /tmp/build_910a6f43d62d0d69b0d944c5ae4b3c87/Nuelsian-deployment-0ffa4db157435edabc6f7cb904da61e2379ac163/requirements.txt (line 22))
         Downloading python_dateutil-2.6.0-py2.py3-none-any.whl (194kB)
       Collecting pytz==2017.2 (from -r /tmp/build_910a6f43d62d0d69b0d944c5ae4b3c87/Nuelsian-deployment-0ffa4db157435edabc6f7cb904da61e2379ac163/requirements.txt (line 23))
         Downloading pytz-2017.2-py2.py3-none-any.whl (484kB)
       Collecting six==1.10.0 (from -r /tmp/build_910a6f43d62d0d69b0d944c5ae4b3c87/Nuelsian-deployment-0ffa4db157435edabc6f7cb904da61e2379ac163/requirements.txt (line 24))
         Downloading six-1.10.0-py2.py3-none-any.whl
       Collecting Werkzeug==0.12.2 (from -r /tmp/build_910a6f43d62d0d69b0d944c5ae4b3c87/Nuelsian-deployment-0ffa4db157435edabc6f7cb904da61e2379ac163/requirements.txt (line 25))
         Downloading Werkzeug-0.12.2-py2.py3-none-any.whl (312kB)
       Collecting dlib==19.7.0 (from -r /tmp/build_910a6f43d62d0d69b0d944c5ae4b3c87/Nuelsian-deployment-0ffa4db157435edabc6f7cb904da61e2379ac163/requirements.txt (line 26))
         Downloading dlib-19.7.0.tar.gz (4.0MB)
       Collecting Mastodon.py (from boost==0.1->-r /tmp/build_910a6f43d62d0d69b0d944c5ae4b3c87/Nuelsian-deployment-0ffa4db157435edabc6f7cb904da61e2379ac163/requirements.txt (line 2))
         Downloading Mastodon.py-1.1.1-py2.py3-none-any.whl
       Collecting sqlalchemy (from boost==0.1->-r /tmp/build_910a6f43d62d0d69b0d944c5ae4b3c87/Nuelsian-deployment-0ffa4db157435edabc6f7cb904da61e2379ac163/requirements.txt (line 2))
         Downloading SQLAlchemy-1.1.14.tar.gz (5.2MB)
       Collecting peppercorn (from boost-py==1.0.0->-r /tmp/build_910a6f43d62d0d69b0d944c5ae4b3c87/Nuelsian-deployment-0ffa4db157435edabc6f7cb904da61e2379ac163/requirements.txt (line 3))
         Downloading peppercorn-0.5.tar.gz
       Collecting requests (from Mastodon.py->boost==0.1->-r /tmp/build_910a6f43d62d0d69b0d944c5ae4b3c87/Nuelsian-deployment-0ffa4db157435edabc6f7cb904da61e2379ac163/requirements.txt (line 2))
         Downloading requests-2.18.4-py2.py3-none-any.whl (88kB)
       Collecting urllib3<1.23,>=1.21.1 (from requests->Mastodon.py->boost==0.1->-r /tmp/build_910a6f43d62d0d69b0d944c5ae4b3c87/Nuelsian-deployment-0ffa4db157435edabc6f7cb904da61e2379ac163/requirements.txt (line 2))
         Downloading urllib3-1.22-py2.py3-none-any.whl (132kB)
       Collecting idna<2.7,>=2.5 (from requests->Mastodon.py->boost==0.1->-r /tmp/build_910a6f43d62d0d69b0d944c5ae4b3c87/Nuelsian-deployment-0ffa4db157435edabc6f7cb904da61e2379ac163/requirements.txt (line 2))
         Downloading idna-2.6-py2.py3-none-any.whl (56kB)
       Collecting certifi>=2017.4.17 (from requests->Mastodon.py->boost==0.1->-r /tmp/build_910a6f43d62d0d69b0d944c5ae4b3c87/Nuelsian-deployment-0ffa4db157435edabc6f7cb904da61e2379ac163/requirements.txt (line 2))
         Downloading certifi-2017.7.27.1-py2.py3-none-any.whl (349kB)
       Collecting chardet<3.1.0,>=3.0.2 (from requests->Mastodon.py->boost==0.1->-r /tmp/build_910a6f43d62d0d69b0d944c5ae4b3c87/Nuelsian-deployment-0ffa4db157435edabc6f7cb904da61e2379ac163/requirements.txt (line 2))
         Downloading chardet-3.0.4-py2.py3-none-any.whl (133kB)
       Installing collected packages: gunicorn, urllib3, idna, certifi, chardet, requests, six, python-dateutil, pytz, Mastodon.py, sqlalchemy, boost, peppercorn, boost-py, click, cmake, olefile, Pillow, colorthief, cycler, itsdangerous, MarkupSafe, Jinja2, Werkzeug, Flask, Flask-Gunicorn, imutils, jsonify, pyparsing, numpy, matplotlib, opencv-python, pymongo, dlib
         Running setup.py install for sqlalchemy: started
           Running setup.py install for sqlalchemy: finished with status 'done'
         Running setup.py install for boost: started
           Running setup.py install for boost: finished with status 'done'
         Running setup.py install for peppercorn: started
           Running setup.py install for peppercorn: finished with status 'done'
         Running setup.py install for olefile: started
           Running setup.py install for olefile: finished with status 'done'
         Running setup.py install for itsdangerous: started
           Running setup.py install for itsdangerous: finished with status 'done'
         Running setup.py install for MarkupSafe: started
           Running setup.py install for MarkupSafe: finished with status 'done'
         Running setup.py install for imutils: started
           Running setup.py install for imutils: finished with status 'done'
         Running setup.py install for jsonify: started
           Running setup.py install for jsonify: finished with status 'done'
         Running setup.py install for pymongo: started
           Running setup.py install for pymongo: finished with status 'done'
         Running setup.py install for dlib: started
           Running setup.py install for dlib: finished with status 'error'
           Complete output from command /app/.heroku/python/bin/python -u -c "import setuptools, tokenize;__file__='/tmp/pip-build-yongtg64/dlib/setup.py';f=getattr(tokenize, 'open', open)(__file__);code=f.read().replace('\r\n', '\n');f.close();exec(compile(code, __file__, 'exec'))" install --record /tmp/pip-377kpsyp-record/install-record.txt --single-version-externally-managed --compile:
           running install
           running build
           Detected Python architecture: 64bit
           Detected platform: linux
           Configuring cmake ...
           -- The C compiler identification is GNU 5.4.0
           -- The CXX compiler identification is GNU 5.4.0
           -- Check for working C compiler: /usr/bin/cc
           -- Check for working C compiler: /usr/bin/cc -- works
           -- Detecting C compiler ABI info
           -- Detecting C compiler ABI info - done
           -- Detecting C compile features
           -- Detecting C compile features - done
           -- Check for working CXX compiler: /usr/bin/c++
           -- Check for working CXX compiler: /usr/bin/c++ -- works
           -- Detecting CXX compiler ABI info
           -- Detecting CXX compiler ABI info - done
           -- Detecting CXX compile features
           -- Detecting CXX compile features - done
           CMake Warning at /tmp/build_910a6f43d62d0d69b0d944c5ae4b3c87/Nuelsian-deployment-0ffa4db157435edabc6f7cb904da61e2379ac163/.heroku/python/lib/python3.6/site-packages/cmake/data/share/cmake-3.8/Modules/FindBoost.cmake:765 (message):
             Imported targets not available for Boost version
           Call Stack (most recent call first):
             /tmp/build_910a6f43d62d0d69b0d944c5ae4b3c87/Nuelsian-deployment-0ffa4db157435edabc6f7cb904da61e2379ac163/.heroku/python/lib/python3.6/site-packages/cmake/data/share/cmake-3.8/Modules/FindBoost.cmake:869 (_Boost_COMPONENT_DEPENDENCIES)
             /tmp/build_910a6f43d62d0d69b0d944c5ae4b3c87/Nuelsian-deployment-0ffa4db157435edabc6f7cb904da61e2379ac163/.heroku/python/lib/python3.6/site-packages/cmake/data/share/cmake-3.8/Modules/FindBoost.cmake:1472 (_Boost_MISSING_DEPENDENCIES)
             /tmp/pip-build-yongtg64/dlib/dlib/cmake_utils/add_python_module:61 (FIND_PACKAGE)
             CMakeLists.txt:9 (include)
           CMake Warning at /tmp/build_910a6f43d62d0d69b0d944c5ae4b3c87/Nuelsian-deployment-0ffa4db157435edabc6f7cb904da61e2379ac163/.heroku/python/lib/python3.6/site-packages/cmake/data/share/cmake-3.8/Modules/FindBoost.cmake:1536 (message):
             No header defined for python-py34; skipping header check
           Call Stack (most recent call first):
             /tmp/pip-build-yongtg64/dlib/dlib/cmake_utils/add_python_module:61 (FIND_PACKAGE)
             CMakeLists.txt:9 (include)
           -- Could NOT find Boost
           CMake Warning at /tmp/build_910a6f43d62d0d69b0d944c5ae4b3c87/Nuelsian-deployment-0ffa4db157435edabc6f7cb904da61e2379ac163/.heroku/python/lib/python3.6/site-packages/cmake/data/share/cmake-3.8/Modules/FindBoost.cmake:765 (message):
             Imported targets not available for Boost version
           Call Stack (most recent call first):
             /tmp/build_910a6f43d62d0d69b0d944c5ae4b3c87/Nuelsian-deployment-0ffa4db157435edabc6f7cb904da61e2379ac163/.heroku/python/lib/python3.6/site-packages/cmake/data/share/cmake-3.8/Modules/FindBoost.cmake:869 (_Boost_COMPONENT_DEPENDENCIES)
             /tmp/build_910a6f43d62d0d69b0d944c5ae4b3c87/Nuelsian-deployment-0ffa4db157435edabc6f7cb904da61e2379ac163/.heroku/python/lib/python3.6/site-packages/cmake/data/share/cmake-3.8/Modules/FindBoost.cmake:1472 (_Boost_MISSING_DEPENDENCIES)
             /tmp/pip-build-yongtg64/dlib/dlib/cmake_utils/add_python_module:63 (FIND_PACKAGE)
             CMakeLists.txt:9 (include)
           CMake Warning at /tmp/build_910a6f43d62d0d69b0d944c5ae4b3c87/Nuelsian-deployment-0ffa4db157435edabc6f7cb904da61e2379ac163/.heroku/python/lib/python3.6/site-packages/cmake/data/share/cmake-3.8/Modules/FindBoost.cmake:1536 (message):
             No header defined for python-py35; skipping header check
           Call Stack (most recent call first):
             /tmp/pip-build-yongtg64/dlib/dlib/cmake_utils/add_python_module:63 (FIND_PACKAGE)
             CMakeLists.txt:9 (include)
           -- Could NOT find Boost
           CMake Warning at /tmp/build_910a6f43d62d0d69b0d944c5ae4b3c87/Nuelsian-deployment-0ffa4db157435edabc6f7cb904da61e2379ac163/.heroku/python/lib/python3.6/site-packages/cmake/data/share/cmake-3.8/Modules/FindBoost.cmake:765 (message):
             Imported targets not available for Boost version
           Call Stack (most recent call first):
             /tmp/build_910a6f43d62d0d69b0d944c5ae4b3c87/Nuelsian-deployment-0ffa4db157435edabc6f7cb904da61e2379ac163/.heroku/python/lib/python3.6/site-packages/cmake/data/share/cmake-3.8/Modules/FindBoost.cmake:869 (_Boost_COMPONENT_DEPENDENCIES)
             /tmp/build_910a6f43d62d0d69b0d944c5ae4b3c87/Nuelsian-deployment-0ffa4db157435edabc6f7cb904da61e2379ac163/.heroku/python/lib/python3.6/site-packages/cmake/data/share/cmake-3.8/Modules/FindBoost.cmake:1472 (_Boost_MISSING_DEPENDENCIES)
             /tmp/pip-build-yongtg64/dlib/dlib/cmake_utils/add_python_module:66 (FIND_PACKAGE)
             CMakeLists.txt:9 (include)
           CMake Warning at /tmp/build_910a6f43d62d0d69b0d944c5ae4b3c87/Nuelsian-deployment-0ffa4db157435edabc6f7cb904da61e2379ac163/.heroku/python/lib/python3.6/site-packages/cmake/data/share/cmake-3.8/Modules/FindBoost.cmake:1536 (message):
             No header defined for python3; skipping header check
           Call Stack (most recent call first):
             /tmp/pip-build-yongtg64/dlib/dlib/cmake_utils/add_python_module:66 (FIND_PACKAGE)
             CMakeLists.txt:9 (include)
           -- Could NOT find Boost
           CMake Warning at /tmp/build_910a6f43d62d0d69b0d944c5ae4b3c87/Nuelsian-deployment-0ffa4db157435edabc6f7cb904da61e2379ac163/.heroku/python/lib/python3.6/site-packages/cmake/data/share/cmake-3.8/Modules/FindBoost.cmake:765 (message):
             Imported targets not available for Boost version
           Call Stack (most recent call first):
             /tmp/build_910a6f43d62d0d69b0d944c5ae4b3c87/Nuelsian-deployment-0ffa4db157435edabc6f7cb904da61e2379ac163/.heroku/python/lib/python3.6/site-packages/cmake/data/share/cmake-3.8/Modules/FindBoost.cmake:869 (_Boost_COMPONENT_DEPENDENCIES)
             /tmp/build_910a6f43d62d0d69b0d944c5ae4b3c87/Nuelsian-deployment-0ffa4db157435edabc6f7cb904da61e2379ac163/.heroku/python/lib/python3.6/site-packages/cmake/data/share/cmake-3.8/Modules/FindBoost.cmake:1472 (_Boost_MISSING_DEPENDENCIES)
             /tmp/pip-build-yongtg64/dlib/dlib/cmake_utils/add_python_module:69 (FIND_PACKAGE)
             CMakeLists.txt:9 (include)
           -- Could NOT find Boost
           -- Found PythonLibs: /tmp/build_910a6f43d62d0d69b0d944c5ae4b3c87/Nuelsian-deployment-0ffa4db157435edabc6f7cb904da61e2379ac163/.heroku/python/lib/libpython3.6m.a (found suitable version "3.6.1", minimum required is "3.4")
           --  *****************************************************************************************************
           --  To compile Boost.Python yourself download boost from boost.org and then go into the boost root folder
           --  and run these commands:
           --     ./bootstrap.sh --with-libraries=python
           --     ./b2
           --     sudo ./b2 install
           --  *****************************************************************************************************
           CMake Error at /tmp/pip-build-yongtg64/dlib/dlib/cmake_utils/add_python_module:116 (message):
              Boost python library not found.
           Call Stack (most recent call first):
             CMakeLists.txt:9 (include)
           -- Configuring incomplete, errors occurred!
           See also "/tmp/pip-build-yongtg64/dlib/tools/python/build/CMakeFiles/CMakeOutput.log".
           error: cmake configuration failed!

           ----------------------------------------
       Command "/app/.heroku/python/bin/python -u -c "import setuptools, tokenize;__file__='/tmp/pip-build-yongtg64/dlib/setup.py';f=getattr(tokenize, 'open', open)(__file__);code=f.read().replace('\r\n', '\n');f.close();exec(compile(code, __file__, 'exec'))" install --record /tmp/pip-377kpsyp-record/install-record.txt --single-version-externally-managed --compile" failed with error code 1 in /tmp/pip-build-yongtg64/dlib/
 !     Push rejected, failed to compile Python app.
 !     Push failed

我也尝试过使用Heroku Buildpack,https://github.com/J-A-M-E-5/heroku16-buildpack-python3-opencv-dlib.githttps://github.com/J-A-M-E-5/heroku114-buildpack-python3-opencv-dlib.git 这几乎就像Heroku跳过了我的requirements.txt,只尝试安装Buildpacks。

以下是日志文件:

-----> Python3 + OpenCV + DLib app detected
-----> Generating environment
       Fetching...
       Unpacking...
tar: This does not look like a tar archive
xz: (stdin): File format not recognized
tar: Child returned status 1
tar: Error is not recoverable: exiting now
-----> Found requirements.txt, installing dependencies using pip
/app/tmp/buildpacks/6c499595b704aea0287ed02dc4cb12382496a45391b9e41bdf4fe9d946bbf725b480741dac04e7f02dbb412489937b86a1837abdc27865b9b20adfce0b360eef/bin/compile: line 78: /app/.heroku/vendor/bin/pip3: No such file or directory
-----> Creating environment variables.
-----> Buildpack installed.
-----> Discovering process types
       Procfile declares types -> web
-----> Compressing...
       Done: 185.4M
-----> Launching...
       Released v3
       https://magicmirrordotai.herokuapp.com/ deployed to Heroku

当我打开应用程序时,我收到应用程序错误和log;

2017-10-07T12:33:47.122379+00:00 heroku[web.1]: Starting process with command `gunicorn app:app --log-file -`
2017-10-07T12:33:49.627779+00:00 app[web.1]: bash: gunicorn: command not found
2017-10-07T12:33:49.700534+00:00 heroku[web.1]: Process exited with status 127
2017-10-07T12:33:49.713288+00:00 heroku[web.1]: State changed from starting to crashed
Disconnected from log stream. There may be events happening that you do not see here! Attempting to reconnect...

我观察到,如果我部署应用程序而不包含这些Buildpacks我没有使用gunicorn的错误,但我的app需要dlib。

我的 requirements.txt文件:

gunicorn
click==6.7
cmake==0.7.1
colorthief==0.2.1
cycler==0.10.0
Flask==0.12.2
Flask-Gunicorn==0.1.1
imutils==0.4.3
itsdangerous==0.24
Jinja2==2.9.6
jsonify==0.5
MarkupSafe==1.0
matplotlib==2.0.2
numpy==1.13.0
olefile==0.44
opencv-python==3.2.0.7
Pillow==4.1.1
pymongo==3.4.0
pyparsing==2.2.0
python-dateutil==2.6.0
pytz==2017.2
six==1.10.0
Werkzeug==0.12.2

我的 runtime.txt

python-3.6.1

我的 Procfile

web: gunicorn app:app --log-file -

2 个答案:

答案 0 :(得分:0)

随着对Dlib的最新更新,将Dlib添加到您的buildpack不再是一个问题,因为Boost依赖项已被删除https://github.com/davisking/dlib/issues/293

答案 1 :(得分:0)

您需要cmake来安装dlib。要在heroku中安装cmake,您需要buildpack cmake并设置该内部版本以安装dlib。

您可以使用此buildpack进行cmake heroku-buildpack-cmake

在您的CLI中执行此操作

  1. 登录到heroku
  2. 复制粘贴heroku create --buildpack https://github.com/VovchikMonkey/heroku-buildpack-cmake.git
  3. 最后设置buildpack heroku buildpacks:set https://github.com/Starkast/heroku-buildpack-cmake
  4. 然后部署
    $ git add . $ git commit -am "make it better" $ git push heroku大师