Skip to content
This repository has been archived by the owner on Feb 2, 2022. It is now read-only.

Crash due to Pango conflict on GTK / Linux #157

Closed
ThirumuruganE opened this issue Apr 23, 2021 · 18 comments
Closed

Crash due to Pango conflict on GTK / Linux #157

ThirumuruganE opened this issue Apr 23, 2021 · 18 comments

Comments

@ThirumuruganE
Copy link

I am unable to import dicom, I have attached the screenshot of the error. kindly let me know how to resolve this issue.
Thanks in advance
Screenshot from 2021-04-23 14-47-45

@cutright
Copy link
Owner

Unfortunately I don't have a linux box to troubleshoot.

Can you let me know which OS, python, wxPython versions? Have you tried upgrading any of these? It seems unlikely to be a DVHA code issues, and more likely an environment problem.

@cutright
Copy link
Owner

@victorgabr Just curious if you came across this error when running on Linux?

@victorgabr
Copy link

@victorgabr Just curious if you came across this error when running on Linux?

Not the version I have here, but I can pull the last commit and run it on my computer just to test it.

I will report back if that happens.

@cutright
Copy link
Owner

Awesome, thanks!!

@ThirumuruganE
Copy link
Author

I am using ubuntu 20.04 , python 3.8.5 , wxpython 4.1.1 . I also tried with wxpython 4.0.7. I am facing same issue with both versions. sorry for late reply.

@cutright
Copy link
Owner

@ThirumuruganE which version of Pango?

@cutright
Copy link
Owner

You might be out of date:
Line 4192 of the current GitHub master of Pango does't appear to correlate to your error:
https://github.com/GNOME/pango/blob/7a88d0c6601d5fef4a0850a83145b3b971b51e37/pango/pango-layout.c#L4170-L4193

pango_layout_check_lines occurs several times, but none anywhere near line 4192.

After we verify you have the latest version of Pango, the next step is to figure out when this error occurs, can you provide a screen shot of DVHA when this error happens?

@victorgabr
Copy link

@cutright

I cloned the latest version of the source code.

And I am getting an error on pango but in a different line:

I will try to update pango.

/home/victor/DVH-Analytics/venv/bin/python /home/victor/DVH-Analytics/dvha_app.py
Options.load: Options file corrupted. Loading default options.
'positions'
Options.load: Options file corrupted. Loading default options.
'positions'
WARNING: Options.load: Options file corrupted. Loading default options.
'positions'
WARNING: Options.load: Options file corrupted. Loading default options.
'positions'

(dvha_app.py:97971): Gtk-CRITICAL **: 19:49:12.201: gtk_box_gadget_distribute: assertion 'size >= 0' failed in GtkScrollbar

(dvha_app.py:97971): Gtk-CRITICAL **: 19:49:12.202: gtk_box_gadget_distribute: assertion 'size >= 0' failed in GtkScrollbar
WARNING: Options.load: Options file corrupted. Loading default options.
'positions'
WARNING: Options.load: Options file corrupted. Loading default options.
'positions'
WARNING: Options.load: Options file corrupted. Loading default options.
'positions'
WARNING: Options.load: Options file corrupted. Loading default options.
'positions'

(dvha_app.py:97971): Gtk-CRITICAL **: 19:49:24.946: gtk_box_gadget_distribute: assertion 'size >= 0' failed in GtkCheckButton

(dvha_app.py:97971): Gtk-CRITICAL **: 19:49:24.946: gtk_box_gadget_distribute: assertion 'size >= 0' failed in GtkCheckButton

(dvha_app.py:97971): Gtk-CRITICAL **: 19:49:24.946: gtk_box_gadget_distribute: assertion 'size >= 0' failed in GtkCheckButton

(dvha_app.py:97971): Gtk-CRITICAL **: 19:49:24.946: gtk_box_gadget_distribute: assertion 'size >= 0' failed in GtkCheckButton

(dvha_app.py:97971): Gtk-CRITICAL **: 19:49:24.946: gtk_box_gadget_distribute: assertion 'size >= 0' failed in GtkCheckButton

(dvha_app.py:97971): Gtk-CRITICAL **: 19:49:24.947: gtk_box_gadget_distribute: assertion 'size >= 0' failed in GtkCheckButton

(dvha_app.py:97971): Gtk-CRITICAL **: 19:49:24.947: gtk_box_gadget_distribute: assertion 'size >= 0' failed in GtkCheckButton

(dvha_app.py:97971): Gtk-CRITICAL **: 19:49:24.947: gtk_box_gadget_distribute: assertion 'size >= 0' failed in GtkCheckButton

(dvha_app.py:97971): Gtk-CRITICAL **: 19:49:24.947: gtk_box_gadget_distribute: assertion 'size >= 0' failed in GtkCheckButton

(dvha_app.py:97971): Gtk-CRITICAL **: 19:49:24.947: gtk_box_gadget_distribute: assertion 'size >= 0' failed in GtkCheckButton

(dvha_app.py:97971): Gtk-CRITICAL **: 19:49:24.947: gtk_box_gadget_distribute: assertion 'size >= 0' failed in GtkCheckButton

