Skip to content

Windows Installation Guide #175

Closed
Closed
@masoudr

Description

@masoudr

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

Activity

TheDogeOfTheInternet

TheDogeOfTheInternet commented on Sep 14, 2017

@TheDogeOfTheInternet

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

masoudr commented on Sep 14, 2017

@masoudr
Author

@TheDogeOfTheInternet yes you are right the CMake is a must and I forgot to add it but it is just used to compile dlib and Boost. I've edited my post and add it thanks.
And for your first question yes you can use pip to 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

ageitgey commented on Sep 17, 2017

@ageitgey
Owner

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

ageitgey

ageitgey commented on Sep 17, 2017

@ageitgey
Owner
PBShortStop

PBShortStop commented on Sep 19, 2017

@PBShortStop

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

masoudr

masoudr commented on Sep 19, 2017

@masoudr
Author

@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

BachDoXuan commented on Sep 28, 2017

@BachDoXuan

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

runt1m33rr0r commented on Sep 28, 2017

@runt1m33rr0r

@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

BachDoXuan commented on Sep 28, 2017

@BachDoXuan

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

masoudr commented on Sep 29, 2017

@masoudr
Author

@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

BachDoXuan commented on Sep 29, 2017

@BachDoXuan

@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

masoudr commented on Sep 29, 2017

@masoudr
Author

@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

davisking commented on Sep 29, 2017

@davisking
loqpa

loqpa commented on Oct 4, 2017

@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:)

278 remaining items

Loading
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

      Development

      No branches or pull requests

        Participants

        @ageitgey@zubairahmed-ai@llrraa@alundiak@pirumpi

        Issue actions

          Windows Installation Guide · Issue #175 · ageitgey/face_recognition