wxPython 4.1.1 issue - OM LX 4.3

Hello,

  • OpenMandriva Lx version:
    OM Lx 4.3

  • Desktop environment (KDE, LXQT…):
    KDE

  • Description of the issue (screenshots if relevant):

wxPython 4.1.1 can’t load after install from dnfdragora

  • Relevant informations (hardware involved, software version, logs or output…):
[redge@redge-virtualbox env4.1.x-py39]$ 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>
  File "/usr/lib64/python3.9/site-packages/wx/__init__.py", line 17, in <module>
    from wx.core import *
  File "/usr/lib64/python3.9/site-packages/wx/core.py", line 12, in <module>
    from ._core import *
UnicodeDecodeError: 'utf-8' codec can't decode byte 0xc3 in position 261: invalid continuation byte
>>>

Any workaround ?

Thanks :slight_smile:

Same behaviour seen here. I am sorry that I cannot help you.

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 suspect that this is the bug in python’s sip, which is a vivid example of how several development groups cannot agree among themselves.
I can’t find a link to the description of how this bug was found, only to the proposed patch:

Thank you all for your answers !

So I tried to install wxPython4.1.1 from sources : it work out on OM LX4.2 previously.
But when I tried the same installation on OM LX4.3, I had this error message :

https://wxpython.org/blog/2017-08-17-builds-for-linux-with-pip/index.html

