wxPython 4.1.1 issue - OM LX 4.3

Please look at this link, it describe why it’s happend:
https://www.riverbankcomputing.com/pipermail/pyqt/2021-August/044155.html

I am not any help on this either. This bug has been around for long time.

wx python module fails to load

Maybe @Colin can help on this?

I checked if the patch I wrote about earlier works.
And if anyone is interested, then yes, it works.

I take spec-file from OM’s github repo, create patch and build rpm.

The funny thing is, that because I builded rpm with locale set to utf-8, sip created valid file escaping utf8 chars, and my patch was don’t needed.

Anyway, wxPython don’t want compile without patching files while building. It’s looks like wxWidgets’s headers installed early interference with headers bundled with wxPython.

The latest version of python-wxpython uses it’s own sip5 (rather than sip6) which is possibly why your patch may not be needed. OMA’s spec file externalises the the sip to sip6 and it is this sip that is failing. The choice of an internal version of sip5 makes things complicated it’s a mess waiting to get worse as far as I can see as it’s likely that the sips may diverge at some point if they have not done so already.

Later
Having looked at this a bit more it looks as if our sip6 is a later version and already has the neccessary fix probably all that is required is to rebuild wxpython which would make sense give the comment from aunoor.
I’ll test locally and if all is well I’ll rebuild the package on abf.

I continue experimenting with wxPython.

What I found:

  1. wxPython-4.1.1 has bundled wx-3.1.5, wxGtk in Rock repo is 3.1.4. And small changes in wx .4->.5 prevent wxPython from building properly, because spec-file dictate wxPython to build against system wx.
  2. Looks like system’s sip generate files without errors (docstring bug was fixed in sip 6.3.0). But why wxPython from repo still contain this error?

It will be nice, if someone just update wx to 3.1.5. I think it must solve problem.

when I try to install wxgtk3.1.5 from sources, I have the same error message than when I try to install wxPython from source :

checking if expat.h is valid C++ header... yes
checking for XML_ParserCreate in -lexpat... yes
checking for LIBCURL... not found
checking for GTK+ version... 
checking for pkg-config... (cached) /usr/bin/pkg-config
checking pkg-config is at least version 0.16... yes
checking for GTK+ - version >= 3.0.0... no
*** Could not run GTK+ test program, checking why...
*** The test program failed to compile or link. See the file config.log for the
*** exact error that occurred. This usually means GTK+ is incorrectly installed.
checking for pkg-config... (cached) /usr/bin/pkg-config
checking pkg-config is at least version 0.7... yes
checking for GTK+ - version >= 2.6.0... no
*** Could not run GTK+ test program, checking why...
*** The test program failed to compile or link. See the file config.log for the
*** exact error that occured. This usually means GTK+ is incorrectly installed.
checking for pkg-config... /usr/bin/pkg-config
checking for GTK+ - version >= 3.90.0... no
*** Could not run GTK+ test program, checking why...
*** The test program failed to compile or link. See the file config.log for the
*** exact error that occurred. This usually means GTK+ is incorrectly installed.
checking for gtk-config... no
checking for GTK - version >= 1.2.7... no
*** The gtk-config script installed by GTK could not be found
*** If GTK was installed in PREFIX, make sure PREFIX/bin is in
*** your path, or set the GTK_CONFIG environment variable to the
*** full path to gtk-config.
checking for gtk-config... (cached) no
checking for GTK - version >= 1.2.3... no
*** The gtk-config script installed by GTK could not be found
*** If GTK was installed in PREFIX, make sure PREFIX/bin is in
*** your path, or set the GTK_CONFIG environment variable to the
*** full path to gtk-config.
configure: error: 
The development files for GTK+ were not found. For GTK+ 2, please
ensure that pkg-config is in the path and that gtk+-2.0.pc is
installed. For GTK+ 1.2 please check that gtk-config is in the path,
and that the version is 1.2.3 or above. Also check that the
libraries returned by 'pkg-config gtk+-2.0 --libs' or 'gtk-config
--libs' are in the LD_LIBRARY_PATH or equivalent.

I have libgtk+3.0-devel installed, but doesn’t seem to be enough.

I don’t know what I am missing… any idea ?

wxgtk3.1.5 wants GTK>3.9.0, you must install lib64gtk4.0-devel.

But you don’t need to build it by hand.
I was wrong, 3.1.5 already in system’s repo by wxwidgets (lib64wxu3.1-devel-3.1.5-1, lib64wxgtku3.1-devel-3.1.5-1 and so on) package.
And there is another package, wxgtk3.1, which has 3.1.4 and it is deprecated and not installed, which I think was own wx includes. (Note to self: Never act in hurry and check all twice. :))

wxPython use bundled wxWidgets with some modifications. And this difference (two strings in wx/generic/grid.h) prevent to build wxPython using spec-file from git.

I’ not sure about how this works :
I installed lib64gtk4.0-devel, the lib64wx***3.1-devel-3.1.5-1, and install wxPython4.1.1.
But when I run “import wx”, I still have the same issue …

What do you advice me to do ?
Many thanks

note :

