3
votes

I followed this tutorial to install dlib but when I run pip install dlib I get

Collecting dlib

Using cached dlib-19.4.0.tar.gz Building wheels for collected packages: dlib

Running setup.py bdist_wheel for dlib ... error

Complete output from command /home/leo/.virtualenvs/py3_dlib_tutorial/bin/python3 -u -c "import setuptools, tokenize;file='/tmp/pip-build-4luevi_i/dlib/setup.py';f=getattr(tokenize, 'open', open)(file);code=f.read().replace('\r\n', '\n');f.close();exec(compile(code, file, 'exec'))" bdist_wheel -d /tmp/tmpv2rhc6cbpip-wheel- --python-tag cp36:

running bdist_wheel

running build

Detected Python architecture: 64bit

Detected platform: linux

Configuring cmake ...

/usr/bin/cmake: /home/leo/anaconda3/lib/libcurl.so.4: no version information available (required by /usr/bin/cmake)

/usr/bin/cmake: /home/leo/anaconda3/lib/libstdc++.so.6: version `CXXABI_1.3.9' not found (required by /usr/bin/cmake)

/usr/bin/cmake: /home/leo/anaconda3/lib/libstdc++.so.6: version `GLIBCXX_3.4.20' not found (required by /usr/bin/cmake)

/usr/bin/cmake: /home/leo/anaconda3/lib/libstdc++.so.6: version `GLIBCXX_3.4.21' not found (required by /usr/bin/cmake)

/usr/bin/cmake: /home/leo/anaconda3/lib/libstdc++.so.6: version `GLIBCXX_3.4.21' not found (required by /usr/lib/x86_64-linux-gnu/libjsoncpp.so.1)

error: cmake configuration failed!

any suggestions how to fix that?

Update

I'm using ubuntu 16.04

also what I've noticed is when I run sudo pip install dlib it works but then I get

 (py3_dlib_tutorial) ~$ python
Python 3.6.0 |Continuum Analytics, Inc.| (default, Dec 23 2016, 12:22:00) 
[GCC 4.4.7 20120313 (Red Hat 4.4.7-1)] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import dlib
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
ModuleNotFoundError: No module named 'dlib'

Update

Seems like a fix prior to this caused the error

I disabled this line in my .bashrc

export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/home/leo/anaconda3/lib

which was necessery to make mkvirtualenv work. Now pip install dlib worked but I still get a similar error

python
Python 3.6.0 |Anaconda custom (64-bit)| (default, Dec 23 2016, 12:22:00)
[GCC 4.4.7 20120313 (Red Hat 4.4.7-1)] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import dlib
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/home/leo/anaconda3/lib/python3.6/site-packages/dlib/__init__.py", line 1, in <module>
    from .dlib import *
ImportError: /home/leo/anaconda3/bin/../lib/libstdc++.so.6: version `GLIBCXX_3.4.21' not found (required by /usr/lib/x86_64-linux-gnu/libboost_python-py35.so.1.58.0)
1
have you installed dlib prerequisites? and what os are you using?tso
if you allready installed prerequisites, try install boost python. sudo apt install libboost-all-dev and and after that, try pip install dlibtso
libboost-all-dev is already the newest version (1.58.0.1ubuntu1) that was already installed...Brucie Alpha
what is your cmake version?tso
with cmake --version i get the same error but sudo apt-get install cmake says cmake is already the newest version (3.5.1-1ubuntu3).Brucie Alpha

1 Answers

1
votes

To resolve this error:

python
Python 3.6.0 |Anaconda custom (64-bit)| (default, Dec 23 2016, 12:22:00)
[GCC 4.4.7 20120313 (Red Hat 4.4.7-1)] on linux 
Type "help", "copyright", "credits" or "license" for more information.
>>> import dlib
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/home/leo/anaconda3/lib/python3.6/site-packages/dlib/__init__.py", line 1, in <module>
from .dlib import *
ImportError: /home/leo/anaconda3/bin/../lib/libstdc++.so.6: version     `GLIBCXX_3.4.21' not found (required by /usr/lib/x86_64-linux-
gnu/libboost_python-py35.so.1.58.0)

You need to move from Python 3.6 to Python 3.5. If you are using anaconda, it can be done by setting a new environment:

conda create -env_name python=3.5 anaconda
activate env_name
conda install -c menpo dlib 

This should work and you will have your dlib working fine.