davisking / dlib

A toolkit for making real world machine learning and data analysis applications in C++
http://dlib.net
Boost Software License 1.0
13.5k stars 3.37k forks source link

Error while running a program #2915

Closed anshtyagi0 closed 6 months ago

anshtyagi0 commented 8 months ago

What Operating System(s) are you seeing this problem on?

macOS (Apple Silicon)

dlib version

19.24.2

Python version

3.9.6

Compiler

I did pip install

Expected Behavior

I am making a face recognition program so it should work according .

Current Behavior

It showed me an error.

(.venv) anshtyagi@MacBook-Air facereco % /Users/anshtyagi/Documents/facereco/.venv/bin/python /Users/anshtyagi/Documents/facereco/main.py
Traceback (most recent call last):
  File "/Users/anshtyagi/Documents/facereco/main.py", line 2, in <module>
    import face_recognition
  File "/Users/anshtyagi/Documents/facereco/.venv/lib/python3.9/site-packages/face_recognition/__init__.py", line 7, in <module>
    from .api import load_image_file, face_locations, batch_face_locations, face_landmarks, face_encodings, compare_faces, face_distance
  File "/Users/anshtyagi/Documents/facereco/.venv/lib/python3.9/site-packages/face_recognition/api.py", line 4, in <module>
    import dlib
  File "/Users/anshtyagi/Documents/facereco/.venv/lib/python3.9/site-packages/dlib/__init__.py", line 19, in <module>
    from _dlib_pybind11 import *
ImportError: dlopen(/Users/anshtyagi/Documents/facereco/.venv/lib/python3.9/site-packages/_dlib_pybind11.cpython-39-darwin.so, 0x0002): symbol not found in flat namespace '_DGifCloseFile'

Steps to Reproduce

Don't know

Anything else?

No response

pfeatherstone commented 8 months ago

Can you provide a reproducible example?

anshtyagi0 commented 8 months ago

you mean the code?

davisking commented 8 months ago

This is a problem some people run into, it's not related to dlib, but rather there is a broken copy of libgif on your system and dlib is trying to use it. Try grabbing the code from https://github.com/davisking/dlib/pull/2912 and installing from that with python setup.py install. That new cmake setup might realize to avoid the broken libgif. Let us know if that doesn't work and I'll tell you another way to definitely avoid it :)

anshtyagi0 commented 8 months ago

it says libgif not found while removing

davisking commented 8 months ago

I'm not sure what you mean by that. Post the output text of what you did.

anshtyagi0 commented 8 months ago
Screenshot 2024-02-21 at 9 16 20 PM
arrufat commented 8 months ago

@anshtyagi0 isn't it called giflib, at least that's what's called on Linux.

davisking commented 8 months ago

No I mean, get a copy of dlib from the git branch in https://github.com/davisking/dlib/pull/2912. Then do python setup.py install after first removing whatever copy of dlib you have. And then paste in what happens.

anshtyagi0 commented 8 months ago

ok so while installing using GitHub I got this:

