How to install dlib

Two weeks ago I interviewed Davis King, the creator and chief maintainer of the dlib library.

Today I am going to demonstrate how to install dlib with Python bindings on both macOS and Ubuntu.

highly encourage you to take the time to install dlib on your system over the next couple of days.

Starting next week we’ll be diving head first into one of dlib’s core computer vision implementations — facial landmark detection.

I’ll be demonstrating how to use facial landmarks for:

  • Face part (i.e., eyes, nose, mouth, etc.) extraction
  • Facial alignment
  • Blink detection
  • …and much more.

But it all starts with getting dlib installed!

To learn how to install dlib with Python bindings on your system, just keep reading.

How to install dlib

Developed by Davis King, the dlib C++ library is a cross-platform package for threading, networking, numerical operations, machine learning, computer vision, and compression, placing a strong emphasis on extremely high-quality and portable code. The documentation for dlib is also quite fantastic.

From a computer vision perspective, dlib has a number of state-of-the-art implementations, including:

  • Facial landmark detection
  • Correlation tracking
  • Deep metric learning

Over the next few weeks we’ll be exploring some of these techniques (especially facial landmark detection), so definitely take the time now to get dlib configured and installed on your system.

Step #1: Install dlib prerequisites

The dlib library only has four primary prerequisites:

  • BoostBoost is a collection of peer-reviewed (i.e., very high quality) C++ libraries that help programmers not get caught up in reinventing the wheel. Boost provides implementations for linear algebra, multithreading, basic image processing, and unit testing, just to name a few.
  • Boost.Python: As the name of this library suggests, Boost.Python provides interoperability between the C++ and Python programming language.
  • CMake: CMake is an open-source, cross-platform set of tools used to build, test, and package software. You might already be familiar with CMake if you have used it to compile OpenCV on your system.
  • X11/XQuartx: Short for “X Window System”, X11 provides a basic framework for GUI development, common on Unix-like operating systems. The macOS/OSX version of X11 is called XQuartz.

I’ll show you how to install each of these prerequisites on your Ubuntu or macOS machine below.

Ubuntu

Installing CMake, Boost, Boost.Python, and X11 can be accomplished easily with  apt-get :

I assume you already have pip  (for managing, installing, and upgrading Python packages) installed on your machine, but if not, you can install pip  via:

After completing these steps, continue to Step #2.

macOS

In order to install Boost, Boost.Python, and CMake on macOS, you’ll be using the Homebrew package manager. Think of Homebrew as a similar equivalent of Ubuntu’s apt-get  only for macOS.

If you haven’t already installed Homebrew, you can do so by executing the following commands:

Hint: You can check if Homebrew is already installed on your machine by executing the brew  command in your terminal. If you get a brew: command not found  error, then Homebrew is not installed on your machine.

Now that Homebrew is installed, open up your ~/.bash_profile  file (create it if it doesn’t exist):

And update your PATH  variable to check for packages installed by Homebrew before checking the rest of your system:

After updating your ~/.bash_profile  file, it should look similar to mine:

Figure 1: After updating your ~/.bash_profile file, yours should look similar to mine.

We now need to reload the contents of the ~/.bash_profile  file via the source  command:

This command only needs to be executed once. Alternatively, you can open up a new terminal window which will automatically source  the ~/.bash_profile  for you.

Next, let’s install Python 2.7 and Python 3:

We can then install CMake, Boost, and Boost.Python:

The --with-python3  flag ensures that Python 3 bindings for Boost.Python are compiled as well — Python 2.7 bindings are compiled by default.

Once you start the boost-python  install, consider going for a nice walk as the build can take a bit of time (10-15 minutes).

As a sanity check, I would suggest validating that you have both boost  and boost-python  installed before proceeding:

As you can see from my terminal output, both Boost and Boost.Python have been successfully installed.

The last step is to install the XQuartz window manager so we can have access to X11. XQuartz is easy to install — just download the .dmg  and run the install wizard. After installing, make sure you logout and log back in!

Fun Fact: XQuartz used to be installed by default on OSX 10.5-10.7. We now need to manually install it.

Now that we have our prerequisites installed, let’s continue to our next (optional) step.

Step #2: Access your Python virtual environment (optional)

If you have followed any of my PyImageSearch tutorials on installing OpenCV, then you are likely using Python virtual environments.

Using Python’s virtualenv and virtualenvwrapper libraries, we can create separate, independent Python environments for each project we are working on — this is considered a best practice when developing software in the Python programming language.

Note: I’ve already discussed Python virtual environments many times before on the PyImageSearch blog so I won’t spend any more time discussing them here today — if you would like to read more about them, please see any of my installing OpenCV tutorials.

If you would like to install dlib into a pre-existing Python virtual environment, use the workon  command:

For example, if I wanted to access a Python virtual environment named cv , I would use the command:

Notice how my terminal window has changed — the text (cv)  now appears before my prompt, indicating that I am in the cv  Python virtual environment:

Figure 2: I can tell that I am in the “cv” Python virtual environment by validating that the text “(cv)” appears before my prompt.

Otherwise, I can create an entirely separate virtual environment using the mkvirtualenv  command — the command below creates a Python 2.7 virtual environment named py2_dlib :

While this command will create a Python 3 virtual environment named py3_dlib :

Again, please keep in mind that using Python virtual environments are optional, but highly recommended if you are doing any type of Python development.

For readers that have followed my previous OpenCV install tutorials here on the PyImageSearch blog, please make sure you access your Python virtual environment before proceeding to Step #3 (as you’ll need to install the Python prerequisites + dlib into your virtual environment).

Step #3: Install dlib with Python bindings

The dlib library doesn’t have any real Python prerequisites, but if you plan on using dlib for any type of computer vision or image processing, I would recommend installing:

These packages can be installed via pip :

Years ago, we had to compile dlib manually from source (similar to how we install OpenCV). However, we can now use pip  to install dlib as well:

This command will download the dlib package from PyPI, automatically configure it via CMake, and then compile and install it on your system.

Provided you have the CMake, Boost, Boost.Python, and X11/XQuartz installed on your system, the command should exit without error (leaving you with a successful dlib install).

I would suggest going out for a nice cup of coffee as this step can take 5-10 minutes for the compile to finish.

After coming back, you should see that dlib has been successfully installed:

Figure 3: The dlib library with Python bindings on macOS have been successfully installed.

The same goes for my Ubuntu install as well:

Figure 4: Installing dlib with Python bindings on Ubuntu.

Step #4: Test out your dlib install

To test out your dlib installation, just open up a Python shell (making sure to access your virtual environment if you used them), and try to import the dlib  library:

Figure 5: Testing out my dlib + Python install on macOS and Python 3.6.

If you’ve installed dlib into the same Python virtual environment that you installed OpenCV, you can access OpenCV as well via your cv2  bindings. Here is an example on my Ubuntu machine:

Figure 6: Validating that I can import both dlib and OpenCV into the same Python shell.

Congratulations, you now have dlib installed on your system!

Summary

In today’s blog post I demonstrated how to install the dlib library with Python bindings on Ubuntu and macOS.

Next week we’ll start exploring how to use dlib; specifically, facial landmark detection.

You won’t want to miss this tutorial, so to be notified when the next post is published, be sure to enter your email address in the form below!

See you next week!

, , , , ,