(dvha_app.py:97971): Gtk-CRITICAL **: 19:49:24.947: gtk_box_gadget_distribute: assertion 'size >= 0' failed in GtkCheckButton

(dvha_app.py:97971): Gtk-CRITICAL **: 19:49:24.947: gtk_box_gadget_distribute: assertion 'size >= 0' failed in GtkCheckButton
WARNING: Options.load: Options file corrupted. Loading default options.
'positions'
WARNING: Options.load: Options file corrupted. Loading default options.
'positions'
Bail out! Pango:ERROR:../pango/pango/pango-layout.c:4274:pango_layout_check_lines: assertion failed: (!layout->log_attrs)
**
Pango:ERROR:../pango/pango/pango-layout.c:4274:pango_layout_check_lines: assertion failed: (!layout->log_attrs)

Process finished with exit code 134 (interrupted by signal 6: SIGABRT)

@cutright
Copy link
Owner

Seems like this type of error has been around for a long time, but I can't find anything helpful yet. This one was from 2006: https://discuss.wxpython.org/t/wxpython-apps-failing-with-pango-assert-failure/16499

@victorgabr
Copy link

I updated pango to the latest version.

https://archlinux.org/packages/extra/x86_64/pango/

I had to rebuild wxpython from its source again.

But still the same error. wxpython support on Linux is not that great.

I used pip, but maybe a conda-forge build has a proper way of linking pango.

/home/victor/DVH-Analytics/venv/bin/python /home/victor/DVH-Analytics/dvha_app.py
Options.load: Options file corrupted. Loading default options.
'positions'
Options.load: Options file corrupted. Loading default options.
'positions'
WARNING: Options.load: Options file corrupted. Loading default options.
'positions'
WARNING: Options.load: Options file corrupted. Loading default options.
'positions'

(dvha_app.py:46758): Gtk-CRITICAL **: 22:50:23.416: gtk_box_gadget_distribute: assertion 'size >= 0' failed in GtkScrollbar

(dvha_app.py:46758): Gtk-CRITICAL **: 22:50:23.417: gtk_box_gadget_distribute: assertion 'size >= 0' failed in GtkScrollbar
WARNING: Options.load: Options file corrupted. Loading default options.
'positions'
WARNING: Options.load: Options file corrupted. Loading default options.
'positions'
WARNING: Options.load: Options file corrupted. Loading default options.
'positions'
WARNING: Options.load: Options file corrupted. Loading default options.
'positions'

(dvha_app.py:46758): Gtk-CRITICAL **: 22:50:29.819: gtk_box_gadget_distribute: assertion 'size >= 0' failed in GtkCheckButton

(dvha_app.py:46758): Gtk-CRITICAL **: 22:50:29.819: gtk_box_gadget_distribute: assertion 'size >= 0' failed in GtkCheckButton

(dvha_app.py:46758): Gtk-CRITICAL **: 22:50:29.819: gtk_box_gadget_distribute: assertion 'size >= 0' failed in GtkCheckButton

(dvha_app.py:46758): Gtk-CRITICAL **: 22:50:29.819: gtk_box_gadget_distribute: assertion 'size >= 0' failed in GtkCheckButton

(dvha_app.py:46758): Gtk-CRITICAL **: 22:50:29.819: gtk_box_gadget_distribute: assertion 'size >= 0' failed in GtkCheckButton

(dvha_app.py:46758): Gtk-CRITICAL **: 22:50:29.819: gtk_box_gadget_distribute: assertion 'size >= 0' failed in GtkCheckButton

(dvha_app.py:46758): Gtk-CRITICAL **: 22:50:29.820: gtk_box_gadget_distribute: assertion 'size >= 0' failed in GtkCheckButton

(dvha_app.py:46758): Gtk-CRITICAL **: 22:50:29.820: gtk_box_gadget_distribute: assertion 'size >= 0' failed in GtkCheckButton

(dvha_app.py:46758): Gtk-CRITICAL **: 22:50:29.820: gtk_box_gadget_distribute: assertion 'size >= 0' failed in GtkCheckButton

(dvha_app.py:46758): Gtk-CRITICAL **: 22:50:29.820: gtk_box_gadget_distribute: assertion 'size >= 0' failed in GtkCheckButton

(dvha_app.py:46758): Gtk-CRITICAL **: 22:50:29.820: gtk_box_gadget_distribute: assertion 'size >= 0' failed in GtkCheckButton

(dvha_app.py:46758): Gtk-CRITICAL **: 22:50:29.820: gtk_box_gadget_distribute: assertion 'size >= 0' failed in GtkCheckButton

(dvha_app.py:46758): Gtk-CRITICAL **: 22:50:29.820: gtk_box_gadget_distribute: assertion 'size >= 0' failed in GtkCheckButton
WARNING: Options.load: Options file corrupted. Loading default options.
'positions'
WARNING: Options.load: Options file corrupted. Loading default options.
'positions'
Bail out! Pango:ERROR:../pango/pango/pango-layout.c:4288:pango_layout_check_lines: assertion failed: (!layout->log_attrs)
**
Pango:ERROR:../pango/pango/pango-layout.c:4288:pango_layout_check_lines: assertion failed: (!layout->log_attrs)

