ageitgey / face_recognition

The world's simplest facial recognition api for Python and the command line
MIT License
53.16k stars 13.47k forks source link

Windows Installation Guide #175

Closed masoudr closed 7 years ago

masoudr commented 7 years ago

Hi, I've successfully installed and tested this tool on my Windows 10 machine, and I'm writing a simple procedure to install it. It may be useful for some people to try to use this tool on a Windows machine.

IMPORTANT: Actually, this project has been done for Linux systems, especially dlib. In my tests, the performance of this tool in Windows 10 was about a quarter compared to Ubuntu, built with the same specs. But I haven't seen any difference between these two in other subjects.

Read First: The new version of dlib doesn't need Boost anymore, so you can skip it. Remember that you still need to meet the following requirements. Requirments: (I've used this tutorial with these tools installed on Windows 10, but the newer versions may work too.)

  1. Microsoft Visual Studio 2015 (or newer) with C/C++ Compiler installed. (Visual C++ 2015 Build Tools didn't work for me, and I got into problems in compiling dlib)
  2. Of course Python3 (I used Python3.5 x64 but the other versions may work too)
  3. CMake for windows and add it to your system environment variables.
  4. (ONLY FOR older versions of dlib) Boost library version 1.63 or newer. Also, you can use precompiled binaries for specific MSVC you have, but I don't suggest. (I've included the compiling procedure of Boost in this tutorial)

Installation: Easy installation: Just install dlib and face_recognition (not always on the newest version): pip install dlib and then pip install face_recognition.

Manual installation:

  1. Download and install scipy and numpy+mkl (must be mkl version) packages from this link (all credits goes to Christoph Gohlke). Remember to grab the correct version based on your current Python version.
  2. Download Boost library source code or binary release for your current MSVC from this link.
  3. If you downloaded the binary version skip to step 4 else, follow these steps to compile and build Boost by yourself: 3-1. Extract the Boost source files into C:\local\boost_1_XX_X (X means the current version of Boost you have) 3-2. Create a system variable with these parameters: Name: VS140COMNTOOLS Value: C:\Program Files (x86)\Microsoft Visual Studio 14.0\Common7\Tools\ (or any path where you have installed MSVC) 3-3. Open Developer Command Prompt for Visual Studio and go to the current directory of Boost extracted and try these commands to compile Boost: bootstrap b2 -a --with-python address-model=64 toolset=msvc runtime-link=static 3-4. If you successfully compile Boost, it should create compiled files in stage directory.
  4. (If you have already compiled Boost skip this step) If you already download the binary release, extract the contents to C:\local\boost_1_XX_X
  5. Grab the latest version of dlib from this repo and extract it.
  6. Go to dlibdirectory and open cmd and follow these commands to build dlib: (remember to replace XX with the current version of Boost you have) set BOOST_ROOT=C:\local\boost_X_XX_X set BOOST_LIBRARYDIR=C:\local\boost_X_XX_X\stage\lib python setup.py install --yes USE_AVX_INSTRUCTIONS or python setup.py install --yes USE_AVX_INSTRUCTIONS --yes DLIB_USE_CUDA
  7. Now, you can use import dlib without any problem in your python script.
  8. You can also check the current version of dlib with pip show dlib.
  9. Now, install face_recognition with pip install face_recognition.
  10. Enjoy!

Finally, I need to say thanks to @ageitgey and @davisking for their awesome work.

TheDogeOfTheInternet commented 7 years ago

You don't need to manually install dlib. I was able to install it with pip (through the pip install face_recognition command) after I had Boost and CMake installed.

Which leads me to my second point; your tutorial does not mention CMake at all. I have no idea what CMake actually does, so it may not be required, but if it does have something to do with simplifying the install process, you should add it to your tutorial.

masoudr commented 7 years ago

@TheDogeOfTheInternet yes you are right the CMake is a must and I forgot to add it but it is just used to compile dliband Boost. I've edited my post and add it thanks. And for your first question yes you can use pipto install it but the latest versions are always on his Github repository and website so you need to compile it by yourself. Also, you can configure your compilation.

ageitgey commented 7 years ago

Thanks @masoudr! I'll link it from the README.