[100%] Linking CXX shared module /Users/anshtyagi/Documents/facereco/dlib/build/lib.macosx-10.9-universal2-cpython-311/_dlib_pybind11.cpython-311-darwin.so
[100%] Built target _dlib_pybind11
creating build/bdist.macosx-10.9-universal2/egg
copying build/lib.macosx-10.9-universal2-cpython-311/_dlib_pybind11.cpython-311-darwin.so -> build/bdist.macosx-10.9-universal2/egg
creating build/bdist.macosx-10.9-universal2/egg/dlib
copying build/lib.macosx-10.9-universal2-cpython-311/dlib/__init__.py -> build/bdist.macosx-10.9-universal2/egg/dlib
byte-compiling build/bdist.macosx-10.9-universal2/egg/dlib/__init__.py to __init__.cpython-311.pyc
creating stub loader for _dlib_pybind11.cpython-311-darwin.so
byte-compiling build/bdist.macosx-10.9-universal2/egg/_dlib_pybind11.py to _dlib_pybind11.cpython-311.pyc
creating build/bdist.macosx-10.9-universal2/egg/EGG-INFO
copying tools/python/dlib.egg-info/PKG-INFO -> build/bdist.macosx-10.9-universal2/egg/EGG-INFO
copying tools/python/dlib.egg-info/SOURCES.txt -> build/bdist.macosx-10.9-universal2/egg/EGG-INFO
copying tools/python/dlib.egg-info/dependency_links.txt -> build/bdist.macosx-10.9-universal2/egg/EGG-INFO
copying tools/python/dlib.egg-info/not-zip-safe -> build/bdist.macosx-10.9-universal2/egg/EGG-INFO
copying tools/python/dlib.egg-info/top_level.txt -> build/bdist.macosx-10.9-universal2/egg/EGG-INFO
writing build/bdist.macosx-10.9-universal2/egg/EGG-INFO/native_libs.txt
creating 'dist/dlib-19.24.99-py3.11-macosx-10.9-universal2.egg' and adding 'build/bdist.macosx-10.9-universal2/egg' to it
removing 'build/bdist.macosx-10.9-universal2/egg' (and everything under it)
Processing dlib-19.24.99-py3.11-macosx-10.9-universal2.egg
removing '/Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/site-packages/dlib-19.24.99-py3.11-macosx-10.9-universal2.egg' (and everything under it)
creating /Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/site-packages/dlib-19.24.99-py3.11-macosx-10.9-universal2.egg
Extracting dlib-19.24.99-py3.11-macosx-10.9-universal2.egg to /Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/site-packages
dlib 19.24.99 is already the active version in easy-install.pth

Installed /Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/site-packages/dlib-19.24.99-py3.11-macosx-10.9-universal2.egg
Processing dependencies for dlib==19.24.99
Searching for dlib==19.24.99
Reading https://pypi.org/simple/dlib/
Download error on https://pypi.org/simple/dlib/: [SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: unable to get local issuer certificate (_ssl.c:1002) -- Some packages may not be found!
Couldn't retrieve index page for 'dlib'
Scanning index of all packages (this may take a while)
Reading https://pypi.org/simple/
Download error on https://pypi.org/simple/: [SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: unable to get local issuer certificate (_ssl.c:1002) -- Some packages may not be found!
No local packages or working download links found for dlib==19.24.99
error: Could not find suitable distribution for Requirement.parse('dlib==19.24.99')
davisking commented 8 months ago

Looks like you already have dlib installed. Try uninstalling it first. pip uninstall dlib.

anshtyagi0 commented 8 months ago

I already did that:

