Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Deploying this to a server (i.e. Heroku, etc) #3

Closed
supermagicpony opened this issue Mar 15, 2017 · 13 comments
Closed

Deploying this to a server (i.e. Heroku, etc) #3

supermagicpony opened this issue Mar 15, 2017 · 13 comments

Comments

@supermagicpony
Copy link

Any chance you could provide an example or some input on how to deploy this to Heroku or other similar services? Couldn't figure out how to get the original version using lua scripts to work on Heroku.

Some insight would be useful!

Thanks for all of this btw!

@ageitgey
Copy link
Owner

That's a good question. The only issue deploying it to Heroku or anothersimilar service would be getting dlib installed correctly. Everything else should just be pure Python.

To install dlib, you'd probably have to create a custom Heroku buildpack with dlib or create a docker image and use Heroku's new support for deploying docker images.

I haven't tried either way yet. But if I get some free time, I might play around with it.

@ageitgey
Copy link
Owner

I verified that you definitely need a custom buildpack for heroku to compile dlib:

$ git push heroku master
Counting objects: 5, done.
Delta compression using up to 8 threads.
Compressing objects: 100% (3/3), done.
Writing objects: 100% (5/5), 746 bytes | 0 bytes/s, done.
Total 5 (delta 0), reused 0 (delta 0)
remote: Compressing source files... done.
remote: Building source:
remote: 
remote: -----> Python app detected
remote: -----> Installing python-3.6.0
remote:      $ pip install -r requirements.txt
remote:        Collecting face_recognition (from -r /tmp/build_11f5ed1bd23fc8aa33cb9ea574c4a136/requirements.txt (line 1))
remote:          Downloading face_recognition-0.1.7-py2.py3-none-any.whl
remote:        Collecting flask (from -r /tmp/build_11f5ed1bd23fc8aa33cb9ea574c4a136/requirements.txt (line 2))
remote:          Downloading Flask-0.12-py2.py3-none-any.whl (82kB)
remote:        Collecting face-recognition-models (from face_recognition->-r /tmp/build_11f5ed1bd23fc8aa33cb9ea574c4a136/requirements.txt (line 1))
remote:          Downloading face_recognition_models-0.1.3-py2.py3-none-any.whl (93.3MB)
remote:        Collecting Click>=6.0 (from face_recognition->-r /tmp/build_11f5ed1bd23fc8aa33cb9ea574c4a136/requirements.txt (line 1))
remote:          Downloading click-6.7-py2.py3-none-any.whl (71kB)
remote:        Collecting dlib>=19.3.0 (from face_recognition->-r /tmp/build_11f5ed1bd23fc8aa33cb9ea574c4a136/requirements.txt (line 1))
remote:          Downloading dlib-19.4.0.tar.gz (4.0MB)
remote:        Collecting numpy (from face_recognition->-r /tmp/build_11f5ed1bd23fc8aa33cb9ea574c4a136/requirements.txt (line 1))
remote:          Downloading numpy-1.12.0-cp36-cp36m-manylinux1_x86_64.whl (16.8MB)
remote:        Collecting scipy (from face_recognition->-r /tmp/build_11f5ed1bd23fc8aa33cb9ea574c4a136/requirements.txt (line 1))
remote:          Downloading scipy-0.19.0-cp36-cp36m-manylinux1_x86_64.whl (48.2MB)
remote:        Collecting itsdangerous>=0.21 (from flask->-r /tmp/build_11f5ed1bd23fc8aa33cb9ea574c4a136/requirements.txt (line 2))
remote:          Downloading itsdangerous-0.24.tar.gz (46kB)
remote:        Collecting Jinja2>=2.4 (from flask->-r /tmp/build_11f5ed1bd23fc8aa33cb9ea574c4a136/requirements.txt (line 2))
remote:          Downloading Jinja2-2.9.5-py2.py3-none-any.whl (340kB)
remote:        Collecting Werkzeug>=0.7 (from flask->-r /tmp/build_11f5ed1bd23fc8aa33cb9ea574c4a136/requirements.txt (line 2))
remote:          Downloading Werkzeug-0.12.1-py2.py3-none-any.whl (312kB)
remote:        Collecting MarkupSafe>=0.23 (from Jinja2>=2.4->flask->-r /tmp/build_11f5ed1bd23fc8aa33cb9ea574c4a136/requirements.txt (line 2))
remote:          Downloading MarkupSafe-1.0.tar.gz
remote:        Installing collected packages: face-recognition-models, Click, dlib, numpy, scipy, face-recognition, itsdangerous, MarkupSafe, Jinja2, Werkzeug, flask
remote:          Running setup.py install for dlib: started
remote:            Running setup.py install for dlib: finished with status 'error'
remote:            Complete output from command /app/.heroku/python/bin/python -u -c "import setuptools, tokenize;__file__='/tmp/pip-build-kvzz342g/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-itgc_ao8-record/install-record.txt --single-version-externally-managed --compile:
remote:            running install
remote:            running build
remote:            error: Cannot find cmake, ensure it is installed and in the path.
remote:            You can install cmake on Ubuntu using `sudo apt-get install cmake`.
remote:            You can also specify its path with --cmake parameter.
remote:            
remote:            ----------------------------------------
remote:        Command "/app/.heroku/python/bin/python -u -c "import setuptools, tokenize;__file__='/tmp/pip-build-kvzz342g/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-itgc_ao8-record/install-record.txt --single-version-externally-managed --compile" failed with error code 1 in /tmp/pip-build-kvzz342g/dlib/
remote:  !     Push rejected, failed to compile Python app.
remote: 
remote:  !     Push failed
remote: Verifying deploy....
remote: 
remote: !	Push rejected to flaskfacerec.
remote: 
To https://git.heroku.com/flaskfacerec.git
 ! [remote rejected] master -> master (pre-receive hook declined)
error: failed to push some refs to 'https://git.heroku.com/flaskfacerec.git

@michael-learns
Copy link

Have you tried deploying to Google Cloud? @ageitgey

@ageitgey
Copy link
Owner

No, I haven't tried deploying it to Google Compute Engine yet. But there's no reason it shouldn't work with the proper setup. I just don't have a pre-made configuration to share because I haven't needed to do it yet.

Setting this up on a VM-based service like Amazon EC2 or Google Compute Engine should be pretty similar to setting it up on Linux locally. You can follow the normal installation directions.

@ageitgey
Copy link
Owner

I added an example Dockerfile to the repo that you can use to deploy an app built with face_recognition to any hosting service that supports Docker-based deployment.

By default, it just runs one of the examples:

$ cd face_recognition

$ docker build .
< wait a long time >

Successfully built 7283e496fd36

$ docker run 7283e496fd36
Is the unknown face a picture of Biden? False
Is the unknown face a picture of Obama? True
Is the unknown face a new person that we've never seen before? False

But you could copy the Dockerfile to your own app and tweak it so it runs your app (that depends on face_recognition) instead.

@Shraeyas
Copy link

requirements.txt
I deployed it to heroku with this requirements.txt file.

@quentindemetz
Copy link

simply including cmake in the requirements.txt fixed it for me

cmake
face_recognition

@nvinayvarma189
Copy link

Hey, I have been trying to deploy an app which uses face_recognition to Heroku and there is a problem with installing 'dlib'. The buildpack for it has become stale.

Here is the following errror:

Counting objects: 6, done.
Delta compression using up to 4 threads.
Compressing objects: 100% (6/6), done.
Writing objects: 100% (6/6), 704 bytes | 0 bytes/s, done.
Total 6 (delta 3), reused 0 (delta 0)
remote: Compressing source files... done.
remote: Building source:
remote: 
remote: -----> Python app detected
remote: -----> Installing requirements with pip
remote:        Collecting Django==2.1.1 (from -r /tmp/build_6d2057dd8ed43f6db2772ce68b91cc1d/requirements.txt (line 1))
remote:          Downloading https://files.pythonhosted.org/packages/ca/7e/fc068d164b32552ae3a8f8d5d0280c083f2e8d553e71ecacc21927564561/Django-2.1.1-py3-none-any.whl (7.3MB)
remote:        Collecting dj-database-url==0.3.0 (from -r /tmp/build_6d2057dd8ed43f6db2772ce68b91cc1d/requirements.txt (line 2))
remote:          Downloading https://files.pythonhosted.org/packages/ef/b6/9283fcf61ced22bf90e7b4a84ba5b53d126b2c9b0dc9b667347698097026/dj_database_url-0.3.0-py2.py3-none-any.whl
remote:        Collecting dj-static==0.0.6 (from -r /tmp/build_6d2057dd8ed43f6db2772ce68b91cc1d/requirements.txt (line 3))
remote:          Downloading https://files.pythonhosted.org/packages/2b/8f/77a4b8ec50c821193bf9682c7896f12fd0418eb3711a7d66796ede59c23b/dj-static-0.0.6.tar.gz
remote:        Collecting gunicorn==19.7.1 (from -r /tmp/build_6d2057dd8ed43f6db2772ce68b91cc1d/requirements.txt (line 4))
remote:          Downloading https://files.pythonhosted.org/packages/64/32/becbd4089a4c06f0f9f538a76e9fe0b19a08f010bcb47dcdbfbc640cdf7d/gunicorn-19.7.1-py2.py3-none-any.whl (111kB)
remote:        Collecting Unipath==1.0 (from -r /tmp/build_6d2057dd8ed43f6db2772ce68b91cc1d/requirements.txt (line 5))
remote:          Downloading https://files.pythonhosted.org/packages/5e/8e/7efe289440c9d3b3f2784516fef1362428d1c00d35ca31c39d7bee1412e8/Unipath-1.0.tar.gz
remote:        Collecting python-decouple==3 (from -r /tmp/build_6d2057dd8ed43f6db2772ce68b91cc1d/requirements.txt (line 6))
remote:          Downloading https://files.pythonhosted.org/packages/5f/fc/9f3ec3f7844f9045406562512dbb599e9576e0c2ce3192a5e4d459f66e99/python-decouple-3.0.tar.gz
remote:        Collecting click==6.7 (from -r /tmp/build_6d2057dd8ed43f6db2772ce68b91cc1d/requirements.txt (line 7))
remote:          Downloading https://files.pythonhosted.org/packages/34/c1/8806f99713ddb993c5366c362b2f908f18269f8d792aff1abfd700775a77/click-6.7-py2.py3-none-any.whl (71kB)
remote:        Collecting numpy==1.15.4 (from -r /tmp/build_6d2057dd8ed43f6db2772ce68b91cc1d/requirements.txt (line 8))
remote:          Downloading https://files.pythonhosted.org/packages/ff/7f/9d804d2348471c67a7d8b5f84f9bc59fd1cefa148986f2b74552f8573555/numpy-1.15.4-cp36-cp36m-manylinux1_x86_64.whl (13.9MB)
remote:        Collecting Pillow==5.2.0 (from -r /tmp/build_6d2057dd8ed43f6db2772ce68b91cc1d/requirements.txt (line 9))
remote:          Downloading https://files.pythonhosted.org/packages/d1/24/f53ff6b61b3d728b90934bddb4f03f8ab584a7f49299bf3bde56e2952612/Pillow-5.2.0-cp36-cp36m-manylinux1_x86_64.whl (2.0MB)
remote:        Collecting face-recognition-models==0.3.0 (from -r /tmp/build_6d2057dd8ed43f6db2772ce68b91cc1d/requirements.txt (line 10))
remote:          Downloading https://files.pythonhosted.org/packages/cf/3b/4fd8c534f6c0d1b80ce0973d01331525538045084c73c153ee6df20224cf/face_recognition_models-0.3.0.tar.gz (100.1MB)
remote:        Collecting cmake (from -r /tmp/build_6d2057dd8ed43f6db2772ce68b91cc1d/requirements.txt (line 11))
remote:          Downloading https://files.pythonhosted.org/packages/45/c4/e69313ade2a3e992e7178744b0e56bdd8f23e79e15066a68cf490504beed/cmake-3.13.3-cp36-cp36m-manylinux1_x86_64.whl (15.9MB)
remote:        Collecting Werkzeug==0.14.1 (from -r /tmp/build_6d2057dd8ed43f6db2772ce68b91cc1d/requirements.txt (line 12))
remote:          Downloading https://files.pythonhosted.org/packages/20/c4/12e3e56473e52375aa29c4764e70d1b8f3efa6682bef8d0aae04fe335243/Werkzeug-0.14.1-py2.py3-none-any.whl (322kB)
remote:        Collecting face-recognition==1.2.3 (from -r /tmp/build_6d2057dd8ed43f6db2772ce68b91cc1d/requirements.txt (line 13))
remote:          Downloading https://files.pythonhosted.org/packages/3f/ed/ad9a28042f373d4633fc8b49109b623597d6f193d3bbbef7780a5ee8eef2/face_recognition-1.2.3-py2.py3-none-any.whl
remote:        Collecting boost==0.1 (from -r /tmp/build_6d2057dd8ed43f6db2772ce68b91cc1d/requirements.txt (line 14))
remote:          Downloading https://files.pythonhosted.org/packages/cd/e9/fd77f318eba4976c9ed9df341c13daebe69cace8723dbd0f3d39a0dddb08/boost-0.1.tar.gz
remote:        Collecting boost-py (from -r /tmp/build_6d2057dd8ed43f6db2772ce68b91cc1d/requirements.txt (line 15))
remote:          Downloading https://files.pythonhosted.org/packages/f7/be/28a09dacd0770d281bd3798f148dc431503b726b7219cec1fdb6faca46e6/boost_py-0.0.2-py3-none-any.whl
remote:        Collecting dlib==19.4.0 (from -r /tmp/build_6d2057dd8ed43f6db2772ce68b91cc1d/requirements.txt (line 16))
remote:          Downloading https://files.pythonhosted.org/packages/1d/76/0f91fde37a83a40cf27e6cabd900b975c2667c522a07ae38e31cda2fa486/dlib-19.4.0.tar.gz (4.0MB)
remote:        Collecting psycopg2==2.7.5 (from -r /tmp/build_6d2057dd8ed43f6db2772ce68b91cc1d/requirements.txt (line 17))
remote:          Downloading https://files.pythonhosted.org/packages/5e/d0/9e2b3ed43001ebed45caf56d5bb9d44ed3ebd68e12b87845bfa7bcd46250/psycopg2-2.7.5-cp36-cp36m-manylinux1_x86_64.whl (2.7MB)
remote:        Collecting whitenoise==3.2 (from -r /tmp/build_6d2057dd8ed43f6db2772ce68b91cc1d/requirements.txt (line 18))
remote:          Downloading https://files.pythonhosted.org/packages/ed/7b/2d8276a56b6ebb7c0b8652a31e535df67f0e4152037b33ce036e79146ac3/whitenoise-3.2-py2.py3-none-any.whl
remote:        Collecting jsonschema==2.6.0 (from -r /tmp/build_6d2057dd8ed43f6db2772ce68b91cc1d/requirements.txt (line 19))
remote:          Downloading https://files.pythonhosted.org/packages/77/de/47e35a97b2b05c2fadbec67d44cfcdcd09b8086951b331d82de90d2912da/jsonschema-2.6.0-py2.py3-none-any.whl
remote:        Installing collected packages: Django, dj-database-url, dj-static, gunicorn, Unipath, python-decouple, click, numpy, Pillow, face-recognition-models, cmake, Werkzeug, dlib, face-recognition, boost, boost-py, psycopg2, whitenoise, jsonschema
remote:          Running setup.py install for dj-static: started
remote:            Running setup.py install for dj-static: finished with status 'done'
remote:          Running setup.py install for Unipath: started
remote:            Running setup.py install for Unipath: finished with status 'done'
remote:          Running setup.py install for python-decouple: started
remote:            Running setup.py install for python-decouple: finished with status 'done'
remote:          Running setup.py install for face-recognition-models: started
remote:            Running setup.py install for face-recognition-models: finished with status 'done'
remote:          Running setup.py install for dlib: started
remote:            Running setup.py install for dlib: finished with status 'error'
remote:            Complete output from command /app/.heroku/python/bin/python -u -c "import setuptools, tokenize;__file__='/tmp/pip-build-otsn5okf/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-diaey5c7-record/install-record.txt --single-version-externally-managed --compile:
remote:            running install
remote:            running build
remote:            Detected Python architecture: 64bit
remote:            Detected platform: linux
remote:            Configuring cmake ...
remote:            -- The C compiler identification is GNU 7.3.0
remote:            -- The CXX compiler identification is GNU 7.3.0
remote:            -- Check for working C compiler: /usr/bin/cc
remote:            -- Check for working C compiler: /usr/bin/cc -- works
remote:            -- Detecting C compiler ABI info
remote:            -- Detecting C compiler ABI info - done
remote:            -- Detecting C compile features
remote:            -- Detecting C compile features - done
remote:            -- Check for working CXX compiler: /usr/bin/c++
remote:            -- Check for working CXX compiler: /usr/bin/c++ -- works
remote:            -- Detecting CXX compiler ABI info
remote:            -- Detecting CXX compiler ABI info - done
remote:            -- Detecting CXX compile features
remote:            -- Detecting CXX compile features - done
remote:            CMake Warning at /tmp/build_6d2057dd8ed43f6db2772ce68b91cc1d/.heroku/python/lib/python3.6/site-packages/cmake/data/share/cmake-3.13/Modules/FindBoost.cmake:1775 (message):
remote:              No header defined for python-py34; skipping header check
remote:            Call Stack (most recent call first):
remote:              /tmp/pip-build-otsn5okf/dlib/dlib/cmake_utils/add_python_module:61 (FIND_PACKAGE)
remote:              CMakeLists.txt:6 (include)
remote:            -- Could NOT find Boost
remote:            CMake Warning at /tmp/build_6d2057dd8ed43f6db2772ce68b91cc1d/.heroku/python/lib/python3.6/site-packages/cmake/data/share/cmake-3.13/Modules/FindBoost.cmake:1775 (message):
remote:              No header defined for python-py35; skipping header check
remote:            Call Stack (most recent call first):
remote:              /tmp/pip-build-otsn5okf/dlib/dlib/cmake_utils/add_python_module:63 (FIND_PACKAGE)
remote:              CMakeLists.txt:6 (include)
remote:            -- Could NOT find Boost
remote:            -- Could NOT find Boost
remote:            -- Could NOT find Boost
remote:            -- Found PythonLibs: /tmp/build_6d2057dd8ed43f6db2772ce68b91cc1d/.heroku/python/lib/libpython3.6m.a (found suitable version "3.6.8", minimum required is "3.4")
remote:            --  *****************************************************************************************************
remote:            --  To compile Boost.Python yourself download boost from boost.org and then go into the boost root folder
remote:            --  and run these commands:
remote:            --     ./bootstrap.sh --with-libraries=python
remote:            --     ./b2
remote:            --     sudo ./b2 install
remote:            --  *****************************************************************************************************
remote:            CMake Error at /tmp/pip-build-otsn5okf/dlib/dlib/cmake_utils/add_python_module:116 (message):
remote:               Boost python library not found.
remote:            Call Stack (most recent call first):
remote:              CMakeLists.txt:6 (include)
remote:            -- Configuring incomplete, errors occurred!
remote:            See also "/tmp/pip-build-otsn5okf/dlib/tools/python/build/CMakeFiles/CMakeOutput.log".
remote:            error: cmake configuration failed!
remote:            
remote:            ----------------------------------------
remote:        Command "/app/.heroku/python/bin/python -u -c "import setuptools, tokenize;__file__='/tmp/pip-build-otsn5okf/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-diaey5c7-record/install-record.txt --single-version-externally-managed --compile" failed with error code 1 in /tmp/pip-build-otsn5okf/dlib/
remote:  !     Push rejected, failed to compile Python app.
remote: 
remote:  !     Push failed
remote: Verifying deploy...
remote: 
remote: !	Push rejected to poor-man-facesimilarity.
remote: 
To https://git.heroku.com/poor-man-facesimilarity.git
 ! [remote rejected] master -> master (pre-receive hook declined)
error: failed to push some refs to 'https://git.heroku.com/poor-man-facesimilarity.git'

Here is the requirements.txt file I'm using:

Django==2.1.1
dj-database-url==0.3.0
dj-static==0.0.6
gunicorn==19.7.1
Unipath==1.0
python-decouple==3
click==6.7
numpy==1.15.4
Pillow==5.2.0
face-recognition-models==0.3.0
cmake
Werkzeug==0.14.1
face-recognition==1.2.3
boost==0.1
boost-py
dlib==19.4.0
psycopg2==2.7.5
whitenoise==3.2
jsonschema==2.6.0

I have tried both @Shraeyas and @quentindemetz suggestions but neither of them work for me. If anyone found a way around this, please help. Thanks in advance.

@ahmedbr
Copy link

ahmedbr commented Mar 18, 2019

simply including cmake in the requirements.txt fixed it for me

cmake
face_recognition

I did the same and it installed the cmake but then showed me an error like this:

Counting objects: 17, done.
Delta compression using up to 8 threads.
Compressing objects: 100% (16/16), done.
Writing objects: 100% (17/17), 9.37 KiB | 1.87 MiB/s, done.
Total 17 (delta 9), reused 0 (delta 0)
remote: Compressing source files... done.
remote: Building source:
remote:
remote: -----> Python app detected
remote: -----> Installing python-3.6.8
remote: -----> Installing pip
remote: -----> Installing SQLite3
remote: -----> Installing requirements with pip
remote:        Collecting dlib==19.8.1 (from -r /tmp/build_fabb31cf73bf0befa42fb92628bf5fa4/requirements.txt (line 1))
remote:          Downloading https://files.pythonhosted.org/packages/eb/99/6e2334b09bf48493b243a0fcb60a60659c847f86cecc1c2a7839609f88eb/dlib-19.8.1.tar.gz (2.7MB)
remote:        Collecting face_recognition==1.2.2 (from -r /tmp/build_fabb31cf73bf0befa42fb92628bf5fa4/requirements.txt (line 2))
remote:          Downloading https://files.pythonhosted.org/packages/28/10/f153bbbc218fc169768aa1c02f2e9178e9241e4af8da56289bdca2c0c217/face_recognition-1.2.2-py2.py3-none-any.whl
remote:        Collecting pillow (from -r /tmp/build_fabb31cf73bf0befa42fb92628bf5fa4/requirements.txt (line 3))
remote:          Downloading https://files.pythonhosted.org/packages/85/5e/e91792f198bbc5a0d7d3055ad552bc4062942d27eaf75c3e2783cf64eae5/Pillow-5.4.1-cp36-cp36m-manylinux1_x86_64.whl (2.0MB)
remote:        Collecting Click>=6.0 (from face_recognition==1.2.2->-r /tmp/build_fabb31cf73bf0befa42fb92628bf5fa4/requirements.txt (line 2))
remote:          Downloading https://files.pythonhosted.org/packages/fa/37/45185cb5abbc30d7257104c434fe0b07e5a195a6847506c074527aa599ec/Click-7.0-py2.py3-none-any.whl (81kB)
remote:        Collecting numpy (from face_recognition==1.2.2->-r /tmp/build_fabb31cf73bf0befa42fb92628bf5fa4/requirements.txt (line 2))
remote:          Downloading https://files.pythonhosted.org/packages/35/d5/4f8410ac303e690144f0a0603c4b8fd3b986feb2749c435f7cdbb288f17e/numpy-1.16.2-cp36-cp36m-manylinux1_x86_64.whl (17.3MB)
remote:        Collecting face-recognition-models>=0.3.0 (from face_recognition==1.2.2->-r /tmp/build_fabb31cf73bf0befa42fb92628bf5fa4/requirements.txt (line 2))
remote:          Downloading https://files.pythonhosted.org/packages/cf/3b/4fd8c534f6c0d1b80ce0973d01331525538045084c73c153ee6df20224cf/face_recognition_models-0.3.0.tar.gz (100.1MB)
remote:        Installing collected packages: dlib, Click, numpy, face-recognition-models, pillow, face-recognition
remote:          Running setup.py install for dlib: started
remote:            Running setup.py install for dlib: finished with status 'error'
remote:            Complete output from command /app/.heroku/python/bin/python -u -c "import setuptools, tokenize;__file__='/tmp/pip-build-4apr9p2v/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-07wjige_-record/install-record.txt --single-version-externally-managed --compile:
remote:
remote:            Warning: Functions that return numpy arrays need Numpy (>= v1.5.1) installed!
remote:            You can install numpy and then run this setup again:
remote:            $ pip install numpy
remote:
remote:            running install
remote:            running build
remote:            error: Cannot find cmake, ensure it is installed and in the path.
remote:            You can install cmake on Ubuntu using `sudo apt-get install cmake`.
remote:            You can also specify its path with --cmake parameter.
remote:
remote:            ----------------------------------------
remote:        Command "/app/.heroku/python/bin/python -u -c "import setuptools, tokenize;__file__='/tmp/pip-build-4apr9p2v/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-07wjige_-record/install-record.txt --single-version-externally-managed --compile" failed with error code 1 in /tmp/pip-build-4apr9p2v/dlib/
remote:  !     Push rejected, failed to compile Python app.
remote:
remote:  !     Push failed
remote: Verifying deploy...
remote:
remote: !       Push rejected to shrouded-scrubland-45605.
remote:
To https://git.heroku.com/shrouded-scrubland-45605.git
 ! [remote rejected] master -> master (pre-receive hook declined)