Process finished with exit code 134 (interrupted by signal 6: SIGABRT)

@victorgabr
Copy link

victorgabr commented Apr 25, 2021

I found a workaround, tested it on Manjaro/Arch Linux.

You need to build wxpython from the source and link it to your system's GTK 3.

I installed webkitgtk3 using:

https://aur.archlinux.org/packages/webkitgtk/

git clone --branch wxPython-4.1.1 --recurse-submodules https://github.com/wxWidgets/Phoenix.git

cd Phoenix
git submodule update --init --recursive

Build wxpython while linking GTK3 properly.

python build.py cleanall
python build.py dox etg --nodoc sip build --gtk3 -j 4
python build.py sdist

creating a package distribution using wheel

pip install wheel
python build.py bdist_wheel

Install your wheel binary

pip install ./dist/wxPython-4.1.1-cp39-cp39-linux_x86_64.whl

And it worked, no crash due to pango rendering.

image

@cutright cutright changed the title import error Crash due to Pango conflict on GTK / Linux Apr 25, 2021
@cutright
Copy link
Owner

Wow, thanks so much Victor! That sounds like a ton of work. @ThirumuruganE , hopefully this will help you out?

I'll have to do some more research to see what I can on my end to possibly avoid this.

@ThirumuruganE
Copy link
Author

Thank you very much @victorgabr @cutright .

@cutright
Copy link
Owner

This is a really long post, providing probably no new information to those already in the thread, but maybe it will be useful anyone else trying to get DVHA working on Ubuntu.

I just installed Ubuntu 20.04.2 LTS into a Virtual machine with Virtual Box on my Mac. Aside from PyCharm, the only things I installed were:

sudo apt install git-all
sudo apt install python3-pip

and then

sudo apt install libgtk-3-dev
sudo apt-get install python-wxgtk3.0​

based on: https://www.pixelstech.net/article/1599647177-Problem-and-Solution-for-Installing-wxPython-on-Ubuntu-20-04

and

sudo apt install libwebkit2gtk-4.0-dev

per https://wxpython.org/Phoenix/docs/html/wx.html2.WebView.html (and needs to be installed before installing wxPython).

Python 3.8 came with this version of Ubuntu, which was used for a virtual environment. All DVHA requirements installed with no issues... other than the fact that wxPython had to build from source, so it took a VERY long time.

After calling python dvha_app.py, I did get the gtk_box_gadget_distribute: assertion errors. But everything appears to import with no issues. I'm still working out the WebView2 issue, which I'm pretty sure wxPython just needs to be rebuilt now that libwebkit2gtk-4.0-dev is installed. Using the wheels for wxPython posted here did not work for me. If this rebuild fails, the steps described by @victorgabr above will be my next step.

Long story short, I did not get any pango errors in the above scenario.

@cutright
Copy link
Owner

cutright commented Apr 29, 2021

FYI, installing libwebkit2gtk-4.0-dev, and then building wxpython from source into a fresh virtual environment solved my WebView2 issues.

@victorgabr
Copy link

FYI, installing libwebkit2gtk-4.0-dev, and then building wxpython from source into a fresh virtual environment solved my WebView2 issues.

Exactly. In my experience, python wheels or Conda packages never run DVH-Analytics on Linux, I have always had to build wxpython from source, then it links to my current OS libraries. If you update your OS libraries, you might have to rebuild wxpython again.

@cutright
Copy link
Owner

Thanks Victor, I'll collect the notes from this thread into the DVHA documentation soon.

@ThirumuruganE
Copy link
Author

This is a really long post, providing probably no new information to those already in the thread, but maybe it will be useful anyone else trying to get DVHA working on Ubuntu.

I just installed Ubuntu 20.04.2 LTS into a Virtual machine with Virtual Box on my Mac. Aside from PyCharm, the only things I installed were:

sudo apt install git-all
sudo apt install python3-pip

and then

sudo apt install libgtk-3-dev
sudo apt-get install python-wxgtk3.0​

based on: https://www.pixelstech.net/article/1599647177-Problem-and-Solution-for-Installing-wxPython-on-Ubuntu-20-04

and

sudo apt install libwebkit2gtk-4.0-dev

per https://wxpython.org/Phoenix/docs/html/wx.html2.WebView.html (and needs to be installed before installing wxPython).

Python 3.8 came with this version of Ubuntu, which was used for a virtual environment. All DVHA requirements installed with no issues... other than the fact that wxPython had to build from source, so it took a VERY long time.

After calling python dvha_app.py, I did get the gtk_box_gadget_distribute: assertion errors. But everything appears to import with no issues. I'm still working out the WebView2 issue, which I'm pretty sure wxPython just needs to be rebuilt now that libwebkit2gtk-4.0-dev is installed. Using the wheels for wxPython posted here did not work for me. If this rebuild fails, the steps described by @victorgabr above will be my next step.

Long story short, I did not get any pango errors in the above scenario.

Thank you so much @cutright .

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants