DearPyGui icon indicating copy to clipboard operation
DearPyGui copied to clipboard

Version 2.1.0 crashes immediately

Open MediumSolid opened this issue 5 months ago • 40 comments

I was looking forward to switching from 2.0.0 to 2.1.0 given that our wonderful @v-ein has managed to fix the notorious issue relating to window resizing event not propagating down properly as explained in PR#2521. But unfortunately after upgrading to 2.1.0 by installing directly to Blender's python via "python.exe -m pip install dearpygui==2.1.0 I was meat with unpleasant surprise of instant crash whenever running a script that creates a viewport.

I've tried troubleshooting this issue myself (as a layman) by running numerous new and old(proven and tested in previous version) scripts of various complexity, from the most complex(pygui_demo.py) to the most simplest, but I was met with the same result, an instant crash that is. When reverting to previous version the issue goes away. I even switched between different Blender versions (despite knowing how ridiculous that is) hoping that the issue is somehow Blender related, but no... it persists across all versions from Blender 4.1 to 4.5. So yeah, I don't think the issue lays in Blender. Just in case I also checked the version I'm running the script on, and it properly displayed 2.1.0

The error is a typical exception access violation. The crash log/report more or less states states that the error occurs in line 9601 in dearpygui.py file which is located in Blender's site-package library.

OS: Win11 Home

MediumSolid avatar Jul 19 '25 21:07 MediumSolid

Hi @MediumSolid - does the test script crash if you run it directly? (Just double click the .py file). Also, can you attach the simplest test script that fails? Does the following script also crash?

import dearpygui.dearpygui as dpg
dpg.create_context()
dpg.setup_dearpygui()

If it does, can you please attach its crash report?

v-ein avatar Jul 20 '25 07:07 v-ein

Hi @v-ein - no, I just checked and scripts that are ran directly via cmd in a non-Blender environment do not crash. Here's the simplest code I tried in Blender that crashes immediately, but not in a standard python environment.

 import dearpygui.dearpygui as dpg

dpg.create_context()

dpg.create_viewport(title="Basic Viewport", width=600, height=400)

dpg.setup_dearpygui()
dpg.show_viewport()

while dpg.is_dearpygui_running():
    dpg.render_dearpygui_frame()

dpg.destroy_context()

MediumSolid avatar Jul 20 '25 07:07 MediumSolid

I'll see if I can recreate the issue and debug it. The problem is, I don't have a test machine suitable for modern versions of Blender.

Meanwhile, we can try to debug it on your side. First off, does that three-line script from my previous comment also crash in Blender? If so, can you please attach its crash report?

v-ein avatar Jul 22 '25 06:07 v-ein

Sorry for the late reply @v-ein. The script is still crashing the entire application, I went ahead and ran the aforementioned 3-line script and it just crashes in dearpygui 2.1.0 while not in 2.0.0. Here's the blender.crash.txt.

MediumSolid avatar Jul 26 '25 09:07 MediumSolid

Unfortunately that crash didn't shed much light so we'll have to debug it somehow. Would you be willing to build DearPyGui on your system? You can find the instructions in wiki - the build process is mostly automated, but if you've never used Visual Studio it might be a bit challenging. The goal is to get a debug build of DPG, and if the script crashes on that build too, we'll be able to open it in Visual Studio's debugger for further analysis.

Alternatively, give me some time to figure out how/where I could install Blender and try to recreate the issue - this way you (hopefully) won't need to build anything.

v-ein avatar Jul 26 '25 10:07 v-ein

Hi again @v-ein, and thank you for taking your time to help me out here. But for now I think the best course of action would be for me to build my own DearPyGUI and troubleshoot the issue, no need to involve yourself into this any further seeing as it could be a local issue and not a global one due to lack of complaints by other Blender and DPG users. Now... this will take some time as it's not a priority for me at the moment, but once I run a debug build and get a more informative crash report (if it occurs) I'll let you know. Thanks again.

MediumSolid avatar Jul 27 '25 15:07 MediumSolid

I just experienced this issue myself. 2.0 works, 2.1 crashes immediately. Installed just via pip.

BioTurboNick avatar Aug 16 '25 23:08 BioTurboNick

