How to install dlib for python3 in Ubuntu 14.04
Found solution by myself but thanks @edwinksl for his tip.
In order to install dlib
for python3 it's better to use pip
:
pip install dlib
You will need boost python. To get it:
sudo apt-get install libboost-all-dev
If you have "Could NOT find PythonLibs (missing: PYTHON_LIBRARIES) (Required is at least version "3.4")" error make sure you have cmake > 2.8 (In my case it is 3.2.2). To install cmake > 2.8:
sudo add-apt-repository ppa:george-edison55/cmake-3.x
sudo apt-get update
sudo apt-get install cmake
That solved the issue for me.
Related videos on Youtube
Comments
-
wasd over 1 year
I'm following this guide https://cmusatyalab.github.io/openface/setup/ of installation. I did:
mkdir -p ~/src cd ~/src tar xf dlib-19.1.0.tar.gz cd dlib-19.1.0/python_examples mkdir build cd build cmake ../../tools/python cmake --build . --config Release sudo cp dlib.so /usr/local/lib/python3.4/dist-packages/
It says that at this point I should be able to run
import dlib
, but if I run it from virtualenv gives meImportError: No module named dlib
If I run it outside from virtualenv it gives:
ImportError: dynamic module does not define init function (PyInit_dlib)
What am I doing wrong? How to install dlib for python?
UPD: I've tried same for Python2:
sudo cp dlib.so /usr/local/lib/python2.7/dist-packages/
and it worked for python2. So how to do the same for python3?
-
steeldriver over 7 yearsAre you aware that (at least by default)
python
ispython2
on Ubuntu 14.04? Are you trying toimport dlib
frompython
or frompython3
? -
wasd over 7 yearsSure, I tried both python2 and python3, but still no effect
-
edwinksl over 7 years@wasd You said you are trying to run it from a virtualenv? Then you can just activate the virtualenv and use
pip
to installdlib
. Or if yo havedlib
installed globally, you can create a virtualenv with the--system-site-packages
option. -
wasd over 7 years@edwinksl If I try to install dlib with pip it gives
CMake Error at /usr/share/cmake-2.8/Modules/FindPackageHandleStandardArgs.cmake:108 (message): Could NOT find PythonLibs (missing: PYTHON_LIBRARIES) (Required is at least version "3.4")
-
-
edwinksl over 7 yearsAwesome, I hadn't noticed
cmake
was only at version 2.8 in Ubuntu 14.04.