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

标签 python opencv heroku boost dlib

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

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

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

我尝试通过在我的 requirements.txt 中指定 dlib==19.4.0 及其依赖项来不使用 Buildpack,但由于对 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

所以我在我的 requirements.txt 文件中包含了 boost==0.1, cmake==0.7.1 & 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

然后当我打开该应用程序时,我收到带有日志的应用程序错误

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...

我观察到,如果我在不包含这些 Buildpack 的情况下部署应用程序,我在使用 gunicorn 时不会出错,但我的应用程序需要 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

我的个人资料

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

最佳答案

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

关于python - 如何使用 requirements.txt 在 Heroku python 网络应用程序中安装 Dlib?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/46622227/

相关文章:

ruby-on-rails - Rake 中止,尝试加载 gem 'uglifier' 时出错

git - 当我推送到heroku时,Active Admin在本地工作,但不在heroku上工作

opencv - 在 Ubuntu 上卸载 OpenCV

C++动态 vector 创建

python - 如何将 OpenCV 图像数据从 Python 转换为 C++?

git - 在 heroku 上引入经过身份验证的 git repos

python - 在 html Flask 中迭代嵌套字典时出现 jinja2.exceptions.UndefinedError

python - python 中的 Fredo 和数组更新

python - 是否可以使用pytesseract从图像的特定部分提取文本

python - 阶乘运行时间