@BioTurboNick, can you please provide a bit more details? What OS and what Python version are you using? Are you running your Python script directly or in Blender?

v-ein avatar Aug 17 '25 20:08 v-ein

Windows 11 24H2 (OS Build 26100.4946) 64-bit

I've observed the issue with Python 3.8.10 and 3.13.7

This is being run directly, not in Blender.

If I execute the test lines from above, reproduced below, on the Python REPL, the REPL crashes with dearpygui 2.1.0, with no stacktrace provided.

import dearpygui.dearpygui as dpg
dpg.create_context()
dpg.setup_dearpygui()

BioTurboNick avatar Aug 18 '25 13:08 BioTurboNick

Windows 11 24H2 Version 10.0.26100 Build 26100 64 Bit Reproducible on python 3.11.7 dearpygui=2.1.0 With same code as @BioTurboNick No stacktrace too.

PastaLaPate avatar Aug 20 '25 09:08 PastaLaPate

@BioTurboNick, @PastaLaPate do any of you guys have Visual Studio installed? I can't recreate the issue at the moment, so we can try to debug it on your side.

v-ein avatar Aug 20 '25 10:08 v-ein

@v-ein Yeah i have 2022 Community edition

PastaLaPate avatar Aug 20 '25 10:08 PastaLaPate

Great! Would you be willing to get into this mess with debugging? If so, the first thing I'd ask you to do is to build Dear PyGui as described on this wiki page: Building For Development. We need binaries for either Debug or RelWithDebInfo configuration.

Then, add the output directory to PYTHONPATH and try to recreate the issue. Important: first of all make sure that the module comes from the right place. You can do it this way:

import dearpygui.dearpygui as dpg
print(dpg.__file__)
print(dpg.internal_dpg.__file__)

Both print's must show files from your build output. Note that PYTHONPATH should point to a directory that has a subdirectory named dearpygui, which in turn should contain dearpygui.py and _dearpygui.pyd. Like, if you have the following directory structure:

Image

Then your PYTHONPATH must end with ...\#dpg-releases\1.11.1 (and must not include dearpygui).

If the modules are loaded from the correct location but the issue does not occur with the Debug config, try RelWithDebInfo - it's less suitable for debugging but has higher chances of catching issues that are caused by race conditions (which might well be what we're experiencing here).

v-ein avatar Aug 20 '25 10:08 v-ein

As soon as you recreate the issue, there should be a message box that offers you to debug the crashed program. Upon clicking "Debug", Visual Studio should open, showing the line where DPG crashed. I'm mostly interested in where it crashed (what line/file), in which thread, and what is in the call stack at that moment.

Thanks in advance for any info you can provide! And if you can't really afford diving into this mess - no worries, that's totally fine!

v-ein avatar Aug 20 '25 10:08 v-ein

Ok I install the VS 2019 Build tools & Python addon and I'll tell you the debugging results

PastaLaPate avatar Aug 20 '25 12:08 PastaLaPate

Doesn't it build with VS 2022 Community? I typically build it with an older Community Edition, but I have a customized build process so not sure how it will work if you just follow the wiki instructions.

v-ein avatar Aug 20 '25 14:08 v-ein

No, the CMake project requires something like build tools Version 142 which is the one bundled with VS2019 Edit : I mean it doesn't build with the base version you need to install the VS2019 Build tools

PastaLaPate avatar Aug 20 '25 14:08 PastaLaPate

No, the CMake project requires something like build tools Version 142 which is the one bundled with VS2019

You can add v142 to VS2022 via the installer, fwiw.

BioTurboNick avatar Aug 20 '25 16:08 BioTurboNick

No, the CMake project requires something like build tools Version 142 which is the one bundled with VS2019

You can add v142 to VS2022 via the installer, fwiw.

That's what I did

PastaLaPate avatar Aug 20 '25 16:08 PastaLaPate

When crashing I get this dialog

Image Error 3221225477 is hex 0xC000005 which is an access violation. But no further infos

PastaLaPate avatar Aug 20 '25 17:08 PastaLaPate

It crashed here: > _dearpygui.pyd!00007ffad7708a76()

PastaLaPate avatar Aug 20 '25 17:08 PastaLaPate

