Dlib: Mac dlib run error

Created on 15 Mar 2019  路  12Comments  路  Source: davisking/dlib

OS X version: 10.14.2
python version: 3.6.2
dlib version: 19.17.0
boost version: boost: stable 1.68.0 (bottled), HEAD
boost-python3: stable 1.68.0 (bottled), HEAD
GCC 4.2.1 Compatible Apple LLVM 9.1.0 (clang-902.0.39.2)

I install dlib by:

  • brew cask install xquartz
  • brew install gtk+3 boost
  • brew install boost-python3

and i make virtualenv.
pip install dlib.
intsall successfully.
But when i run
import dlib
get this:

  File "<stdin>", line 1, in <module>
ImportError: dlopen(/usr/local/lib/python3.6/site-packages/dlib.cpython-36m-darwin.so, 2): Symbol not found: _png_set_longjmp_fn
  Referenced from: /usr/local/lib/python3.6/site-packages/dlib.cpython-36m-darwin.so
  Expected in: flat namespace
 in /usr/local/lib/python3.6/site-packages/dlib.cpython-36m-darwin.so

can you tell me how to deal this problem?

By the way, my brew gcc is /usr/local/Cellar/gcc/8.3.0.
I don't know whether this affect .

Most helpful comment

I also just pushed a change to github that will cause cmake to build a little test program to see if the system copy of libpng actually works. If it doesn't it will automatically do the right thing now.

All 12 comments

Uninstall libpng. Brew probably installed a broken copy of it. Then reinstall dlib.

i tried, i run brew reinstall libpng for several times.
And my libpng version is libpng: stable 1.6.36 (bottled), HEAD.
And i run ln -s /usr/local/Cellar/libpng/1.6.36/lib/libpng16.16.dylib /usr/local/lib/libpng16.16.dylib
But it still doesn't work..

Don鈥檛 reinstall. Delete

I tried, i run:

  • rm -r /usr/local/Cellar/libpng/
  • rm /Users/fjl2401/Library/Caches/Homebrew/downloads/b401f5b07a537975da7de448c4bbdaf0c2112d5dc7d8e0955e0d4fb938909010--libpng-1.6.36.mojave.bottle.tar.gz
  • brew uninstall --ignore-dependencies libpng
  • brew reinstall dlib
  • pip3 uninstall dlib
  • pip3 install dlib
    but it still don't work.
    And after install:
    Warning: This keg was marked linked already, continuing anyway

No. Do not install libpng from brew. Entirety remove it. Don鈥檛 reinstall. Make your computer not have libpng on it.

yeah...I rm libpng, but when i use brew to reinstall dlib. It will install libpng as dependency automatically.
I rm libpng, and pip reinstall dlib. It shows the same error:

>>> import dlib
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
ImportError: dlopen(/usr/local/lib/python3.6/site-packages/dlib.cpython-36m-darwin.so, 2): 
Symbol not found: _png_set_longjmp_fn
  Referenced from: /usr/local/lib/python3.6/site-packages/dlib.cpython-36m-darwin.so
  Expected in: flat namespace
 in /usr/local/lib/python3.6/site-packages/dlib.cpython-36m-darwin.so

Does it mean i haven't rm libpng on my computer totally? Now my brew have dlib, don't have libpng.
My python3 have dlib.

Don鈥檛 brew install anything, especially dlib. Brew is broken. Pip install dlib after removing libpng.

Thank you very much ! i rm all lib about libpng on my computer. And i run import dlib in python.
And it shows can't find libpng.lib from php5...
So... i think i find the reason. I rm all libpng in /usr/local/lib and rm -rf /usr/local/php5-5.6.31-20170817-164511 and pip install dlib --no-cache .After setup.py build a long time. It works well ! Thank you very much.

I also just pushed a change to github that will cause cmake to build a little test program to see if the system copy of libpng actually works. If it doesn't it will automatically do the right thing now.

Also just added checks like this for libjpeg. Hopefully this fixes this kind of issue forever. The previous checks were less robust. Can you try installing the latest dlib from github? It should work, even if you brew install libpng first.

i installed use pip: pip install git+https://github.com/davisking/dlib.git and Successfully installed dlib-19.17.99. And i run my script, it works well.

Sweet, thanks for testing it.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

AeroClassics picture AeroClassics  路  4Comments

vijaysagi picture vijaysagi  路  5Comments

mohsin512 picture mohsin512  路  5Comments

maromcik picture maromcik  路  4Comments

yourmailhacked picture yourmailhacked  路  3Comments