7

I followed the step how to install dlib python on Windows and it works on CMD but in Python's IDE it said ImportError: No module named 'dlib'

Christoph Rackwitz
  • 11,317
  • 4
  • 27
  • 36
wimpykids96
  • 79
  • 1
  • 1
  • 2
  • 2
    Hi Instead of posting an image of text, please can you copy the text directly and paste it as a code block, This will help other StackOverflow users search for other text that might also be useful. Thanks – Spangen Oct 16 '18 at 07:33
  • 1
    I think you installed dlib for python 3.6 and now you are trying to run a python 3.5 script. – Christoffer Oct 16 '18 at 07:35
  • 1
    Can be sure that if you open CDM in a folder other than the Dlib directory you can import it? – Guilherme Uzeda Oct 16 '18 at 10:36
  • 1
    why this is so hard to install this `dlib` I am sick and tried of trying to install this – Bawantha Oct 06 '20 at 06:22

7 Answers7

15

Follow these steps

Install CMAKE

pip install cmake

Then Install dlib

pip install dlib
Sudheer Muhammed
  • 813
  • 8
  • 10
7

There are 3 important steps to make it work.

  1. Install Cmake Cmake download Link and add Path environment variable to its bin eg: C:/ProgramFiles/cmake/bin

  2. Download Visual Studio Built Tools which will be around 4.56 GB Visual Studio Built Tools Link

  3. Then use cmd to install dlib using

pip install dlib

This will do the job....

RedBall
  • 311
  • 4
  • 12
3

Do you tried to do a simple

pip install dlib

I think it can be useful!

In windows, you have to launch a cmd in admin Windows > CMD > Right - Click > Run as Administrator > Yes

CofeDrink68
  • 179
  • 1
  • 2
0

You have multiple pythons, one Python 3.5 and one Python 3.6.

You installed this library in one python only, not in the other.

The library can be imported only in those pythons that you installed it in, not in any other pythons.

You need to install the library in the other python too, if you want to use it there.

Type py -0 in a terminal to get a list of available python versions (that the Python Launcher knows of).

You can also use where python (windows builtin command) to get a list of all the python executables that can be found through the PATH environment variable.

Then you can use py -3.5 -m pip install dlib to install the library into that python. Or, if you know the path to that specific python (let's say C:\Python35\python.exe), you can call that python directly: C:\Python35\python.exe -m pip install dlib

Christoph Rackwitz
  • 11,317
  • 4
  • 27
  • 36
-1

In ubantu 16.04 > Terminal> put these commands

sudo apt-get update
sudo apt-get install build-essential cmake
sudo apt-get install libopenblas-dev liblapack-dev
sudo apt-get install libx11-dev libgtk-3-dev
sudo apt-get install python python-dev python-pip
sudo apt-get install python3 python3-dev python3-pip
mkvirtualenv dlib_test -p python3
workon cv
pip install numpy
pip install dlib
normanius
  • 8,629
  • 7
  • 53
  • 83
  • Can't you condense the install steps this down to one line? `sudo apt-get install build-essential cmake libopenblas-dev liblapack-dev libx11-dev libgtk-3-dev python python-dev python-pip python3 python3-dev python3-pip` – Alice May 01 '22 at 16:53
-1

For Window's users:

  1. Download Visual Studio Built Tools link : https://visualstudio.microsoft.com/visual-cpp-build-tools/

  2. Open Command Prompt - run as Administrator

type and enter the command :- pip install dlib

  1. Open the corresponding virtual anaconda environment and install face-recognition package

pip install face-recognition

-2

Any time you’re working on a Python project that uses external dependencies that you’re installing with pip, it’s best to first create a virtual environment:

follow the bellow link for best understanding: https://realpython.com/python-virtual-environments-a-primer/#create-it

once you create a virtual environment run your all pip commands over there you can easily install all libraries without any error. Thanks!!