Python face_recognition won't install - python

I am trying to install the library for face_recognition. I keep getting the error "ERROR: CMake must be installed to build dlib" I've already installed CMake and dlib, and when I try and re-install it using pip I get a confirmation they are already installed. I also tried adding the library through the setting in PyCharm (where I can see both CMake and dlib are installed) and is still gives an error.
Does anyone know what I am missing?

Try to do RUN apt-get update && apt-get install -y cmake before the pip install.

Related

How to solve the Import Error of cv2 module

I know that there are many questions and answers regarding this.
But I couldn't solve it.
I get
ImportError: DLL load failed while importing cv2: The specified module could not be found.
I have
Windows 11,
Python 3.9.12
opencv-python and opencv-contrib-python 4.6.0.66
PyCharm IDE
I tried
installing Visual build tools
OpenCV Python library is an Interface to C++ library, so in order to run the code, you should install the CMake.
$ apt-get update && apt-get install -y cmake build-essential libgtk-3-dev libboost-all-dev
If you are trying to run it in docker, just change the $ to a RUN before install requirements.txt.
I hope this help you. Obs: I'm also using Windows 11 and WSL2. For me, it takes around 10 minutes to complete the apt and pip install, but worked for me.

Python failed building wheel for dlib Ubuntu

I am attempting to install dlib to my python virtual environment.
There is a very similar problem here and I followed the exact steps to no avail.
Somehow I am able to import dlib when running code and I managed to do that by git cloning git clone -b pybind11 https://github.com/supervacuus/dlib.git.
But when I attempt to install it pip3 install dlib or a library that depends on it such as pip3 install face_recognition I get errors stating that ERROR: Failed building wheel for dlib
Full execution logs and error here https://gist.github.com/GhettoBurger996/1e6a423b88b7435c8759255e19fa5e60
I am using 3.5.2 and Ubuntu 16.04
Question is a bit old but I ran into a similar problem where installing dlib using pip3 would fail.
Installing the following dependencies fixed it for me:
$ sudo apt-get install build-essential cmake
$ sudo apt-get install libgtk-3-dev
$ sudo apt-get install libboost-all-dev
From the posted error logs it seems that you had cmake installed already so the first line might not be necessary for you.

Python pip installation in ubuntu

I am new to Ubuntu and was trying to install pip using get-pip.py , when I received this message.
Requirement already up-to-date: pip in /usr/local/lib/python2.7/dist- packages/pip-8.1.2-py2.7.egg
But when I enter pip -V, I receive an error saying :
The 'pip==7.1.0' distribution was not found and is required by the application
Complete error
I was trying to install new packages using pip install <packagename> but this command gives the same error as previous .
I suggest installing pip using the package manager. Open up a terminal and enter
sudo apt-get install python-pip
That should install the pip ubunutu package.
You should not be installing pip for the default python installation, neither from the package manager nor using get-pip.py. So you can never use it to break the system python.
Instead always use virtualenv (created from the default/system python or from a newer version), activate and use pip in that environment.

Having trouble installing PyAudio for Python3 on Mint

I was following the instructions here and I'm having trouble getting the installation to work. Basically, the first part works fine. I downloaded portaudio, followed the instructions, and it all seemed to work.
However, when I triedpython3 setup.py install, I got an error. The error came from the /src/_portaudiomodule.c file, and it said that "The file Python.h could not be found". I don't really understand what's going on because there was no Python.h file when I extracted the PyAudio archive. I don't know where the Python.h file was supposed to come from.
I'm kind of a noob to unix systems so I could have easily made a mistake somewhere. I've been trying to solve this for hours and I've had no luck so far. Thanks in advance for your help!
To install the latest version of pyaudio using conda:
source activate -your environment name-
pip install pyaudio
You may run into the following error when installing from pip:
src/_portaudiomodule.c:29:23: fatal error: portaudio.h: No such file or directory
#include "portaudio.h"
compilation terminated.
error: command 'gcc' failed with exit status 1
That is because you don't have the PortAudio development package installed. Install it with:
sudo apt-get install portaudio19-dev
You don't need to compile pyaudio. To install PyAudio, run:
$ sudo add-apt-repository universe
$ sudo apt-get install python-pyaudio python3-pyaudio
The first command enables Universe Ubuntu repository.
If you want to compile it e.g., to use the latest version from git; install build dependencies:
$ sudo apt-get build-dep python-pyaudio python3-pyaudio
After that, you could install it from sources using pip:
$ python3 -mpip install pyaudio
Or to install the current version from git:
$ pip install -e git+http://people.csail.mit.edu/hubert/git/pyaudio.git#egg=pyaudio
Run pip commands inside a virtualenv or add --user command-line option, to avoid modifying the global python3 installation (leave it to the package manager).
I've tested it on Ubuntu. Let me know if it fails on Mint.
I have found the work arround for mac.
please refer the below steps to install pyaudio on python 3.5
Follow these steps :
export HOMEBREW_NO_ENV_FILTERING=1
xcode-select --install
brew update
brew upgrade
brew install portaudio
pip install pyaudio
I was able to get it install with anaconda, using this package.
Follow install instructions for linux here, then do:
conda install -c bokeh pyaudio=0.2.7
try to install using the the below command
pip install pyaudio
after that install the required Microsoft Visual C++ 14.0
refer the below image for the same.
and restart the system and run the same command again
pip install pyaudio
Python.h is nothing but a header file. It is used by gcc to build applications. You need to install a package called python-dev. This package includes header files, a static library and development tools for building Python modules, extending the Python interpreter or embedding Python in applications. To install this package, enter:
sudo apt-get install python3-dev