[redge@redge-virtualbox wxWidgets-3.1.5]$ pkg-config gtk+-2.0 --libs
-lgtk-x11-2.0 -lgdk-x11-2.0 -lpangocairo-1.0 -latk-1.0 -lcairo -lgdk_pixbuf-2.0 -lgio-2.0 -lpangoft2-1.0 -lpango-1.0 -lgobject-2.0 -lglib-2.0 -lharfbuzz -lfontconfig -lfreetype 
[redge@redge-virtualbox wxWidgets-3.1.5]$ pkg-config gtk+-3.0 --libs
-lgtk-3 -lgdk-3 -lpangocairo-1.0 -lpango-1.0 -lharfbuzz -latk-1.0 -lcairo-gobject -lcairo -lgdk_pixbuf-2.0 -lgio-2.0 -lgobject-2.0 -lglib-2.0 
[redge@redge-virtualbox wxWidgets-3.1.5]$ pkg-config gtk+-4.0 --libs
Package gtk+-4.0 was not found in the pkg-config search path.
Perhaps you should add the directory containing `gtk+-4.0.pc'
to the PKG_CONFIG_PATH environment variable
Package 'gtk+-4.0', required by 'virtual:world', not found
[redge@redge-virtualbox wxWidgets-3.1.5]$ 

It’s very strange then… Yep, gtk4-devel is not what needed, and you already installed lib64gtk+3.0-devel…

If I do dnf list --installed|grep gtk|grep devel it return next list:

lib64gtk+3.0-devel.x86_64                             3.24.31-1                 @rock-x86_64        
lib64webkitgtk3.0-devel.x86_64                        1:2.4.11-8                @rock-x86_64        
lib64wxgtku3.1-devel.x86_64                           3.1.5-1                   @System

@ zylyco, there is another way.
You can download wxPython spec-file and build rpm by rpmbuild. I think it will be easier. At least rpmbuild can tell what dependencies it want.

Hi.
Just compiled for testing new rev. of wxpython 4.1.1 with patch linked by @aunoor and with bundled sip.

For me right now this looks like this:

[x@openmandriva-cooker ~]$ python -c “import wx;print(wx.version())”
4.1.1 gtk3 (phoenix) wxWidgets 3.1.5

I prepare testing version here: https://abf.openmandriva.org/build_lists/129128
Please let me know if this fix this issue, then I push this release to repository.

It’s work for me.
And fix-build.patch is no more needed.

Hi AngryPenguin, I’ve been investigating this for over a week now and your patch certainly fixes the build but I investigated this further and built the packages locally from the latest git which did not need the patch. I diffed the the two versions. There are more differences than just the changes in override in your patch. The current wxpython is at 4.1.2a1 which I guess means it’s an alpha builds fine. I guess for the moment we should go with what you have done but I have a feeling that something is out of sync with our sources. I might checkout the the github 4.1.1 sources and regenerate the submodules and see if the resulting files are the same as what we have in our source archive.
Colin

I installed wxPython4.1.1.5 :

[root@redge-virtualbox GestConsoPhoenix4.1.x--1.3.8]# dnf list installed \*wxpython\*
Installed Packages
python-wxpython4.x86_64                                                     4.1.1-5                                             @@commandline
python-wxpython4-doc.noarch                                                 4.1.1-5                                             @@commandline
python-wxpython4-media.x86_64                                               4.1.1-5                                             @@commandline
python-wxpython4-webview.x86_64                                             4.1.1-5                                             @@commandline
[root@redge-virtualbox GestConsoPhoenix4.1.x--1.3.8]# 

Now wxpython seems fine :

[redge@redge-virtualbox GestConsoPhoenix4.1.x--1.3.8]$ python
Python 3.9.8 (main, Nov  7 2021, 19:37:54) 
[Clang 13.0.0 (/builddir/build/BUILD/llvm-project-13.0.0.src/clang 69c9d9094dd9 on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import wx
>>> print (wx.__version__)
4.1.1
>>> 
[1]+  Stopped                 python
[redge@redge-virtualbox GestConsoPhoenix4.1.x--1.3.8]$ 

But if I use “virtualenv”, this doesn’t work :

[redge@redge-virtualbox GestConsoPhoenix4.1.x--1.3.8]$ source env4.1.x-py39/bin/activate
(env4.1.x-py39) [redge@redge-virtualbox GestConsoPhoenix4.1.x--1.3.8]$ python
Python 3.9.8 (main, Nov  7 2021, 19:37:54) 
[Clang 13.0.0 (/builddir/build/BUILD/llvm-project-13.0.0.src/clang 69c9d9094dd9 on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import wx
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
ModuleNotFoundError: No module named 'wx'
>>> 
[2]+  Stopped                 python
(env4.1.x-py39) [redge@redge-virtualbox GestConsoPhoenix4.1.x--1.3.8]$ 

Thank you all for all the time you dedicate to this issue :slight_smile:

Hi,
I have noticed that there is available this option in virtualenv
–system-site-packages give the virtual environment access to the system site-packages dir (default: False)
Since the path to wx is /usr/lib64/python3.9/site-packages/wx it would seem likely that if you fed this path to the aforementioned option you might get the desired result.
I Hope it works…

Thanks to you all, I reached to have my wxPython program working fine on OM Lx 4.3 :slight_smile:
Your messages solved my issue quikly.
Cheers !

1 Like