anshtyagi@MacBook-Air dlib % python setup.py install
running install
/Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/site-packages/setuptools/command/install.py:34: SetuptoolsDeprecationWarning: setup.py install is deprecated. Use build and pip and other standards-based tools.
  warnings.warn(
/Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/site-packages/setuptools/command/easy_install.py:144: EasyInstallDeprecationWarning: easy_install command is deprecated. Use build and pip and other standards-based tools.
  warnings.warn(
running bdist_egg
running egg_info
writing tools/python/dlib.egg-info/PKG-INFO
writing dependency_links to tools/python/dlib.egg-info/dependency_links.txt
writing top-level names to tools/python/dlib.egg-info/top_level.txt
reading manifest file 'tools/python/dlib.egg-info/SOURCES.txt'
reading manifest template 'MANIFEST.in'
no previously-included directories found matching 'tools/python/build*'
no previously-included directories found matching 'dlib/cmake_utils/*/build*'
warning: no previously-included files matching '*.pyc' found anywhere in distribution
adding license file 'LICENSE.txt'
writing manifest file 'tools/python/dlib.egg-info/SOURCES.txt'
installing library code to build/bdist.macosx-10.9-universal2/egg
running install_lib
running build_ext
Building extension for Python 3.11.4 (v3.11.4:d2340ef257, Jun  6 2023, 19:15:51) [Clang 13.0.0 (clang-1300.0.29.30)]
Invoking CMake setup: 'cmake /Users/anshtyagi/Documents/facereco/dlib/tools/python -DCMAKE_LIBRARY_OUTPUT_DIRECTORY=/Users/anshtyagi/Documents/facereco/dlib/build/lib.macosx-10.9-universal2-cpython-311 -DPYTHON_EXECUTABLE=/usr/local/bin/python3 -DCMAKE_BUILD_TYPE=Release'
CMake Deprecation Warning at /Users/anshtyagi/Documents/facereco/dlib/dlib/external/pybind11/CMakeLists.txt:8 (cmake_minimum_required):
  Compatibility with CMake < 3.5 will be removed from a future version of
  CMake.

  Update the VERSION argument <min> value or use a ...<max> suffix to tell
  CMake that the project does not need compatibility with older versions.

-- pybind11 v2.10.0 
CMake Warning (dev) at /Users/anshtyagi/Documents/facereco/dlib/dlib/external/pybind11/tools/FindPythonLibsNew.cmake:98 (find_package):
  Policy CMP0148 is not set: The FindPythonInterp and FindPythonLibs modules
  are removed.  Run "cmake --help-policy CMP0148" for policy details.  Use
  the cmake_policy command to set the policy and suppress this warning.

Call Stack (most recent call first):
  /Users/anshtyagi/Documents/facereco/dlib/dlib/external/pybind11/tools/pybind11Tools.cmake:50 (find_package)
  /Users/anshtyagi/Documents/facereco/dlib/dlib/external/pybind11/tools/pybind11Common.cmake:180 (include)
  /Users/anshtyagi/Documents/facereco/dlib/dlib/external/pybind11/CMakeLists.txt:200 (include)
This warning is for project developers.  Use -Wno-dev to suppress it.

-- Using CMake version: 3.28.3
-- Compiling dlib version: 19.24.99
-- SSE4 instructions can be executed by the host processor.
-- Found system copy of libpng: /usr/local/lib/libpng.dylib;/Library/Developer/CommandLineTools/SDKs/MacOSX14.2.sdk/usr/lib/libz.tbd
-- Found system copy of libjpeg: /usr/local/lib/libjpeg.dylib
-- Searching for BLAS and LAPACK
-- Searching for BLAS and LAPACK
-- Checking for module 'cblas'
--   No package 'cblas' found
-- Checking for module 'lapack'
--   No package 'lapack' found
-- Found OpenBLAS library
-- Found LAPACK library
-- Configuring done (9.3s)
-- Generating done (0.0s)
-- Build files have been written to: /Users/anshtyagi/Documents/facereco/dlib/build/temp.macosx-10.9-universal2-cpython-311
Invoking CMake build: 'cmake --build . --config Release -- -j4'
[ 69%] Built target dlib
[100%] Built target _dlib_pybind11
creating build/bdist.macosx-10.9-universal2/egg
copying build/lib.macosx-10.9-universal2-cpython-311/_dlib_pybind11.cpython-311-darwin.so -> build/bdist.macosx-10.9-universal2/egg
creating build/bdist.macosx-10.9-universal2/egg/dlib
copying build/lib.macosx-10.9-universal2-cpython-311/dlib/__init__.py -> build/bdist.macosx-10.9-universal2/egg/dlib
byte-compiling build/bdist.macosx-10.9-universal2/egg/dlib/__init__.py to __init__.cpython-311.pyc
creating stub loader for _dlib_pybind11.cpython-311-darwin.so
byte-compiling build/bdist.macosx-10.9-universal2/egg/_dlib_pybind11.py to _dlib_pybind11.cpython-311.pyc
creating build/bdist.macosx-10.9-universal2/egg/EGG-INFO
copying tools/python/dlib.egg-info/PKG-INFO -> build/bdist.macosx-10.9-universal2/egg/EGG-INFO
copying tools/python/dlib.egg-info/SOURCES.txt -> build/bdist.macosx-10.9-universal2/egg/EGG-INFO
copying tools/python/dlib.egg-info/dependency_links.txt -> build/bdist.macosx-10.9-universal2/egg/EGG-INFO
copying tools/python/dlib.egg-info/not-zip-safe -> build/bdist.macosx-10.9-universal2/egg/EGG-INFO
copying tools/python/dlib.egg-info/top_level.txt -> build/bdist.macosx-10.9-universal2/egg/EGG-INFO
writing build/bdist.macosx-10.9-universal2/egg/EGG-INFO/native_libs.txt
creating 'dist/dlib-19.24.99-py3.11-macosx-10.9-universal2.egg' and adding 'build/bdist.macosx-10.9-universal2/egg' to it
removing 'build/bdist.macosx-10.9-universal2/egg' (and everything under it)
Processing dlib-19.24.99-py3.11-macosx-10.9-universal2.egg
removing '/Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/site-packages/dlib-19.24.99-py3.11-macosx-10.9-universal2.egg' (and everything under it)
creating /Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/site-packages/dlib-19.24.99-py3.11-macosx-10.9-universal2.egg
Extracting dlib-19.24.99-py3.11-macosx-10.9-universal2.egg to /Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/site-packages
dlib 19.24.99 is already the active version in easy-install.pth

Installed /Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/site-packages/dlib-19.24.99-py3.11-macosx-10.9-universal2.egg
Processing dependencies for dlib==19.24.99
Searching for dlib==19.24.99
Reading https://pypi.org/simple/dlib/
Download error on https://pypi.org/simple/dlib/: [SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: unable to get local issuer certificate (_ssl.c:1002) -- Some packages may not be found!
Couldn't retrieve index page for 'dlib'
Scanning index of all packages (this may take a while)
Reading https://pypi.org/simple/
Download error on https://pypi.org/simple/: [SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: unable to get local issuer certificate (_ssl.c:1002) -- Some packages may not be found!
No local packages or working download links found for dlib==19.24.99
error: Could not find suitable distribution for Requirement.parse('dlib==19.24.99')
anshtyagi0 commented 8 months ago

is this issue only for MacOS if yes then I can get someones windows laptop for this project as I have to submit the project day after tomorrow

anshtyagi0 commented 8 months ago

@davisking

davisking commented 8 months ago

I don't know what that last part is about:

Searching for dlib==19.24.99
Reading https://pypi.org/simple/dlib/
Download error on https://pypi.org/simple/dlib/: [SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: unable to get local issuer certificate (_ssl.c:1002) -- Some packages may not be found!
Couldn't retrieve index page for 'dlib'
Scanning index of all packages (this may take a while)
Reading https://pypi.org/simple/
Download error on https://pypi.org/simple/: [SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: unable to get local issuer certificate (_ssl.c:1002) -- Some packages may not be found!
No local packages or working download links found for dlib==19.24.99
error: Could not find suitable distribution for Requirement.parse('dlib==19.24.99')

It shouldn't be talking to pypi.org if you are just using setup.py. That's a purely local thing and doesn't have any business talking to pypi about dlib.

So I don't know what to tell you. The other thing you could have done is say --no DLIB_GIF_SUPPORT as an option when installing. That will disable trying to use libgif at all and avoid that other problem. But I don't know why you are unable to install a python package like you are showing now.

anshtyagi0 commented 8 months ago

can you tell me about windows? will it work or not?

anshtyagi0 commented 8 months ago

@davisking just tell me this

davisking commented 8 months ago

It works on all platforms. I don't know why it's not working on your computer. Windows is fine too.

anshtyagi0 commented 8 months ago

actually I am trying to install face_recognition in that dlib is a dependency so I think that is causing some problem

anshtyagi0 commented 8 months ago

any other solution to this issue?

anshtyagi0 commented 7 months ago

No solution found. If anyone finds then please reopen and ping me.

anshtyagi0 commented 7 months ago

any fix found?

dlib-issue-bot commented 6 months ago

Warning: this issue has been inactive for 35 days and will be automatically closed on 2024-04-24 if there is no further activity.

If you are waiting for a response but haven't received one it's possible your question is somehow inappropriate. E.g. it is off topic, you didn't follow the issue submission instructions, or your question is easily answerable by reading the FAQ, dlib's official compilation instructions, dlib's API documentation, or a Google search.

dlib-issue-bot commented 6 months ago

Warning: this issue has been inactive for 42 days and will be automatically closed on 2024-04-24 if there is no further activity.

If you are waiting for a response but haven't received one it's possible your question is somehow inappropriate. E.g. it is off topic, you didn't follow the issue submission instructions, or your question is easily answerable by reading the FAQ, dlib's official compilation instructions, dlib's API documentation, or a Google search.

dlib-issue-bot commented 6 months ago

Notice: this issue has been closed because it has been inactive for 45 days. You may reopen this issue if it has been closed in error.