ageitgey commented 7 years ago

Done! https://github.com/ageitgey/face_recognition/blob/master/README.md#installation

Thanks again!

PBShortStop commented 7 years ago

hello @masoudr, i want to know CMake install procedure. Thanks.

masoudr commented 7 years ago

@PBShortStop Installation of CMake in windows is very simple just grab the installation file (*.msi) from this link and install it. Remember to check the "Add CMake to system path" during the installation. Then you can simply use cmake --version in command prompt.

BachDoXuan commented 7 years ago

Dear all, I've tried several times to build dlib, but waited more than 1 hour at face_recognition.cpp without seeing any progress. I redo it several times but still get stuck there. Can you help me with it?

runt1m33rr0r commented 7 years ago

@BachDoXuan you need to use the visual studio 2015 compiler(msvc-14.0), 14.1 is bugged. You also need at least 2GB RAM, because face_recognition.cpp takes a lot of memory during compilation(which could be the reason it takes so long).

BachDoXuan commented 7 years ago

I use VS CE 2017, 8GB RAM laptop. I use Windows 10 Pro but the windows is not activated. I have no idea what problem I have. Can you help me to install dlib?

masoudr commented 7 years ago

@BachDoXuan I used MSVC-14 and haven't tested the 2017 version. Are you using the precompiled version of Boost or compiling it by yourself? Remember that some of the steps in this tutorial are for MSVC-14 and if you want to use with other versions you need to modify them. Could you provide the error log?

BachDoXuan commented 7 years ago

@masoudr @neutrinobomber Thank you very much for your helps. The screen doesn't have any error log. It just got stuck when building dlib at face_recognition.cpp, I waited for more than hour every time I got there. But currently when I use command "pip install face_recognition" directly, then it succeeds.

masoudr commented 7 years ago

@BachDoXuan You are right, you can always use pip to install this package without any further work on windows. This tutorial is for the people who wanted to build dlib from source or do some configurations to it.

davisking commented 7 years ago

This is a known problem. Visual Studio 2017 is buggy and has worse support for C++11 than Visual Studio 2015. No one has been able to find a workaround other than to use Visual Studio 2015.

loqpa commented 7 years ago

Hey! I have a problem while following this tutorial. My versions are: Python 3.5.4 dlib 19.7 boost 1.65.1 (using "with cuda" and "with avx" options)

jpeg.lib(jdatadst.c.obj) : error LNK2019: unresolved external symbol imp_ferror referenced in function termdestination [C:\Users\Loqpa\Downloads\dlib-master\dlib-master\tools\python\build\dlib.vcxproj] jpeg.lib(jmemmgr.c.obj) : error LNK2019: unresolved external symbol _impstdio_common_vsscanf referenced in function _vsscanfl [C:\Users\Loqpa\Downloads\dlib-master\dlib-master\tools\python\build\dlib.vcxproj] jpeg.lib(jmemansi.c.obj) : error LNK2019: unresolved external symbol __imp_tmpfile referenced in function jpeg_open_backingstore [C:\Users\Loqpa\Downloads\dlib-master\dlib-master\tools\python\build\dlib.vcxproj] C:\Users\Loqpa\Downloads\dlib-master\dlib-master\tools\python\build\Release\dlib.pyd : fatal error LNK1120: 3 unresolved externals [C:\Users\Loqpa\Downloads\dlib-master\dlib-master\tools\python\build\dlib_.vcxproj]

Any ideas how to fix it? I am up to trying everything you suggest:)

masoudr commented 7 years ago

@loqpa Hi, Are you using a precompiled version of boost with MSVC14? Try to add these system environment variables too: VS110COMNTOOLS C:\Program Files (x86)\Microsoft Visual Studio 11.0\Common7\Tools\ VS120COMNTOOLS C:\Program Files (x86)\Microsoft Visual Studio 12.0\Common7\Tools\ VS110COMNTOOLS C:\Program Files (x86)\Microsoft Visual Studio 11.0\Common7\Tools\ VSSDK140Install C:\Program Files (x86)\Microsoft Visual Studio 14.0\VSSDK\ I don't know the exact cause of your problem but it seems that some of the library files are not recognized by dlib.

