Whenever I try to install dlib using pip install dlib or pip3 install dlib, I get the following error message error
I have already downloaded cmake and cv2, and I have also added cmake bin to the environment variables, I am not sure what else I could do to get this working. My main point downloading dlib is to be able to use the face_recognition library.
Follow the article on the https://www.geeksforgeeks.org/how-to-install-dlib-library-for-python-in-windows-10/
Install CMake from its official website and make sure choose the right version according to your system configuration.
While installing CMake select Add CMake to the system PATH to avoid any error in the next steps.
Install the c++ compiler of the visual studio code community version.
Install cmake library pip install cmake.
Install dlib library pip install dlib.
I have installed Xcode and Homebrew. Then I have also installed the portaudio package using Homebrew brew install portaudio. After doing that, I have tried to install PyAudio.
I have tried all the following commands:
pip install pyaudio
python3 -m pip install pyaudio
conda install -c anaconda pyaudio
I am currently trying to install PyAudio on my Conda environment. I am using Miniconda on Macbook M1.
Is there any way to solve this, or if not how am I supposed to build the package and place it in my python site-packages??
Kindly Help.
I solved the issue by removing an unwanted urllib3 folder without METADATA inside my python site-packages folder. And then switched the terminal to run on Rosetta2 and It worked.
I want to start face recognition project on python. i installed bython and install pipenv. after this when I install " pipenv install face_recognition" shell give me a error after some installation.
(mrblack--PGk31eo) C:\Users\mrblack>
pipenv install face_recognition
Installing face_recognition…
Error: An error occurred while installing face_recognition!
Error text: Collecting face_recognition
RuntimeError: CMake must be installed to build the following extensions:_dlib_pybind11
Installation Failed
From http://dlib.net/compile.html :
Note that you need to have CMake and a working C++ compiler installed for this to work.
(Emphasize mine — phd)
Install CMake from https://cmake.org/download/ or https://pypi.org/project/cmake/. Try pip install cmake
For installing face-recognition module for Ubuntu 18.04: (Try for other OS, I used this for 18.04)
Install cmake: pip install cmake
After cmake is successfully installed
Optional: Install git if you don't have git
git clone https://github.com/davisking/dlib.git
build the main dlib library
cd dlib mkdir build; cd build; cmake ..; cmake --build .
Build and install python essentials
cd .. python3 setup.py install
After all this run these to verify
python3
import dlib
Now install face_recognition
pip3 install face_recognition
Takes some time but that is okay! I hope it worked for you
Refer these materials:
face-recognition original repo: https://github.com/ageitgey/face_recognition#installing-on-mac-or-linux
dlib: https://gist.github.com/ageitgey/629d75c1baac34dfa5ca2a1928a7aeaf
face_recognition package requires dlib and it is a very huge package and problematic in installation. I recommend you to adopt deepface package for face recognition. It is mainly based on Keras and TensorFlow. In other words, it is easy to make initial setup.
Besides, it wraps dlib and some other state-of-the-art face recognition models: VGG-Face (University of Oxford), FaceNet (Google), OpenFace (Carneige Mellon University), DeepFace (Facebook ) and DeepID (The Chienese University of Hong Kong). I recommend you to use VGG-Face or FaceNet models.
You should just pass image pairs as exact paths. BTW, you can pass base64 encoded images or direct numpy arrays as image pairs.
#!pip install deepface
from deepface import DeepFace
models = ['VGG-Face', 'Facenet', 'OpenFace', 'DeepFace', 'DeepID']
result = DeepFace.verify("img1.jpg", "img2.jpg", model_name = models[0])
print(result["verified"])
Result object stores the found distance and required distance threshold to verify an image pair.
I was getting the same error when I tried it. I resolved it by degrading to python3.7.
So follow these steps :
degrade or upgrade to python3.7
pip3 install CMake
pip3 install face-recognition
these steps will resolve the error but after that when I was using the library in my code it was again giving an error related to algorithmia.
So I resolved it by downloading visual studio 2017
Hope it was helpful,
Thanks
I had the same error this worked for me:
You have to install make and dlib before installing face recognition.
pip3 install cmake
pip3 install dlib
pip3 install face-recognition
If this doesn't work you could use Visual Studio Code as idle.
I need to install cv2 for a script that has been written for me. I tried pip install cv2 and pip install open_cv and got the same problem - a warning message from dist.py and complains about zlib being not found. No cv2 installed. I also tried pyopenvc and pip install opencv-python.
So, I went to the opencv site and downloaded the relevant exe. Ran it - generated a heap of subdirectories and a make file and stuff.
What do I do now?
Install opencv-python (which is an unofficial pre-built OpenCV package for Python) by issuing the following command:
pip install opencv-python
run the following command by creating a virtual enviroment using python 3 and run
pip3 install opencv-python
to check it has installed correctly run
python3 -c "import cv2"
In pip package management, there are 4 different OpenCV packages all using the same namespace, cv2. Although they are not officially supported by OpenCV.org, they are commonly used in developers' community. You could install any of them using the following command:
pip install PACKAGE_NAME
where PACKAGE_NAME can be
opencv-python (only contains main modules)
opencv-contrib-python (contains both main and contrib modules)
opencv-python-headless (same as opencv-python but without GUI functionality)
opencv-contrib-python-headless (same as opencv-contrib-python but without GUI functionality)
You should only install one of them depending on your needs. If you accidentally installed multiple of them in the same environment, you can remove them using pip uninstall before installing the correct one again.
For more details, you can refer to the project description of OpenCV on Wheels.
As of 2021, all of these 4 packages are official OpenCV projects. Source: OpenCV Website.
To Install the Current Latest version of OpenCV then use the below commands:
Use this Command:
pip install --upgrade opencv-python
If you're facing problem in above command then try this :
pip install --upgrade opencv-contrib-python
To check the version of installed OpenCV:
import cv2
print(cv2.__version__)
Simply use this for the so far latest version 4.1.0.
pip install opencv-contrib-python==4.1.0.25
For the default version use this:
pip install opencv-contrib-python
If you have a new Raspberry Pi and want to install OpenCV then this tutorial would be a good choice.
For Ubuntu/Linux users:
sudo apt install python3-opencv
As of 10/22/2019, I think the best answer is simply
conda install opencv
It appears opencv is now in the main Anaconda channel.
To see which packages (including opencv) are in the main Anaconda channel go to Anaconda Package Lists and follow the link corresponding to your python version and os version.
Everybody struggles initially while installing OpenCV. OpenCV requires a lot of dependencies in the backend. The best way to start with OpenCV is, install it in a virtual environment. I suggest that you use the Python Anaconda distribution and create a virtual environment using it. Then inside the virtual environment, you can install OpenCV using this command:
conda install -c conda-forge opencv
Please follow the command:
pip install opencv-python
then if you want to use:
import cv2
If it's not worked due to any update, please follow the documentation
Make a virtual enviroment using python3
virtualenv env_name --python="python3"
and run the following command
pip3 install opencv-python
to check it has installed correctly run
python3 -c "import cv2"
To install open_cv you can go to this website or do this,
pip install opencv-contrib-python --upgrade
pip install opencv-python
You can test it by:
C:\> python
>>> import cv2
>>> print(cv2.__version__)
'4.5.1' # your version may be a newer one
You can install opencv the normal way:
pip install opencv-python
If you are getting errors, you can do this:
pip install opencv-python-headless
Open anaconda command prompt and type in below command.
conda install -c conda-forge opencv
Once the 'Solving environment' is done. It will ask to download dependencies. Type 'y'.
It will install all the dependencies and then you are ready to code.
I recommend this for Python 3: Please install it this way with pip
pip3 install opencv-python
This will download and install the latest version of OpenCV.
You could try using below command-
pip install opencv-contrib-python
It will basically download the compatible version. If this command fails, you could upgrade you pip using below command-
python -m pip install –upgrade pip
If you need a pictorial guide, head over to Simple Steps to Install OpenCV in Windows
You can also try installing OpenCV from prebuilt binaries from the official OpenCV site.
->pip install opencv-python you can use this.
But if this code does not working then you can check python version on cmd and anaconda because they are different. So you type command in anaconda prompt and cmd, it will work. You can check this -> pip list
Open terminal
Run the following command
pip install --trusted-host=pypi.org --trusted-host=files.pythonhosted.org opencv-python.
Hope it will work.
Installing cv2 or opencv-python using pip is sometimes a problem. I was having the same problem of installing cv2 with pip. The installation wasn't a problem the problem was to import cv2 after installation. I was getting an Import Error so to fix this i import main from pip to install opencv-python. Try to run the following code in your python file then opencv-python will be installed
from pip._internal import main as install
try:
import cv2
except ImportError as e:
install(["install", "opencv-python"])
finally:
pass
I hope this will help someone
As a reference it might help someone... On Debian system I hard to do the following:
apt-get install -y libsm6 libxext6 libxrender-dev
pip3 install opencv-python
python3 -c "import cv2"
On Ubuntu you can install it for the system Python with
sudo apt install python3-opencv
if you are using Pycharm navigate settings > Project:name > Project interpreter just search the module by name(in this case OpenCV-python) and install it. worked for me
In case you use aarch64 platform with ARM64 cpu - and/or docker
On a development board on ARM64, no python-opencv version were found at all
version: NONE.
I've had to build from source. This allowed to include CUDA support.
In my case it was already available on the board but it wasn't found on the development environment.
If compiling from source is out of reach, there are Dockers
Of course compiling will take some time (few hours on ARM core), but it is worthy process to know as most open source tools can be built this way in case of issues.
I've had this problem in Google Colab, It only worked with this specific package version.
!pip install "opencv-python-headless<4.3"
There are two options-
pip install cv2
or
pip install opencv-python
Hope it helps.
I am trying to install dlib library for my django project on my mac (macos 10.13.1), however i have this failure. I am using pip install dlib
below is the full execution with error
https://gist.github.com/axilaris/af361e54bd78a11fc35fc5029de69caa
Maybe you need to install Boost before trying to install the dlib library.
The simplest way is to download MacPorts, and run the following command:
sudo port install boost
I edited my post because I think I provided the wrong link.