error: failed to push some refs to 'https://git.heroku.com/shrouded-scrubland-45605.git'

Have you faced such an error, and if yes how did you solve it?

@hpaliwal4
Copy link

If you order packages in requirements file in this order, it'll work.
cmake
dlib
face_recognition

@hayarafee
Copy link

If you order packages in requirements file in this order, it'll work.
cmake
dlib
face_recognition
i did the same but it still give me error below:
-----> Python app detected
-----> Installing python-3.6.8
-----> Installing pip
-----> Installing SQLite3
-----> Installing requirements with pip
Collecting cmake (from -r /tmp/build_e22a892f7f0d68472f35dd29e8ad7a79/requirements.txt (line 1))
Downloading https://files.pythonhosted.org/packages/45/c4/e69313ade2a3e992e7178744b0e56bdd8f23e79e15066a68cf490504beed/cmake-3.13.3-cp36-cp36m-manylinux1_x86_64.whl (15.9MB)
Collecting dlib==19.8.1 (from -r /tmp/build_e22a892f7f0d68472f35dd29e8ad7a79/requirements.txt (line 2))
Downloading https://files.pythonhosted.org/packages/eb/99/6e2334b09bf48493b243a0fcb60a60659c847f86cecc1c2a7839609f88eb/dlib-19.8.1.tar.gz (2.7MB)
Collecting face_recognition==1.2.2 (from -r /tmp/build_e22a892f7f0d68472f35dd29e8ad7a79/requirements.txt (line 3))
Downloading https://files.pythonhosted.org/packages/28/10/f153bbbc218fc169768aa1c02f2e9178e9241e4af8da56289bdca2c0c217/face_recognition-1.2.2-py2.py3-none-any.whl
Collecting pillow (from -r /tmp/build_e22a892f7f0d68472f35dd29e8ad7a79/requirements.txt (line 4))
Downloading https://files.pythonhosted.org/packages/d2/c2/f84b1e57416755e967236468dcfb0fad7fd911f707185efc4ba8834a1a94/Pillow-6.0.0-cp36-cp36m-manylinux1_x86_64.whl (2.0MB)
Collecting numpy (from face_recognition==1.2.2->-r /tmp/build_e22a892f7f0d68472f35dd29e8ad7a79/requirements.txt (line 3))
Downloading https://files.pythonhosted.org/packages/c1/e2/4db8df8f6cddc98e7d7c537245ef2f4e41a1ed17bf0c3177ab3cc6beac7f/numpy-1.16.3-cp36-cp36m-manylinux1_x86_64.whl (17.3MB)
Collecting Click>=6.0 (from face_recognition==1.2.2->-r /tmp/build_e22a892f7f0d68472f35dd29e8ad7a79/requirements.txt (line 3))
Downloading https://files.pythonhosted.org/packages/fa/37/45185cb5abbc30d7257104c434fe0b07e5a195a6847506c074527aa599ec/Click-7.0-py2.py3-none-any.whl (81kB)
Collecting face-recognition-models>=0.3.0 (from face_recognition==1.2.2->-r /tmp/build_e22a892f7f0d68472f35dd29e8ad7a79/requirements.txt (line 3))
Downloading https://files.pythonhosted.org/packages/cf/3b/4fd8c534f6c0d1b80ce0973d01331525538045084c73c153ee6df20224cf/face_recognition_models-0.3.0.tar.gz (100.1MB)
Installing collected packages: cmake, dlib, numpy, Click, pillow, face-recognition-models, face-recognition
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-e39crpbn/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-ve4titj9-record/install-record.txt --single-version-externally-managed --compile:

       Warning: Functions that return numpy arrays need Numpy (>= v1.5.1) installed!
       You can install numpy and then run this setup again:
       $ pip install numpy
       
       running install
       running build
       Detected Python architecture: 64bit
       Detected platform: linux
       Configuring cmake ...
       -- The C compiler identification is GNU 7.3.0
       -- The CXX compiler identification is GNU 7.3.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_e22a892f7f0d68472f35dd29e8ad7a79/.heroku/python/lib/python3.6/site-packages/cmake/data/share/cmake-3.13/Modules/FindBoost.cmake:1775 (message):
         No header defined for python-py34; skipping header check
       Call Stack (most recent call first):
         /tmp/pip-build-e39crpbn/dlib/dlib/cmake_utils/add_python_module:66 (FIND_PACKAGE)
         CMakeLists.txt:9 (include)
       -- Could NOT find Boost
       CMake Warning at /tmp/build_e22a892f7f0d68472f35dd29e8ad7a79/.heroku/python/lib/python3.6/site-packages/cmake/data/share/cmake-3.13/Modules/FindBoost.cmake:1775 (message):
         No header defined for python-py35; skipping header check
       Call Stack (most recent call first):
         /tmp/pip-build-e39crpbn/dlib/dlib/cmake_utils/add_python_module:68 (FIND_PACKAGE)
         CMakeLists.txt:9 (include)
       -- Could NOT find Boost
       -- Could NOT find Boost
       -- Could NOT find Boost
       -- Found PythonLibs: /tmp/build_e22a892f7f0d68472f35dd29e8ad7a79/.heroku/python/lib/libpython3.6m.a (found suitable version "3.6.8", minimum required is "3.4")
       -- Enabling SSE4 instructions
       -- Looking for pthread.h
       -- Looking for pthread.h - found
       -- Looking for pthread_create
       -- Looking for pthread_create - not found
       -- Looking for pthread_create in pthreads
       -- Looking for pthread_create in pthreads - not found
       -- Looking for pthread_create in pthread
       -- Looking for pthread_create in pthread - found
       -- Found Threads: TRUE
       -- Looking for XOpenDisplay in /usr/lib/x86_64-linux-gnu/libX11.so;/usr/lib/x86_64-linux-gnu/libXext.so
       -- Looking for XOpenDisplay in /usr/lib/x86_64-linux-gnu/libX11.so;/usr/lib/x86_64-linux-gnu/libXext.so - found
       -- Looking for gethostbyname
       -- Looking for gethostbyname - found
       -- Looking for connect
       -- Looking for connect - found
       -- Looking for remove
       -- Looking for remove - found
       -- Looking for shmat
       -- Looking for shmat - found
       -- Looking for IceConnectionNumber in ICE
       -- Looking for IceConnectionNumber in ICE - found
       -- Found X11: /usr/lib/x86_64-linux-gnu/libX11.so
       -- Looking for png_create_read_struct
       -- Looking for png_create_read_struct - found
       -- Looking for jpeg_read_header
       -- Looking for jpeg_read_header - found
       -- Searching for BLAS and LAPACK
       -- Searching for BLAS and LAPACK
       -- Found PkgConfig: /usr/bin/pkg-config (found version "0.29.1")
       -- Checking for module 'cblas'
       --   No package 'cblas' found
       -- Checking for module 'lapack'
       --   No package 'lapack' found
       -- Looking for sys/types.h
       CMake Warning (dev) at /tmp/build_e22a892f7f0d68472f35dd29e8ad7a79/.heroku/python/lib/python3.6/site-packages/cmake/data/share/cmake-3.13/Modules/CheckIncludeFile.cmake:70 (message):
         Policy CMP0075 is not set: Include file check macros honor
         CMAKE_REQUIRED_LIBRARIES.  Run "cmake --help-policy CMP0075" for policy
         details.  Use the cmake_policy command to set the policy and suppress this
         warning.
         CMAKE_REQUIRED_LIBRARIES is set to:
           /usr/lib/x86_64-linux-gnu/libjpeg.so
         For compatibility with CMake 3.11 and below this check is ignoring it.
       Call Stack (most recent call first):
         /tmp/build_e22a892f7f0d68472f35dd29e8ad7a79/.heroku/python/lib/python3.6/site-packages/cmake/data/share/cmake-3.13/Modules/CheckTypeSize.cmake:225 (check_include_file)
         /tmp/pip-build-e39crpbn/dlib/dlib/cmake_utils/cmake_find_blas.txt:69 (check_type_size)
         /tmp/pip-build-e39crpbn/dlib/dlib/CMakeLists.txt:492 (include)
       This warning is for project developers.  Use -Wno-dev to suppress it.
       -- Looking for sys/types.h - found
       -- Looking for stdint.h
       -- Looking for stdint.h - found
       -- Looking for stddef.h
       -- Looking for stddef.h - found
       -- Check size of void*
       -- Check size of void* - done
       -- Could NOT find BLAS (missing: BLAS_LIBRARIES)
       -- LAPACK requires BLAS
        *****************************************************************************
        *** No BLAS library found so using dlib's built in BLAS.  However, if you ***
        *** install an optimized BLAS such as OpenBLAS or the Intel MKL your code ***
        *** will run faster.  On Ubuntu you can install OpenBLAS by executing:    ***
        ***    sudo apt-get install libopenblas-dev liblapack-dev                 ***
        *** Or you can easily install OpenBLAS from source by downloading the     ***
        *** source tar file from http://www.openblas.net, extracting it, and      ***
        *** running:                                                              ***
        ***    make; sudo make install                                            ***
        *****************************************************************************
       CUDA_TOOLKIT_ROOT_DIR not found or specified
       -- Could NOT find CUDA (missing: CUDA_TOOLKIT_ROOT_DIR CUDA_NVCC_EXECUTABLE CUDA_INCLUDE_DIRS CUDA_CUDART_LIBRARY) (Required is at least version "7.5")
       -- Disabling CUDA support for dlib.  DLIB WILL NOT USE CUDA
       -- C++11 activated.
       --  *****************************************************************************************************
       --  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-e39crpbn/dlib/dlib/cmake_utils/add_python_module:149 (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-e39crpbn/dlib/tools/python/build/CMakeFiles/CMakeOutput.log".
       See also "/tmp/pip-build-e39crpbn/dlib/tools/python/build/CMakeFiles/CMakeError.log".
       error: cmake configuration failed!
       
       ----------------------------------------
   Command "/app/.heroku/python/bin/python -u -c "import setuptools, tokenize;__file__='/tmp/pip-build-e39crpbn/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-ve4titj9-record/install-record.txt --single-version-externally-managed --compile" failed with error code 1 in /tmp/pip-build-e39crpbn/dlib/

! Push rejected, failed to compile Python app.
! Push failed

@mvdream
Copy link

mvdream commented Sep 11, 2019

use heroku bash for install new package
heroku run bash

now follow same process you have done in your laptop. It will open cmd for you

Enjoy....!!

@ageitgey
Copy link
Owner

@mvdream When you run bash on Heroku, it boots up a new virtual machine instance and it doesn't save changes you make to it after you exit it. If you install this way, all your changes will be instantly lost and are never visible to a running web server.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

10 participants