loqpa commented 7 years ago

@masoudr Hello! I am compiling boost by myself (following steps 3-1... 3-4) and my system environment variables were already set the way you suggested. Tried with boost 1.63, got the same error. Any other ideas? By the way, i am using Anaconda python, in case it matters.

masoudr commented 7 years ago

@loqpa I used this method for the specified version of dependencies, so I am not sure if they work for other versions too. As I know your problem is causing by missing some dll files on dlib's compile. I think you can try first submit your issue on dlib repository here, maybe @davisking have an answer to it and second use the exact procedure I mentioned here. I don't' know much about Anaconda try to exclude it.

Klinsman21 commented 7 years ago

Does anyone have the link to download, Microsoft Visual Studio 2015 with C / C ++ Compiler

masoudr commented 7 years ago

@Klinsman21 google is your friend :) try this.

loqpa commented 7 years ago

@masoudr what dlib version did you use? I can use precompiled version 19.4 without any problems but i am really curious about new(19.5+) cnn face_detector :)

masoudr commented 7 years ago

@loqpa If you compile dlib from the source you can always use the latest features and besides of that you can customize the compilation for specific configuration like disable/enable AVX instruction, CUDA feature, etc. I used v19.6 but newer versions would work too. You can find new features on dlib's website in here.

cmlyldz commented 7 years ago

Can anybody help me ? VC 2015 boost 1_65_1 dlib 19.7

libboost_python3-vc140-mt-s-1_651.lib(errors.obj) : fatal error LNK1112: module machine type 'x64' conflicts with target machine type 'X86' [D:\DEV\dlib-master\tools\python\build\dlib.vcxproj] 1 Warning(s) 1 Error(s) Time Elapsed 00:04:35.66 error: cmake build failed!

masoudr commented 7 years ago

@cmlyldz You are trying to compile an X86 code on X64 compiler or vice-versa. Try to use VS2015 x86 Native Tools Command Prompt to compile dlib and remember that your python architecture must be same.

cmlyldz commented 7 years ago

@masoudr Thanks for answer. The problem was my python but there is no problem thanks to you.

hepingtao commented 7 years ago

@masoudr I have also encountered exactly the same problem as @cmlyldz . And I used VS2015 x86 Native Tools Command Prompt to compile dlib, but the problem didn't go.

masoudr commented 7 years ago

@hepingtao Please give me more information about the exact version of your tools like python version?

cmlyldz commented 7 years ago

@hepingtao be careful while downloading scipy, numpy you have to download them x86 like others(if you want to use x86). Also python, boost and also dlib must compile on x86 also. If you did everything in an x86 compiler (or x64) there will be no error.

008karan commented 7 years ago

I have installed cmak and added to path but while installing dlib getting message to install cmak

masoudr commented 7 years ago

@008karan If your CMake is successfully added, you can use cmake --version in cmd to verify that. I'm not sure if the problem will exist but put your complete error log here.

008karan commented 7 years ago

getting this message ...... C:\Users\karan\Downloads\dlib-master>python setup.py install running install running bdist_egg running build Detected Python architecture: 64bit Detected platform: win32 Removing build directory C:\Users\karan\Downloads\dlib-master./tools/python/bui ld Configuring cmake ... -- Building for: NMake Makefiles -- The C compiler identification is unknown -- The CXX compiler identification is unknown CMake Error in CMakeLists.txt: The CMAKE_C_COMPILER: cl is not a full path and was not found in the PATH. To use the NMake generator with Visual C++, cmake must be run from a shell that can use the compiler cl from the command line. This environment is unable to invoke the cl compiler. To fix this problem, run cmake from the Visual Studio Command Prompt (vcvarsall.bat). Tell CMake where to find the compiler by setting either the environment variable "CC" or the CMake cache entry CMAKE_C_COMPILER to the full path to the compiler, or to the compiler name if it is in the PATH. CMake Error in CMakeLists.txt: The CMAKE_CXX_COMPILER: cl is not a full path and was not found in the PATH. To use the NMake generator with Visual C++, cmake must be run from a shell that can use the compiler cl from the command line. This environment is unable to invoke the cl compiler. To fix this problem, run cmake from the Visual Studio Command Prompt (vcvarsall.bat). Tell CMake where to find the compiler by setting either the environment variable "CXX" or the CMake cache entry CMAKE_CXX_COMPILER to the full path to the compiler, or to the compiler name if it is in the PATH. -- Configuring incomplete, errors occurred! See also "C:/Users/karan/Downloads/dlib-master/tools/python/build/CMakeFiles/CMa keOutput.log". See also "C:/Users/karan/Downloads/dlib-master/tools/python/build/CMakeFiles/CMa keError.log". error: cmake configuration failed!

