Not able to install dlib on Windows 10 and Python 3.7
I tried so many things to work with the latest version of Anaconda which is Python 3.7. However, I was unable to do so. Because none of the .whl file were compatible with Python 3.7, but with Python 3.6. So, I followed the link to downgrade the Python version to 3.6. This way spyder as well as Python would be downgraded to the 3.6 version. Once I had done so, I installed OpenCV using the below commands.
pip install opencv-python
pip install opencv-contrib-python
I installed dlib using the following command.
pip install dlib-19.8.1-cp36-cp36m-win_amd64.whl
This successfully installed the latest version of dlib.
To check if everything got installed properly, the commands I used and the output I got on Anaconda prompt was as follows.
(py36) C:\Users\dbi227> python
Python 3.6.9 |Anaconda, Inc.| (default, Jul 30 2019, 14:00:49) [MSC v.1915 64 bit (AMD64)] on win32
Type "help", "copyright", "credits" or "license" for more information.
>>> import cv2
>>> cv2.__version__
'4.1.1'
>>> import dlib
>>> dlib.__version__
'19.8.1'
It is important to check if your iPython installation is also downgraded to 3.6 or not. For that, I got an option spyder(py36) apart from spyder(anaconda3) on my start option. Make sure you click on spyder(py36). Because that is the one where the libraries are installed. To check it, you can just type:
import cv2
import dlib
If these commands do not show any error, then the libraries are correctly installed.
Installation of dlib with pip fails on Windows 10
Here I got the error that line
CMake Error: CMAKE_C_COMPILER not set, after EnableLanguage
CMake Error: CMAKE_CXX_COMPILER not set, after EnableLanguage
set CMake path into environment variable (As Shown in Figure)
Installing Visual Studio build tool latest version
link: https://visualstudio.microsoft.com/downloads/#build-tools-for-visual-studio-2017- after installing the Visual studio build tool select the package which needed and download it.
- after download & installing successfully visual studio install
dlib
by commanding in CMD(ADMINISTRATOR)pip install dlib
DLIB library installation error through pip
As you are using Anaconda Navigator, the IDLE will be either Jupyter Notebook or Spyder. DLIB is a regular upgrading library for facial recognition. It cannot be installed on the base environment. @Avinash mentioned regarding two more libraries cmake and face_recognition the major issue for is DLIB.
Follow the below steps to install DLIB using Anaconda Navigator
Open Anaconda Navigator or Open Anaconda Prompt
Click on Environments (For anaconda navigator UI)
Click on "Create" and to create a new environment (For anaconda navigator UI)
Select the python version. (For anaconda navigator UI)
Click on create. (For anaconda navigator UI)
Open anaconda navigator
Enter the following command to navigate from base environment to virtual environment just created
Enter the following command to install DLIB
If you are using normal Python IDLE, use the following procedure.
- Virtual Environment creation using command prompt
Syntax: python3 -m venv [Virtual Environment Name]
Code: python3 -m venv dlib
- Activate Virtual Environment
Syntax: .\[Virtual Environment Folder Name]\Scripts\activate
Code: .\dlib\Scripts\activate
or you can directly mention as
activate dlib
Finally you will be shifter from base environment to virtual environment
Deactivating virtual environment
deactivate
If you are not having proper UI access, then directly go to Anaconda Navigator and use the below command for virtual environment creation.
Open Anaconda Prompt
Check for conda installed in path
conda -V
Check if conda is updated or not
conda update conda
Create a virtual environment
syntax: conda create --name [Virtual Environment Name] python=[Version you want to install]
code: conda create --name dlib python=3.8
Installing DLIB in virtual environment.
pip install dlib
remaining activating and deactivating are same.
Related Topics
How to Change Dataframe Column Names in Pyspark
How to Find Where Python Is Installed on Windows
Make Requests Using Python Over Tor
Appending to an Empty Dataframe in Pandas
How to Generate Circular Thumbnails with Pil
Escape Special Characters in a Python String
How Many Concurrent Requests Does a Single Flask Process Receive
Django Datetime Issues (Default=Datetime.Now())
Print All Day-Dates Between Two Dates
Basic Python Client Socket Example
In Python, How to Index a List with Another List
How to Check If a Value Exists in a Dictionary
Import a Python Module Without the .Py Extension
Set Up Python on Windows to Not Type "Python" in Cmd
Replace All Occurrences of a String in a Pandas Dataframe (Python)