I thought I would try to help for good measure. Unfortunately I must be missing something - It looks like the C code is building but python code doesn't seem to have built. I don't typically compile C or Python, so not sure what I should be looking for. I do see a few warnings about not being able to find some libraries (harfbuzz, ZLIB, PNG, BZip2) from CMake, but it doesn't call it our as an error.

BioTurboNick avatar Aug 20 '25 19:08 BioTurboNick

I thought I would try to help for good measure. Unfortunately I must be missing something - It looks like the C code is building but python code doesn't seem to have built. I don't typically compile C or Python, so not sure what I should be looking for. I do see a few warnings about not being able to find some libraries (harfbuzz, ZLIB, PNG, BZip2) from CMake, but it doesn't call it our as an error.

Yeah I think you need to look at the setup.py file to compile the python code

PastaLaPate avatar Aug 20 '25 20:08 PastaLaPate

but python code doesn't seem to have built

@BioTurboNick, can you elaborate on this please? Do you have any specific error during the build, or does it simply not create the expected output?

IIRC messages about those libraries are fine.

v-ein avatar Aug 20 '25 20:08 v-ein

When crashing I get this dialog

This is interesting. So when you click OK, what does happen next? Does Visual Studio exit or does it remain open? If open, is it in debugging mode? (like, there are those Pause/Continue buttons and so on).

v-ein avatar Aug 20 '25 20:08 v-ein

but python code doesn't seem to have built

@BioTurboNick, can you elaborate on this please? Do you have any specific error during the build, or does it simply not create the expected output?

IIRC messages about those libraries are fine.

I didn't have any folder containing _dearpygui.pyd

Thanks to Pasta's tip, I figured out to run python setup.py build (after installing setuptools in pip), although that was a Release build, so I had to edit setup.py to change Release to Debug, and I had to install the Python debug library and set DPYTHON_LIBRARY and DPYTHON_INCLUDE_DIR environment vars. Now I seem to have the right files in DearPyGui\output\dearpygui.

But now I'm getting this error:

Traceback (most recent call last):
  File "<python-input-0>", line 1, in <module>
    import dearpygui.dearpygui as dpg
  File "D:\source\DearPyGui\output\dearpygui\dearpygui.py", line 22, in <module>
    import dearpygui._dearpygui as internal_dpg
ImportError: DLL load failed while importing _dearpygui: The specified module could not be found.
Image

BioTurboNick avatar Aug 20 '25 21:08 BioTurboNick

Fascinating - on my home computer which is the same OS version, DearPyGui 2.1 doesn't seem to crash. My home computer is much newer hardware than the two computers I've seen the crash on.

BioTurboNick avatar Aug 21 '25 03:08 BioTurboNick

but python code doesn't seem to have built

@BioTurboNick, can you elaborate on this please? Do you have any specific error during the build, or does it simply not create the expected output?

IIRC messages about those libraries are fine.

I didn't have any folder containing _dearpygui.pyd

Thanks to Pasta's tip, I figured out to run python setup.py build (after installing setuptools in pip), although that was a Release build, so I had to edit setup.py to change Release to Debug, and I had to install the Python debug library and set DPYTHON_LIBRARY and DPYTHON_INCLUDE_DIR environment vars. Now I seem to have the right files in DearPyGui\output\dearpygui.

But now I'm getting this error:

Traceback (most recent call last):
  File "<python-input-0>", line 1, in <module>
    import dearpygui.dearpygui as dpg
  File "D:\source\DearPyGui\output\dearpygui\dearpygui.py", line 22, in <module>
    import dearpygui._dearpygui as internal_dpg
ImportError: DLL load failed while importing _dearpygui: The specified module could not be found.
Image

Yeah verify that the .pyd file does exist and try to add the output folder to your PYTHONPATH and try to run a test script from outside of the folder I think that fixed it

PastaLaPate avatar Aug 21 '25 07:08 PastaLaPate

If it doesn't work try uninstalling and reinstalling the VC redistributable and rebooting your pc

PastaLaPate avatar Aug 21 '25 10:08 PastaLaPate

Uhh... okay now the pip package for 2.1 is not crashing anymore on my development computer. I still have one computer it is crashing on, I'll check back in on that one...

BioTurboNick avatar Aug 21 '25 14:08 BioTurboNick