masoudr commented 7 years ago

@008karan Try to run setup process with VS2015 x86\X64 Native Tools Command Prompt.

7633 commented 6 years ago

@loqpa

Hey! I have a problem while following this tutorial. My versions are: Python 3.5.4 dlib 19.7 boost 1.65.1 (using "with cuda" and "with avx" options)

jpeg.lib(jdatadst.c.obj) : error LNK2019: unresolved external symbol _imp_ferror referenced in function term_destination [C:\Users\Loqpa\Downloads\dlib-master\dlib-master\tools\python\build\dlib.vcxproj] jpeg.lib(jmemmgr.c.obj) : error LNK2019: unresolved external symbol __imp___stdio_common_vsscanf referenced in function vsscanf_l [C:\Users\Loqpa\Downloads\dlib-master\dlib-master\tools\python\build\dlib.vcxproj] jpeg.lib(jmemansi.c.obj) : error LNK2019: unresolved external symbol imp_tmpfile referenced in function jpeg_open_backing_store [C:\Users\Loqpa\Downloads\dlib-master\dlib-master\tools\python\build\dlib.vcxproj] C:\Users\Loqpa\Downloads\dlib-master\dlib-master\tools\python\build\Release\dlib.pyd : fatal error LNK1120: 3 unresolved externals [C:\Users\Loqpa\Downloads\dlib-master\dlib-master\tools\python\build\dlib.vcxproj]

Any ideas how to fix it? I am up to trying everything you suggest:)

I had the same problem, and have solved it. I'm using anaconda3 python3.5 and when setup.py generate install project, it get jpeg library from %Anaconda3%/envs/%your_env%/Library/lib/jpeg.lib This jpeg.lib using by pyqt package. And there are functions, that don't agree with declspec needed by dlib.

To solve problem, switch your cmd to your virtual_env, and upgrade libjpeg from anaconda channel, e.g.: activate my_env conda install -c anaconda libjpeg

After that, go to your %Anaconda3%/envs/%your_env%/Library/lib/ directory and make sure, that you have exactly libjpeg.lib, then temprorary move files jpeg.lib and jpeg-static.lib to your home directory.

Now, your have true libjpeg.lib, that python's setup.py cmake catch up from %Anaconda3%/envs/%your_env%/Library/lib/.

Run python setup.py install --yes USE_AVX_INSTRUCTIONS --yes DLIB_USE_CUDA and enjoy.

Don't forget move back your 'jpeg.lib' to %Anaconda3%/envs/%your_env%/Library/lib/ directory provide for pyqt package.

Note, that your don't using virtual env, your lib directory will be %Anaconda3%/Library/lib/ Work in VS2015 x64 Native Tools Command Prompt

loqpa commented 6 years ago

@7633 Thank you for your help! Temporarily removing jpeg.lib was enough for dlib 19.7 to compile successfully.

davisking commented 6 years ago

You guys shouldn't need to do this kind of hack to make it work. I've updated dlib's build scripts to detect the broken libjpeg in anaconda and avoid linking to it. So now you should be able to say python setup.py install and it should just work.

mahecode commented 6 years ago

screenshot 13

Why i am facing this error. Help please!!!

masoudr commented 6 years ago

@mahecode I think you are using dlib with pip. This tutorial is made for compiling dlib from source and it has been tested with python 3.4+. Please post complete error log or try to compile from source.

mahecode commented 6 years ago

@masoudr its shows above following error when face_recognition starts to install on my machine . iam asking for the help for this error

PBShortStop commented 6 years ago

Hello, @masoudr I have a problem while following this tutorial.

