xiaolingxiao
xiaolingxiao

Reputation: 4895

Cannot install dlib on mac os X

I am following the instructions here: http://www.pyimagesearch.com/2017/03/27/how-to-install-dlib/

line by line, except for the line where python3 is installed. I made a virtual environment and inside the virtualenv, did these four lines:

$ pip install numpy
$ pip install scipy
$ pip install scikit-image
$ pip install dlib

Unlike the instructions, the last line took a few seconds, not 15 minutes. After the installation, I opened ipython and tried import dlib, and receive this message:

----> 1 from .dlib import *
      2 __version__ = "19.4.0"

ImportError: dlopen(/Users/myname/Documents/camera-project/code/story-board/cv/lib/python2.7/site-packages/dlib/dlib.so, 2): Library not loaded: @rpath/libmkl_rt.dylib
  Referenced from: /Users/myname/Documents/camera-project/code/story-board/cv/lib/python2.7/site-packages/dlib/dlib.so
  Reason: image not found

I assume this means dlib is not properly installed, but I am not sure what I did wrong?

Also, I should add that I do not haveanaconda on my mac, so it cannot be the issue. However earlier today I did, and I could load dlib without an issue, presumably because I am running a version of python distributed by anaconda, and I assume dlib comes with anaconda. However the X11 distributed by anaconda is broken so I had to remove anaconda completely from my system and start over.

EDIT

This is the message I get after installing dlib "successfully":

    :/Library/Python/2.7/site-packages/pip/_vendor/requests/packages/urllib3/util/ssl_.py:318: SNIMissingWarning: An HTTPS request has been made, but the SNI (Subject Name Indication) extension to TLS is not available on this platform. This may cause the server to present an incorrect TLS certificate, which can cause validation failures. You can upgrade to a newer version of Python to solve this. For more information, see https://urllib3.readthedocs.io/en/latest/security.html#snimissingwarning.
  SNIMissingWarning
/Library/Python/2.7/site-packages/pip/_vendor/requests/packages/urllib3/util/ssl_.py:122: InsecurePlatformWarning: A true SSLContext object is not available. This prevents urllib3 from configuring SSL appropriately and may cause certain SSL connections to fail. You can upgrade to a newer version of Python to solve this. For more information, see https://urllib3.readthedocs.io/en/latest/security.html#insecureplatformwarning.
  InsecurePlatformWarning
Installing collected packages: dlib
Successfully installed dlib-19.4.0

Upvotes: 3

Views: 4423

Answers (1)

cosinepenguin
cosinepenguin

Reputation: 1575

You may need to install the pakage cmake.

When I tried installing dlib on my Mac in a virtualenv just now, I got the error

running bdist_wheel
  running build
  error: Cannot find cmake, ensure it is installed and in the path.
  You can install cmake on OSX using `sudo brew install cmake`.
  You can also specify its path with --cmake parameter.

So I would recommend trying to install cmake with

brew install cmake

Upvotes: 1

Related Questions