(env4.1.x-py39) [redge@redge-virtualbox env4.1.x-py39]$ pip wheel -v wxPython-4.1.1.tar.gz 2>&1 | tee build.log

  checking for lzma.h... yes
  checking for lzma_code in -llzma... yes
  checking for jbg_dec_init in -ljbig... no
  checking for LIBTIFF... yes
  checking for expat.h... yes
  checking if expat.h is valid C++ header... yes
  checking for XML_ParserCreate in -lexpat... yes
  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.
  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.

  Error running configure
  ERROR: failed building wxWidgets
  Traceback (most recent call last):
    File "/tmp/pip-req-build-p2b2l80y/build.py", line 1510, in cmd_build_wx
      wxbuild.main(wxDir(), build_options)
    File "/tmp/pip-req-build-p2b2l80y/buildtools/build_wxwidgets.py", line 372, in main
      exitIfError(wxBuilder.configure(dir=wxRootDir, options=configure_opts),
    File "/tmp/pip-req-build-p2b2l80y/buildtools/build_wxwidgets.py", line 85, in exitIfError
      raise builder.BuildError(msg)
  buildtools.builder.BuildError: Error running configure
  Finished command: build_wx (0m6.39s)
  Finished command: build (0m6.39s)
  Command '"/home/redge/Developpement/GestConsoPhoenix4.1.x--1.3.8/env4.1.x-py39/bin/python" -u build.py build' failed with exit code 1.
  error: subprocess-exited-with-error
  
  × python setup.py bdist_wheel did not run successfully.
  │ exit code: 1
  ╰─> See above for output.

The solution for this kind of error is to install the lib64gtk+3.0-devel file : but it is yet installed on my LX4.3 …

I suspect some inconsistency on Lx4.3, because on Lx4.2 all runs fine.

Would you mind to tell me which information I can give you about my system, in order to check whether the Lx4.3 system is well configured ?

Note :
I write a new version of my software which I would like to be compatible with OM Lx4.3.

Thanks again whatever you will tell me :slight_smile:

(env4.1.x-py39) [redge@redge-virtualbox env4.1.x-py39]$ pkg-config gtk+-3.0 --cflags -I/usr/include/gtk-3.0 -I/usr/include/pango-1.0 -I/usr/include/glib-2.0 -I/usr/lib64/glib-2.0/include -I/usr/include/harfbuzz -I/usr/include/freetype2 -I/usr/include/libpng16 -I/usr/include/libmount -I/usr/include/blkid -I/usr/include/fribidi -I/usr/include/uuid -I/usr/include/cairo -I/usr/include/pixman-1 -I/usr/include/gdk-pixbuf-2.0 -I/usr/include/gio-unix-2.0 -I/usr/include/atk-1.0 -I/usr/include/at-spi2-atk/2.0 -I/usr/include/dbus-1.0 -I/usr/lib64/dbus-1.0/include -I/usr/include/at-spi-2.0 -pthread

(env4.1.x-py39) [redge@redge-virtualbox env4.1.x-py39]$ 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 
(env4.1.x-py39) [redge@redge-virtualbox env4.1.x-py39]$ 

Basically this is how things work:

This package needs a package maintainer. OM Lx is a Community distribution of Linux. The way things get done is someone from OM Community volunteers to do it and then does it. Every package that is maintained is maintained by a Community volunteer.

@zylyco your efforts are much appreciated. If you need help with getting wxPython sorted you can find that help at OpenMandriva Cooker IRC. I know @Colin (itchka) has been trying to fix packages that don’t build. Also I believe @bero (berolinux) is starting to work on upgrading our python package stack. That is usually a major project. I am sure any project to get wxPython sorted would need to be adapted to any upgraded python packages.

Check if you installed lib64gtk+3.0-devel.

python2-2.7.18-1-omv4050.x86_64.rpm ???

Edit: I did this:

$ sudo dnf install --refresh lib64gtk+3.0-devel wxPython

and

$ 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'

But I need for Y’all to be sure you know that I do not know what I’m doing, except trying to test something I do not understand.

One question is if the right software is being installed to produce the module wx? Or is this changes in naming or paths?

LIst of packages that were installed:
wxPython.txt (26.9 KB)

Where would python be looking for module wx? If we look there does the module have a different name?

unfortunately anyone updated wxPythonGTK package to python3, as you can check with

 dnf repoquery --list wxPythonGTK

but python-wxpython4 is for python3 but is actually bugged.

2 ways to install wxPython 4.1.1 :

1 - from dnfdragora : you select the 3 packages :
python-wxpython4
python-wxpython4-media
python-wxpython4-webview
then in python terminal you can import “wx”, if all is going well.

2 - another method, you install from sources as this recipe :
https://wxpython.org/blog/2017-08-17-builds-for-linux-with-pip/index.html
in this case, GTK+3.0 “devel” is needed (among others packages “devel”), but even if it is installed, there is an error message when trying to build the wheel file (wxPython-4.1.1-cp39-cp39-linux_x86_64.whl), error solved usually by installing “lib64gtk+3.0-devel” but in OM Lx4.3 this doesn’t work properly.

Let me know if you need more information please.

Now it’s late here, I will check this post tomorrow.

Have a nice evening :slight_smile:

[redge@redge-virtualbox ~]$ sudo dnf install --refresh lib64gtk+3.0-devel

We trust you have received the usual lecture from the local System
Administrator. It usually boils down to these three things:

#1) Respect the privacy of others.
#2) Think before you type.
#3) With great power comes great responsibility.

[sudo] password for redge:
OpenMandriva Rock - x86_64 12 kB/s | 4.3 kB 00:00
OpenMandriva Rock - x86_64 - Updates 17 kB/s | 3.3 kB 00:00
Package lib64gtk+3.0-devel-3.24.31-1.x86_64 is already installed.
Dependencies resolved.
Nothing to do.
Complete!
[redge@redge-virtualbox ~]$

The fist way doesn’t work here:

$ python -c "import wx"
Traceback (most recent call last):
  File "<string>", line 1, in <module>
  File "/usr/lib64/python3.9/site-packages/wx/__init__.py", line 17, in <module>
    from wx.core import *
  File "/usr/lib64/python3.9/site-packages/wx/core.py", line 12, in <module>
    from ._core import *
UnicodeDecodeError: 'utf-8' codec can't decode byte 0xc3 in position 261: invalid continuation byte
free(): invalid pointer
Aborted (core dumped)

it seems wxPythonGTK is version3 of python-wxpython4, but there are still (working?) packages using it.

Uh, talk about an idiot trying to test something…

Did I do something here?

$ python -c "import wx”
>

That is certainly a different result here. That would be a result of this as far as I know:

$ sudo dnf install --refresh lib64gtk+3.0-devel wxPython python-wxpython4 python-wxpython4-media python-wxpython4-webview

Post edit: There is something weird about the " " marks. Seems like it only works sometimes.

What is the difference between:

$ python -c "import wx"
Traceback (most recent call last):
  File "<string>", line 1, in <module>
  File "/usr/lib64/python3.9/site-packages/wx/__init__.py", line 17, in <module>
    from wx.core import *
  File "/usr/lib64/python3.9/site-packages/wx/core.py", line 12, in <module>
    from ._core import *
UnicodeDecodeError: 'utf-8' codec can't decode byte 0xc3 in position 261: invalid continuation byte
free(): invalid pointer
Aborted (core dumped)

and:

$ python -c "import wx”
>

Post-edit: The diff seems like " vs. ” .

yes, discourse changes the double quote automatically when i used Blockquote … fixed with preformatted text.

btw python -c is a short way to give a simple command in python without going into interactive environment.

The problem here is that either way copying your commands did not work plus when I type:

$ python -c "import wx"

it also does not work. And I can’t remember what I copied and pasted that did work.

At any rate it looks like if that command requires quote marks then there is a bug with using quote marks somehow.

$ python -c “import wx”
  File "<string>", line 1
    “import
    ^
SyntaxError: invalid character '“' (U+201C)
$ python -c "import wx”
>

There is a difference in the first quote mark before the word import. The in second example is straight up and down the other is slanted. But this gets more weird in the second example that appears to be working the first quote mark is straight and the second quote mark is slanted. I can not reproduce that on my kbd which is why I think this may be a bug.

When I type the entire command on my kbd:

$ python -c "import wx"
Traceback (most recent call last):
  File "<string>", line 1, in <module>
  File "/usr/lib64/python3.9/site-packages/wx/__init__.py", line 17, in <module>
    from wx.core import *
  File "/usr/lib64/python3.9/site-packages/wx/core.py", line 12, in <module>
    from ._core import *
UnicodeDecodeError: 'utf-8' codec can't decode byte 0xc3 in position 261: invalid continuation byte
free(): invalid pointer
Aborted (core dumped)

This is to crazy.