window 10 vs 2015 Python 3.5.3 dlib 19.4 boost 1.65.1

LINK : fatal error LNK1104: 'python36.lib' cannot open file. [~/dlib-master\tools\python\build\dlib_.vcxproj]

"~\dlib-master\tools\python\build\dlib_.vcxproj" Project built (default target) - Failed

masoudr commented 6 years ago

@PBShortStop It is very strange, first make sure that there is no space in your working directory second check your python version in cmd with python --version. Are you using python 3.5? Your error is about not finding the python36.lib which is for Python 3.6. Try with the latest version of dlib like 19.7 and make sure about the version of python (boost, python and MSVC must be on the same architecture like X64 or X86 before compiling dlib).

mahecode commented 6 years ago

@masoudr is this configuration is OK?

C:\Users\ACER>pip show dlib Name: dlib Version: 18.17.100 Summary: A toolkit for making real world machine learning and data analysis applications Home-page: https://github.com/davisking/dlib Author: Davis King Author-email: davis@dlib.net License: Boost Software License Location: c:\python27\lib\site-packages Requires:

masoudr commented 6 years ago

@mahecode It seems that it is fine, you can also try to use import dlib in Python shell.

alundiak commented 6 years ago

@masoudr @008karan "VS2015 x86\X64 Native Tools Command Prompt" What if I don't have VS at all? Should I install GCC separately?

Here is cmake --help

Generators

The following generators are available on this platform:
  Visual Studio 15 2017 [arch] = Generates Visual Studio 2017 project files.
                                 Optional [arch] can be "Win64" or "ARM".
  Visual Studio 14 2015 [arch] = Generates Visual Studio 2015 project files.
                                 Optional [arch] can be "Win64" or "ARM".
  Visual Studio 12 2013 [arch] = Generates Visual Studio 2013 project files.
                                 Optional [arch] can be "Win64" or "ARM".
  Visual Studio 11 2012 [arch] = Generates Visual Studio 2012 project files.
                                 Optional [arch] can be "Win64" or "ARM".
  Visual Studio 10 2010 [arch] = Generates Visual Studio 2010 project files.
                                 Optional [arch] can be "Win64" or "IA64".
  Visual Studio 9 2008 [arch]  = Generates Visual Studio 2008 project files.
                                 Optional [arch] can be "Win64" or "IA64".
  Visual Studio 8 2005 [arch]  = Deprecated.  Generates Visual Studio 2005
                                 project files.  Optional [arch] can be
                                 "Win64".
  Borland Makefiles            = Generates Borland makefiles.
  NMake Makefiles              = Generates NMake makefiles.
  NMake Makefiles JOM          = Generates JOM makefiles.
  Green Hills MULTI            = Generates Green Hills MULTI files
                                 (experimental, work-in-progress).
  MSYS Makefiles               = Generates MSYS makefiles.
  MinGW Makefiles              = Generates a make file for use with
                                 mingw32-make.
  Unix Makefiles               = Generates standard UNIX makefiles.
  Ninja                        = Generates build.ninja files.
  Watcom WMake                 = Generates Watcom WMake makefiles.
  CodeBlocks - MinGW Makefiles = Generates CodeBlocks project files.
  CodeBlocks - NMake Makefiles = Generates CodeBlocks project files.
  CodeBlocks - NMake Makefiles JOM
                               = Generates CodeBlocks project files.
  CodeBlocks - Ninja           = Generates CodeBlocks project files.
  CodeBlocks - Unix Makefiles  = Generates CodeBlocks project files.
  CodeLite - MinGW Makefiles   = Generates CodeLite project files.
  CodeLite - NMake Makefiles   = Generates CodeLite project files.
  CodeLite - Ninja             = Generates CodeLite project files.
  CodeLite - Unix Makefiles    = Generates CodeLite project files.
  Sublime Text 2 - MinGW Makefiles
                               = Generates Sublime Text 2 project files.
  Sublime Text 2 - NMake Makefiles
                               = Generates Sublime Text 2 project files.
  Sublime Text 2 - Ninja       = Generates Sublime Text 2 project files.
  Sublime Text 2 - Unix Makefiles
                               = Generates Sublime Text 2 project files.
  Kate - MinGW Makefiles       = Generates Kate project files.
  Kate - NMake Makefiles       = Generates Kate project files.
  Kate - Ninja                 = Generates Kate project files.
  Kate - Unix Makefiles        = Generates Kate project files.
  Eclipse CDT4 - NMake Makefiles
                               = Generates Eclipse CDT 4.0 project files.
  Eclipse CDT4 - MinGW Makefiles
                               = Generates Eclipse CDT 4.0 project files.
  Eclipse CDT4 - Ninja         = Generates Eclipse CDT 4.0 project files.
  Eclipse CDT4 - Unix Makefiles= Generates Eclipse CDT 4.0 project files.