Install numpy in Python virtualenv

I've created virtualenv for Python 2.7.4 on Ubuntu 13.04. I've installed python-dev.
I have the error when installing numpy in the virtualenv.
Maybe, you have any ideas to fix?
The problem is SystemError: Cannot compile 'Python.h'. Perhaps you need to install python-dev|python-devel.
so do the following in order to obtain 'Python.h'
make sure apt-get and gcc are up to date
sudo apt-get update
sudo apt-get upgrade gcc
then install the python2.7-dev
sudo apt-get install python2.7-dev
and I see that you have most probably already done the above things.
pip will eventually spit out another error for not being able to write into /user/bin/blahBlah/dist-packages/ or something like that because it couldn't figure out that it was supposed to install your desiredPackage (e.g. numpy) within the active env (the env created by virtualenv which you might have even changed directory to while doing all this)
so do this:
pip -E /some/path/env install desiredPackage
that should get the job done... hopefully :)
---Edit---
From PIP Version 1.1 onward, the command pip -E doesn't work. The following is an excerpt from the release notes of version 1.1 (https://pip.pypa.io/en/latest/news.html)
Removed -E/--environment option and PIP_RESPECT_VIRTUALENV; both use a restart-in-venv mechanism that's broken, and neither one is useful since every virtualenv now has pip inside it. Replace pip -E path/to/venv install Foo with virtualenv path/to/venv && path/to/venv/pip install Foo
If you're on Python3 you'll need to do sudo apt-get install python3-dev. Took me a little while to figure it out.
If you're hitting this issue even though you've installed all OS dependencies (python-devel, fortran compiler, etc), the issue might be instead related to the following bug:
"numpy installation thru install_requires directive issue..."
Work around is to manually install numpy in your (virtual) environment before running setup.py to install whatever you want to install that depends on numpy.
eg, pip install numpy then python ./setup.py install
This answer is for those of us that compiled python from source or installed it to a non standard directory. In my case, python2.7 was installed to /usr/local and the include files were installed to /usr/local/include/python2.7
C_INCLUDE_PATH=/usr/local/include/python2.7:$C_INCLUDE_PATH pip install numpy
I recently had the same problem. I run Debian Jessie and tried to install numpy from a Python 2.7.9 virtualenv. I got the same error -- numpy complaining that Python.h is missing while python2.7-dev and gcc are already installed.
File "numpy/core/setup.py", line 42, in check_types
],
File "numpy/core/setup.py", line 293, in check_types
SystemError: Cannot compile 'Python.h'. Perhaps you need to install python-dev|python-devel.
I'm running pip 1.5.6 and it doesn't appear to have command line option '-E'
$ pip -V
pip 1.5.6 from /home/alex/.virtualenvs/myenv/local/lib/python2.7/site- packages (python 2.7)
Upgrading pip to the latest verson 7.0.3 solves the problem
$ pip install --upgrade pip
Downloading/unpacking pip from https://pypi.python.org/packages/py2.py3/p/pip/pip-7.0.3-py2.py3-none-any.whl#md5=6950e1d775fea7ea50af690f72589dbd
Downloading pip-7.0.3-py2.py3-none-any.whl (1.1MB): 1.1MB downloaded
Installing collected packages: pip
Found existing installation: pip 1.5.6
Uninstalling pip:
Successfully uninstalled pip
Successfully installed pip
Cleaning up...
Now it is possible to install numpy
$ pip install numpy
Collecting numpy
Downloading numpy-1.9.2.tar.gz (4.0MB)
100% |████████████████████████████████| 4.0MB 61kB/s
Installing collected packages: numpy
Running setup.py install for numpy
Successfully installed numpy-1.9.2
This is probably because you do not have the python-dev package installed. You can install it like this:
sudo apt-get install python-dev
You can also install it via the Software Center:
#samkhan13 solution didn't work for me as pip said it doesn't have the -E option.
I was still getting the same error, but what worked for me was to install matplotlib, which installed numpy.

Categories

Resources