ALEN TL
ALEN TL

Reputation: 106

Error in installing dlib library in python3.11

I am facing issue installing dlib on windows 10 Edition Windows 10 Home Single Language Version 22H2 Installed on ‎13-‎07-‎2022 OS build 19045.2251 Experience Windows Feature Experience Pack 120.2212.4180.0

I have cmake installed ➜ cmake --version cmake version 3.24.0-rc3

CMake suite maintained and supported by Kitware

I have python 3.11 installed ➜ py --version Python 3.11.0

I have tried to install dlib using pip The error I recieved have been uploaded to pastebin

File "C:\Program Files\Python311\Lib\site-packages\setuptools\command\bdist_egg.py", line 151, in call_command
    self.run_command(cmdname)
  File "C:\Program Files\Python311\Lib\site-packages\setuptools\_distutils\cmd.py", line 319, in run_command
    self.distribution.run_command(command)
  File "C:\Program Files\Python311\Lib\site-packages\setuptools\dist.py", line 1217, in run_command
    super().run_command(command)
  File "C:\Program Files\Python311\Lib\site-packages\setuptools\_distutils\dist.py", line 987, in run_command
    cmd_obj.run()
  File "C:\Program Files\Python311\Lib\site-packages\setuptools\command\install_lib.py", line 11, in run
    self.build()
  File "C:\Program Files\Python311\Lib\site-packages\setuptools\_distutils\command\install_lib.py", line 112, in build
    self.run_command('build_ext')
  File "C:\Program Files\Python311\Lib\site-packages\setuptools\_distutils\cmd.py", line 319, in run_command
    self.distribution.run_command(command)
  File "C:\Program Files\Python311\Lib\site-packages\setuptools\dist.py", line 1217, in run_command
    super().run_command(command)
  File "C:\Program Files\Python311\Lib\site-packages\setuptools\_distutils\dist.py", line 987, in run_command
    cmd_obj.run()
  File "C:\Users\alent\Downloads\dlib-19.24\setup.py", line 134, in run
    self.build_extension(ext)
  File "C:\Users\alent\Downloads\dlib-19.24\setup.py", line 174, in build_extension
    subprocess.check_call(cmake_build, cwd=build_folder)
  File "C:\Program Files\Python311\Lib\subprocess.py", line 413, in check_call
    raise CalledProcessError(retcode, cmd)
subprocess.CalledProcessError: Command '['cmake', '--build', '.', '--config', 'Release', '--', '/m']' returned non-zero exit status 1.

https://pastebin.com/8N5kb75D

Then I tried building it from source So I downloaded the latest release from https://github.com/davisking/dlib/releases/tag/v19.24 The error I recied have been uploaded to pastebin https://pastebin.com/YjiVTMEp

Please help me. Thank you for looking into this.

When I try to build it from source, I get https://pastebin.com/YjiVTMEp When I try to install using pip, I get https://pastebin.com/8N5kb75D

Upvotes: 1

Views: 20349

Answers (3)

ALEN TL
ALEN TL

Reputation: 106

Yes. I made it successful using python3.11 All you need to do is

  1. Clone the repo using git clone https://github.com/davisking/dlib
  2. Get inside the directory in cmd using cd dlib
  3. Make sure you have visual studio desktop development with c++ Heres the image
  4. Install cmake from https://cmake.org/download/
  5. Using pip to install cmake py -m pip install cmake
  6. Then try installing dlib by py setup.py install

Upvotes: 8

dlib is not install in python 3.11 version. Downgrade your python version in Anaconda prompt

conda install python=3.9

And install dlib. Download dlib from https://pypi.org/simple/dlib/ and install it

!pip install "C:\Users\Downloads\dlib-19.22.99-cp39-cp39-win_amd64.whl"

Upvotes: 0

Daniel
Daniel

Reputation: 1

I was able to install it using github but it didn't worked well, then I was facing problems with dlib and the face-recognition module.

So I tried the following and worked for me:

First Install Visual Studio and enable Desktop development with C++ (if the following steps don't work, is possible that you are missing a checkbox, I use VS 2022 and I checked the followings checkboxes1 checkboxes2 *I use it in Spanish but it shouldn't be difficult to follow it.

Then follow steps 1 to 3 from https://stackoverflow.com/a/49538054/14945612 (Download and Installation of CMake).

Finally using Python 3.9 (didn't work for me using 3.10 nor 3.11) install the following packages versions (it didn't work for me with newer ones):

pip install "cmake==3.21.4"

pip install -v "dlib==19.22.1"

pip install "face-recognition==1.3.0"

Check that you install them in your correct environment/interpreter. In my case I created a new conda environment with Python 3.9 and then use this new environment as my PyCharm Interpreter. That way I downgrade my Python.

Upvotes: 0

Related Questions