And here is my original error:

Installing collected packages: dlib, numpy, Click, olefile, Pillow, face-recognition-models,cipy, face-recognition, opencv-python, Werkzeug, MarkupSafe, Jinja2, itsdangerous, flask
  Running setup.py install for dlib: started
    Running setup.py install for dlib: finished with status 'error'
    Complete output from command c:\users\andrii.lundiak\appdata\local\programs\python\pytho6-32\python.exe -u -c "import setuptools, tokenize;__file__='C:\\Users\\ANDRII~1.LUN\\AppDat\Local\\Temp\\pip-build-rdun6ek0\\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 C:\Users\ANDRII~1.LUN\AppData\Local\Temp\pip-1vrls9a4-record\install-record.txt --sile-version-externally-managed --compile:
    running install
    running build
    Detected Python architecture: 32bit
    Detected platform: win32
    Configuring cmake ...
    -- Building for: NMake Makefiles
    -- The C compiler identification is unknown
    -- The CXX compiler identification is unknown
    CMake Error in CMakeLists.txt:
      The CMAKE_C_COMPILER:
        cl
      is not a full path and was not found in the PATH.
      To use the NMake generator with Visual C++, cmake must be run from a shell
      that can use the compiler cl from the command line.  This environment is
      unable to invoke the cl compiler.  To fix this problem, run cmake from the
      Visual Studio Command Prompt (vcvarsall.bat).
      Tell CMake where to find the compiler by setting either the environment
      variable "CC" or the CMake cache entry CMAKE_C_COMPILER to the full path to
      the compiler, or to the compiler name if it is in the PATH.
    CMake Error in CMakeLists.txt:
      The CMAKE_CXX_COMPILER:
        cl
      is not a full path and was not found in the PATH.
      To use the NMake generator with Visual C++, cmake must be run from a shell
      that can use the compiler cl from the command line.  This environment is
      unable to invoke the cl compiler.  To fix this problem, run cmake from the
      Visual Studio Command Prompt (vcvarsall.bat).
      Tell CMake where to find the compiler by setting either the environment
      variable "CXX" or the CMake cache entry CMAKE_CXX_COMPILER to the full path
      to the compiler, or to the compiler name if it is in the PATH.
    -- Configuring incomplete, errors occurred!
    See also "C:/Users/andrii.lundiak/AppData/Local/Temp/pip-build-rdun6ek0/dlib/tools/pythobuild/CMakeFiles/CMakeOutput.log".
    See also "C:/Users/andrii.lundiak/AppData/Local/Temp/pip-build-rdun6ek0/dlib/tools/pythobuild/CMakeFiles/CMakeError.log".
    error: cmake configuration failed!

PreReq:

And here is my requirements.txt

dlib
face_recognition
opencv_python
flask

and above error with COMPILER I receive after pip3 install -r requirements.txt All was/is good, except dlib:

$ pip3 install -r requirements.txt
Collecting dlib (from -r requirements.txt (line 1))
  Using cached dlib-19.7.0.tar.gz
Collecting face_recognition (from -r requirements.txt (line 2))
  Using cached face_recognition-1.0.0-py2.py3-none-any.whl
Collecting opencv_python (from -r requirements.txt (line 3))
  Using cached opencv_python-3.3.0.10-cp36-cp36m-win32.whl
Collecting flask (from -r requirements.txt (line 4))
  Using cached Flask-0.12.2-py2.py3-none-any.whl
Collecting numpy (from face_recognition->-r requirements.txt (line 2))
  Using cached numpy-1.13.3-2-cp36-none-win32.whl
Collecting Click>=6.0 (from face_recognition->-r requirements.txt (line 2))
  Using cached click-6.7-py2.py3-none-any.whl
Collecting Pillow (from face_recognition->-r requirements.txt (line 2))
  Using cached Pillow-4.3.0-cp36-cp36m-win32.whl
Collecting face-recognition-models>=0.2.0 (from face_recognition->-r requirements.txt (line )
  Using cached face_recognition_models-0.3.0.tar.gz
Collecting scipy>=0.17.0 (from face_recognition->-r requirements.txt (line 2))
  Using cached scipy-1.0.0-cp36-none-win32.whl
Collecting Werkzeug>=0.7 (from flask->-r requirements.txt (line 4))
  Using cached Werkzeug-0.12.2-py2.py3-none-any.whl
Collecting Jinja2>=2.4 (from flask->-r requirements.txt (line 4))
  Using cached Jinja2-2.9.6-py2.py3-none-any.whl
Collecting itsdangerous>=0.21 (from flask->-r requirements.txt (line 4))
  Using cached itsdangerous-0.24.tar.gz
Collecting olefile (from Pillow->face_recognition->-r requirements.txt (line 2))
  Using cached olefile-0.44.zip
Collecting MarkupSafe>=0.23 (from Jinja2>=2.4->flask->-r requirements.txt (line 4))
  Using cached MarkupSafe-1.0.tar.gz
Installing collected packages: dlib, numpy, Click, olefile, Pillow, face-recognition-models,cipy, face-recognition, opencv-python, Werkzeug, MarkupSafe, Jinja2, itsdangerous, flask
  Running setup.py install for dlib: started
    Running setup.py install for dlib: finished with status 'error'
... 
masoudr commented 6 years ago

@alundiak As I know gcc is only made for Unix systems. There are some alternatives like Mingw but I am not sure if you can compile dlib on it, maybe @davisking can answer and even so you must use it in MinGW environment, not win32. I've already tried with Microsoft Visual Studio Build Tools which has a separate C++ compiler but it didn't work due to missing some libs. You can use the precompiled version of dlib without Visual Studio but you must first check the requirements and you can't install face_recognition without dlib.

davisking commented 6 years ago

Visual Studio community is free. You can download it from the microsoft web page. That's what you should do.

alundiak commented 6 years ago

@davisking no matter of it's free, I just don't want one more deep dependency to depend on. So if it's possible in theory to avoid VS, I would go there. I executed face_recognition on MacOS with no issues (or at least with less issues regarding opencv, cmake, python dlib). And on Windows - Hello troubles :) So, @masoudr if there is anyway to configure Python project, where dependency is face_recgntion tool, I would like avoid dlib, if it's possible, plz let me know, what I should change.

ageitgey commented 6 years ago

@alundiak You're installing a complicated C++ library on Windows (which is not a Unix-like OS). Installing the Windows-provided native development environment is a pretty reasonable requirement to be able to do that. Such is life on Windows. I'm not sure you'll ever be successful with other unix-based compilers on Windows.

face_recognition is built on top of dlib. dlib does most of the actual work. So there's no way to avoid installing dlib while using face_recognition.

davisking commented 6 years ago

You can compile dlib with any C++11 compiler, including GCC or mingw. But my point is that if you want to compile something on windows Visual Studio is your best bet.

loqpa commented 6 years ago

Hey! I don't know if it is Windows only problem - but whith conda, python 3.5 anddlib 19.4 already installed when i run pip install face_recognition==0.2.2 setup for some reason tries to get new dlib and failes to install it. Cause all other dependenices install succesfully I was able to run pip install --no-dependencies face_recognition==0.2.2 and everything is working. Why doesn't it recognise already installed dlib?

ageitgey commented 6 years ago

@loqpa I believe that was a known problem/bug with the dlib conda package on Windows specifically and not dlib itself

Skywalker97 commented 6 years ago

Hi. I tried installing face_recognition but its giving me the error "cannot find cmake make sure its installed and in the path". This is happening despite the fact that I have already installed cmake and have set the environment variables accordingly.