DearPyGui
DearPyGui copied to clipboard
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

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?)
Hi, would you happen to be running with the m1 chip?
Hi, would you happen to be running with the m1 chip?
No, I am not. My specs are: MacBook Pro (16-inch, 2019) 2.4 GHz 8-Core Intel Core i9 AMD Radeon Pro 5500M
macOS Big Sur 11.5.2 Version 1.0.2
I have got a similar problem on a m1 machine with the following specs: MacBook Pro (13-inch, M1, 2020) Apple M1
>>> from dearpygui.dearpygui import *
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/site-packages/dearpygui/dearpygui.py", line 22, in <module>
import dearpygui._dearpygui as internal_dpg
ImportError: dlopen(/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/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.9/lib/python3.9/site-packages/dearpygui/_dearpygui.so
Reason: image not found
Planning a fix for next release.
@ZedOud and @0Micfong0 how are you installing python under MacOS. I don't have any issues (I only have an intel Mac) however I am using python installed via Homebrew. Looks like you may be using the MacOS system python. That might fix the issue for you.
@ZedOud and @0Micfong0 how are you installing python under MacOS. I don't have any issues (I only have an intel Mac) however I am using python installed via Homebrew. Looks like you may be using the MacOS system python. That might fix the issue for you.
I am using the installers provided at python.org
I had the same error running from a M1 Macbook Air. I copied the missing /usr/local/opt/libpng/lib/libpng16.16.dylib
and got the following traceback.
Traceback (most recent call last):
File "/opt/local/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/runpy.py", line 183, in _run_module_as_main
mod_name, mod_spec, code = _get_module_details(mod_name, _Error)
File "/opt/local/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/runpy.py", line 109, in _get_module_details
__import__(pkg_name)
File "/Users/douglaslassance/Desktop/WIP/deargui/main.py", line 1, in <module>
import dearpygui.dearpygui as dpg
File "/opt/local/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/dearpygui/dearpygui.py", line 22, in <module>
import dearpygui._dearpygui as internal_dpg
ImportError: dlopen(/opt/local/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/dearpygui/_dearpygui.so, 2): Library not loaded: /usr/local/opt/libpng/lib/libpng16.16.dylib
Referenced from: /opt/local/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/dearpygui/_dearpygui.so
Reason: no suitable image found. Did find:
/usr/local/opt/libpng/lib/libpng16.16.dylib: mach-o, but wrong architecture
/usr/local/opt/libpng/lib/libpng16.16.dylib: mach-o, but wrong architecture
Is this issue still present in 1.1?
Is this issue still present in 1.1?
Yes. And the error is identical.
Also, if it matters, at least this much works for me in 1.0.2 and 1.1
import dearpygui
dearpygui.__version__
'1.1'
@0Micfong0 M1 is not really supported yet because none of the CI providers we have found have m1 runners. The alternative is for us to build them locally (like we do for the raspberry pi) but we don't personally have an M1 yet. You could also try building from source following the wiki but we obviously haven't tested with m1s.
@ZedOud Still haven't figured out your issue yet. We've tested on 3 macs we have laying around and @kuchi's Mac seems to be working. I will have to do a bit more research.
@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 [email protected]
. 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.
That’s great that worked. I have so many libraries installed I probably have always had libpng installed. I wonder if I would have run into the issue if I didn’t. Such a pain to figure these things out. I wonder if libpng should be included in the mac wheel.
I'll have to check if we are actually utilizing libpng. I know its an optional dependency of freetype but we might not be using it.
FWIW I'm running the following: MacBook Pro 14" M1 Pro Chip And seeing the same error with the most recent update.
@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 runbrew cleanup
(cleaning the 3.9 and 3.10 python.org installer leftovers) thenbrew link [email protected]
. This may or may not be relevant.Next I did
pip3 install dearpygui
and testedimport 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.
This issues is still around, but the brew install libpng
worked for me.
2020 MacBook Pro 13" Intel
I also am seeing this issue on new systems I was installing DPG without libpng pre installed with brew. @hoffstadt it would be great if libpng would be included with the DPG wheel if it is needed or removed as a needed dependency if it is not needed. It can also cause issues / failures if trying to package an app depending on the tooling someone uses currently. This appears to be an issue on Intel & M1 MacOS builds.
This should be fixed. Can we confirm?