I am on a mac os X Yosemite. I installed dlib with anaconda with:
conda install -c menpo dlib=19.4
and then removed X11 from anaconda/lib since the X11 distributed by anaconda is presumably broken. Then I installed Xquartz from https://www.xquartz.org/.
But when I go into ipython and import dlib, and type
dlib.image_window()
I am still getting error:
AttributeError: 'module' object has no attribute 'image_window'
What's the issue?
Note I tried installing dlib from scratch when anaconda is not in my system, and I ran into all kinds of other issues. So currently I am committed to making dlib work with anaconda, which it does, except for image_window and presumably other things associated with X11.
I ran into the same issue on my Mac. After doing readings on GitHub, I don't think there exists a workaround for installing dlib with anaconda, since something is not right with X11 headers used by anaconda.
I am able to make dlib.image_window() work after building dlib from source using the latest version available on the repo. The steps are large the same as suggested here on GitHub. The following steps were carried out in a conda environment I use exclusively for computer vision applications:
Clean up dlib installed via conda:
conda uninstall dlib
Install cmake and boost-bython with homebrew:
brew install cmake
brew install boost-python
Build dlib from source:
git clone https://github.com/davisking/dlib.git
cd dlib/
mkdir build
cd build/
cmake .. -DDLIB_USE_CUDA=0 -DUSE_AVX_INSTRUCTIONS=1; cmake --build .
python setup.py install --yes USE_AVX_INSTRUCTIONS --no DLIB_USE_CUDA
The codes took a while to build, but the library works for me in the end.
Related
I am new to PyCharm and trying some face recognition stuff. I need a face_recogniton library for my work which is installed using the following command (I'm using Ubuntu 18.04 as my OS):
pip install face_recognition
I am able to import it in python interpreter but it throws import error in PyCharm
ImportError: No module named 'face_recognition'.
Thanks for your effort in helping me.
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
Reading face_recognition installation guide on github, make sure you have dlib installed and then install face_recognition with:
pip3 install face_recognition
Also, check if PyCharm is using environment where you installed face_recognition. Maybe PyCharm created it's own virtual env and you are using it without face_recognition.
For more info about how to install module in PyCharm env, please check this answer, just except pygame check if face_recognition is listed. If not, install it.
Looks like you have installed maybe multiple versions of Python. You seem to have installed face_recognition for python version 2, whereas you are trying to access the module from Python version 3. You should consider using virtual environments and set up Python Interpreter accordingly.
Follow https://www.jetbrains.com/help/idea/configuring-local-python-interpreters.html on how to configure the interpreter.
Download this file cmake-3.17.0-rc3-win64-x64.msi from cmake.org and install it (By default it will be installed in C:\Program Files\CMake\bin).
After the installation copy this path and edit environment variable -> path -> paste that path -> click ok. Open the cmd and now use pip install face_recognition
i hope it should work....
I've tried several methods for installing Tensorflow (CPU-only) onto my Dragonboard 410c, and even though all other packages install just fine, Tensorflow installation always gives me the error tensorflow-1.3.0-... no matter whether I use pip or pip3.
Things I've checked for:
uname a outputs arm64 (64-bit)
pip -V && pip3 -V (both 10.0.1)
sudo apt-get update
Installing within a virtualenv
Installing using native pip
Installing using the links to the Tensorflow binaries
Even after ensuring all three of these were good, I can't install Tensorflow.
I'm trying to install Dlib in anaconda python with this line:
conda install -c menpo dlib
and I'm getting error like this:
UnsatisfiableError: The following specifications were found to be in conflict:
- dlib
- xlwt
Use "conda info <package>" to see the dependencies for each package.
How can I solve this problem?
Path of core-meta: C/users/{xxx}/anaconda3/core-meta
Delete core-meta then run the following commands:
Conda update --all
Conda install dlib
These commands require an internet connection so keep wifi on during the command running process.
Here xxx is the username on your computer.
If you do not need the xlwt-package for your project, just create a new conda environment and install the dlip package locally in that environment.
you can also try following:
brew install cmake
brew install boost
then create a virtual environment using conda command
conda create -n dlib python=3.6 anaconda
Activate the environment
source activate dlib
run the following command
conda install pip
and finally install dlib using below command
pip install dlib
This worked for me.
For anaconda or miniconda3, please see the following installation procedures. It will comply with Python 3.7 in this way.
1.Install cmake with git
$ sudo apt-get install git cmake
2. Enter into the the directory
Please change user to your own username
$ cd /home/user/dlib
3. Compile dlib
$ python setup.py install
If meeting with the issue that you could not put the import statements of setuptools behind the import statement of distutils, please change the placement oder in setup.py in the directory of dlib.
from setuptools import setup, Extension
from setuptools.command.build_ext import build_ext
from distutils import log
from distutils.version import LooseVersion
4. Run the dlib unit test suite in the current working directory
Please note there is a sub-directory of dlib inlcuded in the directory of dlib.
$ cd dlib/test
$ mkdir build
$ cd build
$ cmake ..
$ cmake --build . --config Release
$./dtest --runall
Cheers.
on mac system :
you have to do it via brew
brew install cmake
brew install boost
brew install boost-python --with-python3
After installing above packages if you need you can create your environment and proceed with dlib installation or you can simply run next step.
The dlib library doesn’t have any real Python prerequisites, but if you plan on using dlib for any type of computer vision or image processing, These are few libraries which you can install for dlib :
* NumPy
* SciPy
* scikit-image
pip install numpy
5 pip install Scipy
pip install scikit-image
pip install dlib
you can check for more details on this link:
https://www.pyimagesearch.com/2017/03/27/how-to-install-dlib/
You have to try by putting just:
conda install dlib
It seems the COCO PythonAPI only support python2. But peoples do use it in python3 environment.
I tried possible methods to install it, like
python3 setup.py build_ext --inplace
python3 setup.py install
But python3 setup.py install will fail due to coco.py and cocoeval.py containning python2 print function.
Update: solved by updating the COCO PythonAPI project. Leave this question for people facing the same issue.
Try the following steps:
Use git clone to clone the folder into your drive. In this case, it should be git clone https://github.com/cocodataset/cocoapi.git
Use terminal to enter the directory, or open a terminal inside the directory
Type in 2to3 . -w. Note that you might have to install a package to get 2to3. It is an elegant tool to convert code from Python2 to Python3; this code converts all .py files from Python2-compatible to Python3-compatible
Use terminal to navigate to the setup folder
Type in python3 setup.py install
This should help you install COCO or any package intended for Python2, and run the package using Python3. Cheers!
I have completed it with a simple step
pip install "git+https://github.com/philferriere/cocoapi.git#egg=pycocotools&subdirectory=PythonAPI"
** before that you need to install Visual C++ 2015 build tools on your path
Install
Instead of the official version (which has issues with python 3) use an alternative one. Install it on your local machine, globally (i.e., outside any virtual environment). You can do this by:
pip install git+https://github.com/philferriere/cocoapi.git#subdirectory=PythonAPI
Check if it is installed globally:
pip freeze | grep "pycocotools"
You should see something like pycocotools==2.0.0 in your output.
Now, inside your virtual-env (conda or whatever), first install numpy and cython (and maybe setuptools if it's not installed) using pip, and then:
pip install pycocotools
Verify
Inside your project, import (for example) from pycocotools import mask as mask and then print(mask.__author__). This should print out the author's name, which is tsungyi.
Where Is It?
The installed package, like any other packages that are locally installed inside a virtual-env using pip, will go to External Libraries of your project, under site-packages. That means it is now part of your virtual-env and not part of your project. So, other users who may want to use your code, must repeat this installation on their virtual-env as well.
Troubleshooting:
The main source of confusion is that either you did not install the required packages before installing cocoapi, or you did install the required packages but for a different python version. And when you want to check if something is installed, you may check with, for instance, python3.6 and see that it exists, but you are actually running all your commands with python3.7. So suppose you are using python3.7. You need to make sure that:
python -V gives you python3.7 and NOT other version, and pip -V gives you pip 19.2.3 from /home/<USER>/.local/lib/python3.7/site-packages/pip (python3.7), that actually matches with your default python version. If this is not the case, you can change your default python using sudo update-alternatives --config python, and following the one-step instruction.
All the required packages are installed using the right python or pip version. You can check this using pip and pip3 to stop any differences that may cause an issue:
pip freeze | grep "<SUBSTRING-NAME-OF-PACKAGE>" or pip show <PACKAGE-NAME> for more recent versions of pip.
To install the required packages, after you made sure about (1), you need to run:
sudo apt install python-setuptools python3.7-dev python3-wheel build-essential and pip install numpy cython matplotlib
Environment:
The above steps were tested on Ubuntu 18.4, python 3.6.8, pip 19.0.3.
If you are struggling building pycocotools on Ubuntu 20.04 and python3.7
try this:
sudo apt-get install -y python3.7-dev
python3.7 -m pip install pycocotools>=2.0.1
There are alternative versions of the cocoapi that you can download and use too (I'm using python 3.5). Here's a solution that you might want to try out: How to download and use object detection datasets (e.g. coco or pascal)
here's how i did successfully! (the reason is the gcc version)
install the dependencies: cython (pip install cython), opencv (pip install opencv-python)
check the gcc version by this command: gcc --version
your output will be like this 'Command 'gcc' not found, but can be installed with:
sudo apt install gcc
'
Type the below commands to install the gcc:
sudo apt update
sudo apt install build-essential
sudo apt-get install manpages-dev
now check again the gcc version(step2)
if you get below output
'gcc (Ubuntu 9.3.0-17ubuntu1~20.04) 9.3.0
Copyright (C) 2019 Free Software Foundation, Inc.
This is free software; see the source for copying conditions. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.'
now run the code for pycocotools installations:
pip install "git+https://github.com/philferriere/cocoapi.git#egg=pycocotools&subdirectory=PythonAPI"
finally wait check if the installation is successful :
'Successfully installed pycocotools-2.0'
I am new to deeplearning and face recognition. After searching, I found this python package about deeplearning applied to face recognition called OpenFace. From its documentation, I think it is build on top of Torch for the neural nets computation.
I want to install the package in a virtual environment, so basically these are steps I made:
brew install the necessary system requirements: bash,coreutils,curl,findutils,opencv, python and boost-python
Make a virtual environment and install dlib, numpy, scipy, pandas, scikit-learn, scikit-image
Cloned the openface github repository
Install Torch
curl -s https://raw.githubusercontent.com/torch/ezinstall/master/install-deps | bash
git clone https://github.com/torch/distro.git torch --recursive
cd torch
./install.sh
source install/bin/torch-activate
luarocks install csvigo
luarocks install dpnn
luarocks install nn
cd to cloned openface repo and run
python setup.py install
However when I run python:
>>>import openface
I get:
Segmentation Fault: 11
How do I fix this? Also, are there any other tutorials for using openface?
How to properly install OpenFace?
As I posted in the comments, this segfault was caused by compiling dlib with one Python version and running it with another. This was resolved by manually installing dlib rather than using their pip package.
I installed dlib with pip for openface and had no problem importing it for Python 2.7:
[jalal#goku scratch]$ sudo /usr/bin/pip install dlib
[sudo] password for jalal:
Collecting dlib
Downloading dlib-19.7.0.tar.gz (4.0MB)
100% |████████████████████████████████| 4.0MB 347kB/s
Installing collected packages: dlib
▽
Running setup.py install for dlib ... done
Successfully installed dlib-19.7.0
You are using pip version 8.1.2, however version 9.0.1 is available.
You should consider upgrading via the 'pip install --upgrade pip' command.