DearPyGui: ImportError - Reason: image not found

Version of Dear PyGui

Version: 1.0.2 Operating System: macOS 10.15.7

My Issue/Question

Attempting to import the library fails. I have checked the FAQ and issues list (and found a failed issue submission).

To Reproduce

Steps to reproduce the behavior:

import dearpygui.dearpygui as dpg

Attempted in Python 3.9 and 3.10 Attempted running the demo from IDLE and from Terminal. Attempted as a statement in the Python shell.

What I have installed:

~ % pip3.10 list
Package    Version
---------- -------
dearpygui  1.0.2
pip        21.3.1
pyparsing  2.4.7
setuptools 57.4.0
tqdm       4.62.2

Expected behavior

I would expect the import statement to not fail.

Screenshots/Video

Screen Shot 2021-11-02 at 10 08 06 PM
Traceback (most recent call last):
    File "<pyshell#0>", line 1, in <module>
        import dearpygui.dearpygui as dpg
    File "/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages/dearpygui/dearpygui.py", line 22, in <module>
        import dearpygui._dearpygui as internal_dpg
ImportError: dlopen(/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages/dearpygui/_dearpygui.so, 2): Library not loaded: /usr/local/opt/libpng/lib/libpng16.16.dylib
    Referenced from: /Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages/dearpygui/_dearpygui.so
    Reason: image not found

Standalone, minimal, complete and verifiable example

import dearpygui.dearpygui as dpg

I’ve attempted with the newest 1.0.2 demo (run from IDLE and terminal as noted above), but just the import statement is what fails.

I was just running DearPyGui 0.8.44 and importing it and running its demo worked.

Maybe something to note is that after updating the library (on my Python 3.9.2 from DearPyGui 0.8.44 to 1.0.2), after pip uninstalling and installing the library, or after an install/update of Python (updated Python 3.10 prerelease to 3.10.0 with the official installer), and attempting to import for the first time, it won’t fail smoothly, and you will need to wait or issue a keyboard interrupt to get back to the Python shell prompt (it will reach “Reason: image not found”). Thereafter, an attempted import will fail instantly and immediately display a new line prompt (just like in the screenshot). I’ve reproduced this once. (I suppose this is from making the .pyc files?)

About this issue

  • Original URL
  • State: closed
  • Created 3 years ago
  • Reactions: 1
  • Comments: 17 (6 by maintainers)

Most upvoted comments

@hoffstadt I found a solution: https://stackoverflow.com/questions/45098434/module-build-failed-error-dyld-library-not-loaded-usr-local-opt-libpng-lib

brew install libpng

This came after deleting my Python 3.9 and 3.10 installations from /Library/Frameworks/Python.framework and from Applications. At that point, I was left with the Python 3.9 installed by Homebrew.

Running brew doctor I ignored the “Unbrewed static libraries…” Warnings (much of it was Vulkan related). I followed its prompting to run brew cleanup (cleaning the 3.9 and 3.10 python.org installer leftovers) then brew link python@3.9. This may or may not be relevant.

Next I did pip3 install dearpygui and tested import dearpygui.dearpygui as dpg in brew’s python3.9 and still received the same error reported originally.

After some googling, I found the above stackoverflow post and attempted brew install libpng and then ran the standard dpg demo and it worked.

Planning a fix for next release.