79 Responses to How to install dlib

  1. Sanket March 27, 2017 at 11:10 am #

    Can you install dlib on Windows? If so, how?

    • Adrian Rosebrock March 28, 2017 at 12:59 pm #

      Please see my reply “Anoynmous” below.

  2. Abkul Orto March 27, 2017 at 11:26 am #

    Hello Adrian,
    Thanks for sharing this amazing and exciting C++ library. Kindly advice the right/stable version of Ubuntu to install.

    • Adrian Rosebrock March 28, 2017 at 12:57 pm #

      I’ve personally tested these instructions with both Ubuntu 14.04 and 16.04. Both work.

  3. Tom March 27, 2017 at 11:39 am #

    Hi Adrian,
    Will pip also install the tool for bounding box annotation?
    If anyone’s interested in installing dlib the compile or pip way on Raspberry Pi, remember to increase your swap memory in “/etc/dphys-swapfile”
    Cheers,
    Tom

    • Adrian Rosebrock March 28, 2017 at 12:57 pm #

      Unfortunately, no. For that you will need to compile dlib from source.

      • Daniella Solomon April 7, 2017 at 7:21 am #

        Hi
        How much you recommend to increase the memory? it doesn’t work on default
        (I have your built raspberry pi image)

        • Adrian Rosebrock April 8, 2017 at 12:49 pm #

          You can increase memory on the Raspberry Pi by decreasing memory allocated to the GPU via raspi-config.

          • Brian Norman April 26, 2017 at 3:13 am #

            I also had the MemoryError problem installing scipy on my Pi 3.
            Using pip’s –no-cache-dir switch allowed the install to complete 0k.

            It might be worth adding that to your excellent instructions.

          • Adrian Rosebrock April 26, 2017 at 6:50 am #

            Hey Brian — I’m actually doing an entirely separate tutorial for installing dlib on the Raspberry Pi next week (1 May 2017). It will include a few additional tips to help get dlib installed on the Pi.

          • Brian Norman April 27, 2017 at 3:42 am #

            You might want to look at my post today about getting dlib to install. It has taken me about 3 days to get openCV and dlib installed but I’m there now.

  4. Zethembiso Msomi March 27, 2017 at 11:46 am #

    Is it possible to install this on a Raspberry Pi?

    • Adrian Rosebrock March 28, 2017 at 12:56 pm #

      Yes, absolutely. Ubuntu and Raspbian are Debian-based so you can actually use the Ubuntu instructions to install dlib on your Raspberry Pi.

      • Adriana June 12, 2017 at 1:30 am #

        Adrian, I keep getting errors when I try to install scikit-image on my Raspbian. How to fix?

        • Adrian Rosebrock June 13, 2017 at 11:05 am #

          What is the error you are getting? Without knowing the error, it’s impossible to provide any help or insight.

  5. Simba March 27, 2017 at 2:25 pm #

    Thanks a lot. Was having trouble installing. looking forward to some tutorials with dlib

    • Adrian Rosebrock March 28, 2017 at 12:55 pm #

      Thanks Simba — and congrats on getting dlib installed.

  6. Anoynmous March 28, 2017 at 2:07 am #

    Can we have a same installation process for windows also please.. Struggling a lot for it.

    • Adrian Rosebrock March 28, 2017 at 12:53 pm #

      I do not have any plans to create a Windows install tutorial nor support Windows on the PyImageSearch blog. Please refer to dlib official site for Windows instructions. When it comes to learning computer vision (or most advanced science techniques), I would encourage you to use a Unix-based system.

      • J. Gravett April 2, 2017 at 5:29 am #

        Wow, that’s not exactly helpful. I guess now ‘I do not have any plans’, either…to spend my money on your products.

        • Adrian Rosebrock April 3, 2017 at 2:01 pm #

          I wish I could offer Windows support, but there are honestly too many logistical issues. I offer almost 200 free tutorials here on the PyImageSearch blog. I hope you enjoy them. If you don’t want to purchase any of the teaching products here on PyImageSearch, you don’t have to — no one is asking you to or forcing you to. Enjoy the content and I hope it helps you on your computer vision journey. But please keep in mind that I am just one person and there are limitations to what I can provide. I’ve found that Unix-based environments are the most useful when building computer vision applications (the exception being if you want to build a Windows app, of course). If you have a Windows-specific question, I am not the right person to ask.

        • Peter Lunk April 19, 2017 at 7:05 am #

          Have you concidered adding an extra HD to your system and making it dual bootable with Ubuntu nstalled aside your windows installation ?
          This is what I did…

        • Thierry Jeanneret May 2, 2017 at 6:10 am #

          Hello, why don’t you work on a virtual machine ? I am doing so on my Mac, all the Python stuff works much better on a Linux 16.04 LTS VM on VirtualBox. Both products are free, you can get VirtualBox from https://www.virtualbox.org/wiki/Downloads.
          Just install it on your Windows system, create or download (http://www.osboxes.org/ubuntu/) the Ubuntu VM and than follow the directions given by Adrian. Everything is described step by step, its a breeze.

  7. Royi March 28, 2017 at 2:36 am #

    Hi Adrian,

    Great post!

    I have a nice idea for you.
    Why don’t you show how to use DLib to learn the 194 Facial Landmarks of the HELEN database (Remember to augment the database by mirroring the images)?

    It would be great and will create a new trained predictor for the users of DLib.

    Thank You.

    • Adrian Rosebrock March 28, 2017 at 12:52 pm #

      The dlib library ships with a facial landmark detector? Are you asking me to demonstrate how to train that detector from scratch? Keep in mind that most of the dlib functionality doesn’t have Python bindings, only C++.

      • Royi March 31, 2017 at 9:18 am #

        Hi Adrian,

        Yes, I was talking about training it for a new job.
        My idea was 194 Points of the HELEN database.

        Thank You.

  8. Michael George March 28, 2017 at 4:50 am #

    Thanks for a great post again!

    I had installed dlib a few days back. I am working in a virtual environment using Anaconda and my experience was that there were a few incompatibilities between the boost in anaconda repository and dlib from pip.

    After toiling for a few days, was able to get dlib working with Anaconda. Had to setup dlib and boost from source.

    So if any one is facing difficulty in working with Anaconda and dlib, I might be able to help.

    Adrian, I am eagerly waiting for your future posts on dlib. Thanks!

    • Adrian Rosebrock March 28, 2017 at 12:51 pm #

      Congrats on getting dlib installed Michael. And thank you for being willing to help Anaconda users.

    • JBeale March 29, 2017 at 11:46 am #

      Good to know. I had Anaconda and couldn’t get dlib going due to a boost problem. Finally, simply re-installed Ubuntu from scratch; after that dlib installed OK per instructions here.

    • panneer selvam July 13, 2017 at 9:54 am #

      Hi Michael

      Can you please help me in installing dlib in anaconda environment in windows.

  9. Murthy March 30, 2017 at 3:23 am #

    Thanks Adrian. I installed dlib – on Linux 16.04 – no issues at all.
    Look for ward to facial landmark detection

    • Adrian Rosebrock March 31, 2017 at 1:52 pm #

      Congrats on getting dlib installed Murthy, nice job!

  10. Neeraj Kumar April 1, 2017 at 12:04 pm #

    Dear Adrian,

    Thanks a ton man. Just struck the Ubuntu + OpenCV + Python + Dlib installation and configuration in one go. It’s just because of you.

    Regards
    Neeraj Kumar

    • Adrian Rosebrock April 3, 2017 at 2:08 pm #

      Thank you for the kind words Neeraj — and congratulations on getting dlib installed.

  11. Tony April 1, 2017 at 5:48 pm #

    Straightforward install due to the very clear instructions, also on Ubuntu 16.04. Thanks Adrian

    • Adrian Rosebrock April 3, 2017 at 2:05 pm #

      Thank you Tony!

  12. Yash Bafna April 4, 2017 at 3:15 am #

    Great post!!
    Very well explained!!

    • Adrian Rosebrock April 5, 2017 at 12:01 pm #

      Thanks Yash! 🙂

  13. Matheus April 7, 2017 at 11:33 am #

    I’m getting “Segmentation fault: 11” when importing dlib in python3 in my Mac =/

    • Adrian Rosebrock April 8, 2017 at 12:47 pm #

      99.9% of the time you’ll see a segmentation fault error when you try to import dlib into a different version of Python than it was compiled against. I would suggest compiling dlib from source rather than using pip.

  14. Anonymous April 8, 2017 at 3:38 pm #

    Hello Adrian,

    I am trying to install dlib library on raspberry pi 3.

    The commands in step 3 to install three packages were failed; installed them using sudo apt-get command.

    In the last step “pip install dlib”, it is stuck there (It was also happened with the three packages installation commands) like:

    $ pip install dlib
    Collecting dlib
    Using cached dlib-19.4.0.tar.gz
    Building wheels for collected packages: dlib
    Running setup.py bdist_wheel for dlib … /

    please guide us

    • Adrian Rosebrock April 12, 2017 at 1:51 pm #

      The install is likely not “stuck”. It can take 10 minutes to install dlib on a standard laptop/desktop. On a Raspberry Pi this number can jump to an hour. If you run top you’ll see that your system is busy compiling dlib.

    • yasar April 30, 2017 at 11:55 am #

      i am working on raspberry pi too. It took about 4-5 hours to finish

  15. Anil Adhikari April 11, 2017 at 6:38 pm #

    Hello Adrian,
    I followed this tutorial to install dlib in python. Everything was going smoothly until the time of installing dlib. When i ran the command “pip install dlib” it gives two error “Failed building wheel for dlib” and “error: cmake configuration failed!”.
    What could be the reason behind this?
    Thanks in advance.

    • Adrian Rosebrock April 12, 2017 at 1:04 pm #

      It sounds like the internal CMake script could not configure dlib correctly. Did you install all the dependencies without error? You have might to resort to compiling dlib from source.

      • eggs April 15, 2017 at 3:35 pm #

        i tried over and over , while install dlib it failed at %79 building cxx…..
        cmake build failed.

        • Adrian Rosebrock April 16, 2017 at 8:52 am #

          Which operating system are you trying to compile dlib on?

          • eggs April 16, 2017 at 11:51 am #

            raspi 2 – raspian 4.4.50-v7+ – python 2.7.x – opencv 3 – virtualenv cv

          • eggs April 19, 2017 at 11:38 am #

            i tried on your pre-installed package for raspi and i get same error again.

          • Adrian Rosebrock April 19, 2017 at 12:42 pm #

            I’m writing a tutorial dedicated to installing dlib on the Raspberry Pi. It will go live at the end of this month. The tutorial will resolve any issues installing dlib on the Raspberry Pi.

  16. jianbo wang April 24, 2017 at 11:12 am #

    Hello, Adrian Rosebrock
    your blog help me a lot, thanks, and let me help others

    for how to install dlib on windows

    1. install python 3.5 32bit, can be download here
    https://www.python.org/downloads/release/python-353/
    2.download dlib from here
    https://pypi.python.org/pypi/dlib/18.17.100
    select “dlib-18.17.100-cp35-none-win32.whl (md5)”
    last, run pip install dlib-18.17.100-cp35-none-win32.whl

    it success from my 32bit win7

    • Adrian Rosebrock April 24, 2017 at 12:04 pm #

      Thanks for sharing!

  17. Brian Norman April 27, 2017 at 3:40 am #

    Installing DLIB was hanging my RPi 3 (1Gb ram).

    I’ve been struggling with this for a couple of days trying to play catchup with your emails. I’d love to know your config which allows it to install in 10 minutes. I’m sure it’s to do with swap size or zRAM (I haven’t tried this)

    Today I increased the size of the dphys-swapfile to 1Gb and moved it (temporarily) onto a USB hard drive. The Raspian default is 100Mb on the SD card! Of course a 100Mb swap file on an SD card is going to ‘wear out’ the SD card if a lot of swapping takes place.

    Anyway, whilst running the ‘pip install dlib’ command I also fired off top – ‘swap used’ peaked at 500Mb so far – no wonder it hung with the default swap setting. I noted that my Pi is a lot more responsive to user input during the install having done this (previously I had to pull the plug to get it back)
    .
    Yay, the install has just this second completed without error – and probably in less than 20 minutes (I didn’t time it exactly)- now to follow your blog.

    Having done that I’ll now restore the original swapfile and reboot.

    For others with similar hanging issues this is what I did (after a few hours of web searching).

    1 find a USB powered hard drive (I had a Philips 300Gb not doiung anything) and plug it in.
    2 note mount path (something like /media/pi/philips in my case)

    3 sudo nano /etc/dphys-swapfile

    set the following values :-
    CONF_SWAPFILE=/media/pi/philips/swap (use your own values)
    CONF_SWAP_SIZE=1024

    save and exit

    4 issue these commands
    sudo /etc/init.d/dphys-swapfile stop
    sudo /etc/init.d/dphys-swapfile start

    5 install dlib with the ‘pip install dlib’ command
    6 when completed restore your /etc/dphys-swapfile settings
    7 re-run the commands at step 4

    Now you can dismount the usb drive and use it for some other purpose.

    Note I also made another post about using –no-cache-dir when installing scipy

    When my Pi camera turns up I can get now on with facial feature recognition.

    Oh, and one last recommendation. Having suffered so many hiccups on the route I took the precaution of imaging my SD card after each major stage. I use Win32DiskImager for that.

    • Adrian Rosebrock April 28, 2017 at 9:37 am #

      Hi Brian — I’m actually detailing an entire blog post dedicated to installing dlib on the Raspberry Pi. It’s already written and set to publish on Monday, May 1st at 10AM EST. It makes use of swap settings similar to yours. You actually don’t even need the external drive if you increase your swap file size.

  18. Roman April 28, 2017 at 4:02 am #

    I installed dlib but how can I install Sym-link with in OpenCV and with in Keras_tf. I mean I installed
    1. dlib (virtual environment)
    2. keras_tf (virtual environment)
    3. OpenCV

    It would be nice to have Sym-link with all of them.

    • Adrian Rosebrock April 28, 2017 at 9:20 am #

      You would need to find the location to your cv2.so first. Normally it would be in /usr/local/lib/python2.7/site-packages/cv2.so, but you’ll want to check on your own machine first.

      From there, change directory to your site-packages directory of the virtual environment and then sym-link in OpenCV:

  19. Zhihang May 4, 2017 at 12:56 pm #

    How to implement the paper “Max-Margin Object Detection” based on Structured SVM by Python, which is written by Davis King? Can you give a example in your blog?Maybe, it is a good topic for your course!

    • Adrian Rosebrock May 8, 2017 at 12:45 pm #

      The method is already implemented inside the dlib library. I would suggest looking at the dlib source code if you’re interested in the algorithm itself.

  20. Owais May 13, 2017 at 8:14 am #

    I am using Raspberry Pi 3 and when i installed dlib it only worked on Python 3.4 and it doesn’t work on Python 2.7.

    I want it to work on Python 2.7 because when i type “import cv” on Python 3.4 i get an error because there is no module named ‘cv’, while on 2.7 i can import cv.

    Thank you!

    • Adrian Rosebrock May 15, 2017 at 8:49 am #

      This sounds like an issue with your Python virtual environments. Please refer to this blog post where I provide instructions on how to install dlib on the Raspberry Pi.

  21. Ansh Verma May 16, 2017 at 9:55 pm #

    Hi Adrian,

    Appreciate your blog on installing the dlib library. I do wish to ask you of an error as when I am installing the dlib it gets stuck while compiling the trainer.cpp as a result the installation of the dlib freezes.

    I read on stackoverflow that we have to manually compile the cpp examples? I am running on py2.7.9 virtual env. Any suggestions would be helpful.

    • Adrian Rosebrock May 17, 2017 at 9:51 am #

      Which operating system/hardware are you trying to compile dlib on?

      • Ansh May 17, 2017 at 12:57 pm #

        I am running it on raspberry pi 3 : Raspbian GNU/ Linux 8 (jessie).

        • Adrian Rosebrock May 18, 2017 at 11:54 am #

          Please use this tutorial to install dlib on your Raspberry Pi.

  22. Ampharos May 17, 2017 at 12:55 am #

    I installed dlib in Ubuntu 16.04 following this guide and it works perfectly. Thanks for that!
    My problem is that face detection is a really slow process and I want to speed-it up by activating the support for AVX extensions but I don’t know how to modify the cmake in order to recompile it as initially I just did it through pip(pip install dlib).

    • Adrian Rosebrock May 17, 2017 at 9:49 am #

      Congrats on getting OpenCV installed Ampharos, nice job!

      As far as face detection goes, you’ll want to compile dlib from source rather than a pip install. I’ll be covering how to speedup the dlib library for face detection and facial landmarks in a future blog post.

  23. Madhu Oruganti May 20, 2017 at 2:21 am #

    Hi,
    I perfromed all the steps but it is not mapping to cv environment like No module cv2 in the python dlib can you please suggest me

    • Adrian Rosebrock May 21, 2017 at 5:14 am #

      Please see the other comments in this post. You need to sym-link your cv2.so bindings into the Python virtual environment you used for dlib.

  24. Damian June 4, 2017 at 5:39 pm #

    My raspberry frezzee when installing dlib :((

    • Adrian Rosebrock June 6, 2017 at 12:06 pm #

      Hey Damian — please use this blog post to install dlib on your Raspberry Pi.

  25. SHUBHAM MALIK June 8, 2017 at 10:10 am #

    Can I install dlib using anaconda? I am using conda environment variable but running into many issues one after another.
    this: http://dlib.net/faq.html#Whywon'tthePythonbindingscompilework
    says to uninstall , but anaconda has many things. Is it wise to uninstall it?

    • Adrian Rosebrock June 9, 2017 at 1:40 pm #

      I have never used Anaconda to install dlib, I am not sure. I would suggest asking on the official dlib forums.

  26. dick June 19, 2017 at 10:42 am #

    hi Ardian,

    thanks for your great tutorials. I followed this one on my macbook on Sierra, and succeeded in compiling without errors. However, when I import dlib in python3.6, I get an error: illegal instruction: 4. Could it be my processor is not up yo this?

    • Adrian Rosebrock June 20, 2017 at 10:57 am #

      It sounds like you compiled dlib against a different Python version than you imported it into. Double-check your Python versions and ensure you use the same Python and pip for both install and import.

  27. Arpit Agarwal July 4, 2017 at 3:58 pm #

    Hello,

    Thank you for this great work. These are the great tutorials to start with.

    However, reading the comments made it clear you have less idea to install dlib on Windows.
    I’ve installed cmake, boost using pip and installed boost-python using gohlke’s libraries ( http://www.lfd.uci.edu/~gohlke/pythonlibs/#boost.python ) but cannot figure out about X11.

    Can you help me with this one only.
    Would be a great help as a beginner.

    I’m using Win 10 and Python 2.7

    • Adrian Rosebrock July 5, 2017 at 5:56 am #

      Hi Arpit — thanks for the comment; however, I do not support Windows here on the PyImageSearch blog. I highly recommend that you a Unix-based environment such as Linux or macOS to study computer vision.

Trackbacks/Pingbacks

  1. Facial landmarks with dlib, OpenCV, and Python - PyImageSearch - April 3, 2017

    […] week we learned how to install and configure dlib on our system with Python […]

  2. Detect eyes, nose, lips, and jaw with dlib, OpenCV, and Python - PyImageSearch - April 10, 2017

    […] weeks ago I demonstrated how to install the dlib library which we are using for facial landmark […]

  3. Install dlib on the Raspberry Pi - PyImageSearch - May 1, 2017

    […] A few weeks ago I did a blog post on how to install the dlib library on Ubuntu and macOS. […]

Leave a Reply