Bug 1739469 - [abrt] python3-fsleyes: _Window___nonzero__(): core.py:2251:_Window___nonzero__:TypeError: isdeleted() argument 1 must be sip.simplewrapper, not Panel
Summary: [abrt] python3-fsleyes: _Window___nonzero__(): core.py:2251:_Window___nonzero...
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Fedora
Classification: Fedora
Component: sip
Version: 30
Hardware: x86_64
OS: Unspecified
unspecified
unspecified
Target Milestone: ---
Assignee: Rex Dieter
QA Contact: Fedora Extras Quality Assurance
URL: https://retrace.fedoraproject.org/faf...
Whiteboard: abrt_hash:8b7465fbe134edce292cebc7c41...
Depends On:
Blocks: F31BetaFreezeException
TreeView+ depends on / blocked
 
Reported: 2019-08-09 11:50 UTC by Ankur Sinha (FranciscoD)
Modified: 2019-09-21 00:01 UTC (History)
7 users (show)

Fixed In Version: sip-4.19.18-6.fc31
Doc Type: If docs needed, set a value
Doc Text:
Clone Of:
Environment:
Last Closed: 2019-09-21 00:01:21 UTC
Type: ---


Attachments (Terms of Use)
File: backtrace (741 bytes, text/plain)
2019-08-09 11:50 UTC, Ankur Sinha (FranciscoD)
no flags Details
File: cgroup (335 bytes, text/plain)
2019-08-09 11:50 UTC, Ankur Sinha (FranciscoD)
no flags Details
File: cpuinfo (1.34 KB, text/plain)
2019-08-09 11:50 UTC, Ankur Sinha (FranciscoD)
no flags Details
File: environ (8.30 KB, text/plain)
2019-08-09 11:50 UTC, Ankur Sinha (FranciscoD)
no flags Details
File: mountinfo (3.96 KB, text/plain)
2019-08-09 11:50 UTC, Ankur Sinha (FranciscoD)
no flags Details
File: namespaces (129 bytes, text/plain)
2019-08-09 11:50 UTC, Ankur Sinha (FranciscoD)
no flags Details
File: open_fds (1.21 KB, text/plain)
2019-08-09 11:50 UTC, Ankur Sinha (FranciscoD)
no flags Details


Links
System ID Private Priority Status Summary Last Updated
Red Hat Bugzilla 1601917 0 unspecified CLOSED ValueError: PyCapsule_GetPointer called with incorrect name 2021-02-22 00:41:40 UTC

Description Ankur Sinha (FranciscoD) 2019-08-09 11:50:08 UTC
Description of problem:
```
$ GDK_BACKEND=x11 fsleyes
  from collections import Iterable
  from collections import MutableMapping
  from collections import Mapping
  import imp
 WARNING          __init__.py  621: create          - GLContext callback function raised ValueError: PyCapsule_GetPointer called with incorrect name
Traceback (most recent call last):
  File "/usr/lib/python3.7/site-packages/fsleyes/gl/__init__.py", line 615, in create
    ready()
  File "/usr/lib/python3.7/site-packages/fsleyes/main.py", line 537, in realCallback
    callback()
  File "/usr/lib/python3.7/site-packages/fsleyes/main.py", line 343, in buildGui
    frame = makeFrame(namespace[0], displayCtx, overlayList, splash)
  File "/usr/lib/python3.7/site-packages/fsleyes/main.py", line 734, in makeFrame
    fontSize=namespace.fontSize)
  File "/usr/lib/python3.7/site-packages/fsleyes/frame.py", line 298, in __init__
    self.__makeMenuBar()
  File "/usr/lib/python3.7/site-packages/fsleyes/frame.py", line 1521, in __makeMenuBar
    self.refreshToolsMenu()
  File "/usr/lib/python3.7/site-packages/fsleyes/frame.py", line 706, in refreshToolsMenu
    self.__toolsMenuActions = self.__makeToolsMenu()
  File "/usr/lib/python3.7/site-packages/fsleyes/frame.py", line 1910, in __makeToolsMenu
    actionItems.extend(self.__makeViewPanelTools())
  File "/usr/lib/python3.7/site-packages/fsleyes/frame.py", line 1928, in __makeViewPanelTools
    from fsleyes.views.shellpanel         import ShellPanel
  File "/usr/lib/python3.7/site-packages/fsleyes/views/shellpanel.py", line 13, in <module>
    import wx.py.shell       as wxshell
  File "/usr/lib64/python3.7/site-packages/wx/py/__init__.py", line 6, in <module>
    from . import crust
  File "/usr/lib64/python3.7/site-packages/wx/py/crust.py", line 13, in <module>
    from . import editwindow
  File "/usr/lib64/python3.7/site-packages/wx/py/editwindow.py", line 6, in <module>
    from wx import stc
  File "/usr/lib64/python3.7/site-packages/wx/stc.py", line 12, in <module>
    from ._stc import *
ValueError: PyCapsule_GetPointer called with incorrect name


```

Looks like a library error. Needs investigation.

Version-Release number of selected component:
python3-fsleyes-0.30.0-2.fc30

Additional info:
reporter:       libreport-2.10.1
cmdline:        /usr/bin/python3 /usr/bin/fsleyes
crash_function: _Window___nonzero__
exception_type: TypeError
executable:     /usr/bin/fsleyes
interpreter:    python3-3.7.4-1.fc30.x86_64
kernel:         5.2.5-200.fc30.x86_64
runlevel:       N 5
type:           Python3
uid:            1000

Truncated backtrace:
core.py:2251:_Window___nonzero__:TypeError: isdeleted() argument 1 must be sip.simplewrapper, not Panel

Traceback (most recent call last):
  File "/usr/lib64/python3.7/site-packages/wx/lib/agw/aui/framemanager.py", line 4604, in OnDestroy
    self.UnInit()
  File "/usr/lib64/python3.7/site-packages/wx/lib/agw/aui/framemanager.py", line 4578, in UnInit
    if not self._frame:
  File "/usr/lib64/python3.7/site-packages/wx/core.py", line 2251, in _Window___nonzero__
    return not sip.isdeleted(self)
TypeError: isdeleted() argument 1 must be sip.simplewrapper, not Panel

Local variables in innermost frame:
self: <wx._core.Panel object at 0x7f46995d0910>
sip: <module 'PyQt5.sip' from '/usr/lib64/python3.7/site-packages/PyQt5/sip.so'>

Comment 1 Ankur Sinha (FranciscoD) 2019-08-09 11:50:10 UTC
Created attachment 1602147 [details]
File: backtrace

Comment 2 Ankur Sinha (FranciscoD) 2019-08-09 11:50:11 UTC
Created attachment 1602148 [details]
File: cgroup

Comment 3 Ankur Sinha (FranciscoD) 2019-08-09 11:50:12 UTC
Created attachment 1602149 [details]
File: cpuinfo

Comment 4 Ankur Sinha (FranciscoD) 2019-08-09 11:50:13 UTC
Created attachment 1602150 [details]
File: environ

Comment 5 Ankur Sinha (FranciscoD) 2019-08-09 11:50:14 UTC
Created attachment 1602151 [details]
File: mountinfo

Comment 6 Ankur Sinha (FranciscoD) 2019-08-09 11:50:15 UTC
Created attachment 1602152 [details]
File: namespaces

Comment 7 Ankur Sinha (FranciscoD) 2019-08-09 11:50:15 UTC
Created attachment 1602153 [details]
File: open_fds

Comment 8 Zbigniew Jędrzejewski-Szmek 2019-08-12 17:08:07 UTC
There are at least two bugs here. The first is that  GDK_BACKEND=x11 needs to be set. IMHO /usr/bin/fsleyes should just
set this internally, until wx is updated to support wayland backend.

The second issue is the PyCapsule_GetPointer crash. I'll open a separate bug for this.

Comment 9 Zbigniew Jędrzejewski-Szmek 2019-08-12 17:34:12 UTC
The PR makes 'GDK_BACKEND=x11 fsleyes' work: https://src.fedoraproject.org/rpms/python-wxpython4/pull-request/2.

Comment 10 Scott Talbert 2019-08-13 02:49:29 UTC
I can't reproduce the PyCapsule_GetPointer crash in either a fully updated F30 or Rawhide.

What versions of python3-wxpython4 and python3-sip were you running when you saw this problem?

Comment 11 Ankur Sinha (FranciscoD) 2019-08-13 07:36:39 UTC
Odd, I can reproduce this each time. Are you on Wayland?

$ rpm -qa \*wx\* \*sip\* \*fsl\*
python3-fsleyes-0.30.0-2.fc30.noarch
wxBase3-3.0.4-8.fc30.x86_64
python3-fslpy-2.3.1-1.fc30.noarch
python3-wxnatpy-0.3.1-3.fc30.noarch
wxGTK3-i18n-3.0.4-8.fc30.noarch
python3-fsleyes-widgets-0.7.3-1.fc30.noarch
wxGTK3-3.0.4-8.fc30.x86_64
python3-wxpython4-4.0.4-3.fc30.x86_64
wxGTK3-gl-3.0.4-8.fc30.x86_64
python3-fsleyes-props-1.6.5-1.fc30.noarch
python3-sip-4.19.17-1.fc30.x86_64
python3-matplotlib-wx-3.0.3-2.fc30.x86_64
python3-pyqt5-sip-4.19.17-1.fc30.x86_64


(ins)[asinha@ankur-pc  ~]$ GDK_BACKEND=x11 fsleyes
  from collections import Iterable
  from collections import MutableMapping
  from collections import Mapping
  import imp
 WARNING          __init__.py  621: create          - GLContext callback function raised ValueError: PyCapsule_GetPointer called with incorrect name
Traceback (most recent call last):
  File "/usr/lib/python3.7/site-packages/fsleyes/gl/__init__.py", line 615, in create
    ready()
  File "/usr/lib/python3.7/site-packages/fsleyes/main.py", line 537, in realCallback
    callback()
  File "/usr/lib/python3.7/site-packages/fsleyes/main.py", line 343, in buildGui
    frame = makeFrame(namespace[0], displayCtx, overlayList, splash)
  File "/usr/lib/python3.7/site-packages/fsleyes/main.py", line 734, in makeFrame
    fontSize=namespace.fontSize)
  File "/usr/lib/python3.7/site-packages/fsleyes/frame.py", line 298, in __init__
    self.__makeMenuBar()
  File "/usr/lib/python3.7/site-packages/fsleyes/frame.py", line 1521, in __makeMenuBar
    self.refreshToolsMenu()
  File "/usr/lib/python3.7/site-packages/fsleyes/frame.py", line 706, in refreshToolsMenu
    self.__toolsMenuActions = self.__makeToolsMenu()
  File "/usr/lib/python3.7/site-packages/fsleyes/frame.py", line 1910, in __makeToolsMenu
    actionItems.extend(self.__makeViewPanelTools())
  File "/usr/lib/python3.7/site-packages/fsleyes/frame.py", line 1928, in __makeViewPanelTools
    from fsleyes.views.shellpanel         import ShellPanel
  File "/usr/lib/python3.7/site-packages/fsleyes/views/shellpanel.py", line 13, in <module>
    import wx.py.shell       as wxshell
  File "/usr/lib64/python3.7/site-packages/wx/py/__init__.py", line 6, in <module>
    from . import crust
  File "/usr/lib64/python3.7/site-packages/wx/py/crust.py", line 13, in <module>
    from . import editwindow
  File "/usr/lib64/python3.7/site-packages/wx/py/editwindow.py", line 6, in <module>
    from wx import stc
  File "/usr/lib64/python3.7/site-packages/wx/stc.py", line 12, in <module>
    from ._stc import *
ValueError: PyCapsule_GetPointer called with incorrect name
^CTraceback (most recent call last):
  File "/usr/lib64/python3.7/site-packages/wx/lib/agw/aui/framemanager.py", line 4604, in OnDestroy
    self.UnInit()
  File "/usr/lib64/python3.7/site-packages/wx/lib/agw/aui/framemanager.py", line 4578, in UnInit
    if not self._frame:
  File "/usr/lib64/python3.7/site-packages/wx/core.py", line 2251, in _Window___nonzero__
    return not sip.isdeleted(self)
TypeError: isdeleted() argument 1 must be sip.simplewrapper, not Panel
Error in atexit._run_exitfuncs:
wx._core.wxAssertionError: C++ assertion "GetEventHandler() == this" failed at ../src/common/wincmn.cpp(477) in ~wxWindowBase(): any pushed event handlers must have been removed

Comment 12 Scott Talbert 2019-08-13 13:07:37 UTC
My main F30 system isn't on Wayland, but I tested on Rawhide with Wayland.

Is there anything else I have to do with the application to make it do this?  For example, I get an error upon startup about it not being able to find the $FSLEYES directory or something.  Do I need to resolve that somehow?

Comment 13 Ankur Sinha (FranciscoD) 2019-08-13 13:22:29 UTC
(In reply to Scott Talbert from comment #12)
> My main F30 system isn't on Wayland, but I tested on Rawhide with Wayland.
> 
> Is there anything else I have to do with the application to make it do this?
> For example, I get an error upon startup about it not being able to find the
> $FSLEYES directory or something.  Do I need to resolve that somehow?

No, that's a warning that can be ignored. That comes up after the tool has loaded properly (which isn't happening for us).

Comment 14 Scott Talbert 2019-08-13 13:44:38 UTC
Okay, I'll keep looking.  What's curious about your original report is that the PyQt5 sip module showed up somehow:
sip: <module 'PyQt5.sip' from '/usr/lib64/python3.7/site-packages/PyQt5/sip.so'>

I'll try having that installed and see if that causes it to fail.

Comment 15 Zbigniew Jędrzejewski-Szmek 2019-08-13 13:57:31 UTC
$ rpm -qa \*wx\* \*sip\* \*fsl\* | sort
python2-pyqt4-sip-4.19.17-1.fc30.x86_64
python2-pyqt5-sip-4.19.17-1.fc30.x86_64
python2-sip-4.19.17-1.fc30.x86_64
python2-sip-devel-4.19.17-1.fc30.x86_64
python2-wxpython-3.0.2.0-25.fc30.x86_64
python3-fsleyes-0.30.0-2.fc30.noarch
python3-fsleyes-props-1.6.5-1.fc30.noarch
python3-fsleyes-widgets-0.7.3-1.fc30.noarch
python3-fslpy-2.3.1-1.fc30.noarch
python3-matplotlib-wx-3.0.3-2.fc30.x86_64
python3-pyqt5-sip-4.19.17-1.fc30.x86_64
python3-sip-4.19.17-1.fc30.x86_64
python3-sip-devel-4.19.17-1.fc30.x86_64
python3-wxnatpy-0.3.1-3.fc30.noarch
python3-wxpython4-4.0.4-3.fc30.x86_64
sip-4.19.17-1.fc30.x86_64
wxBase3-3.0.4-8.fc30.x86_64
wxGTK3-3.0.4-8.fc30.x86_64
wxGTK3-gl-3.0.4-8.fc30.x86_64
wxGTK3-i18n-3.0.4-8.fc30.noarch
wxGTK3-media-3.0.4-8.fc30.x86_64
wxGTK3-webview-3.0.4-8.fc30.x86_64

... and I get the same error about PyCapsule_GetPointer.

Comment 16 Zbigniew Jędrzejewski-Szmek 2019-08-13 14:04:08 UTC
Oh! If I remove python3-pyqt5-sip-4.19.17-1.fc30.x86_64, the error goes away.

$ sudo dnf remove python3-pyqt5-sip-4.19.17-1.fc30.x86_64
Dependencies resolved.
==================================================================================================================
 Package                            Architecture       Version                    Repository                 Size
==================================================================================================================
Removing:
 python3-pyqt5-sip                  x86_64             4.19.17-1.fc30             @updates                  352 k
Removing dependent packages:
 python3-matplotlib-qt5             x86_64             3.0.3-2.fc30               @updates                    0  
 python3-qt5                        x86_64             5.12.2-5.fc30              @updates                   13 M
 python3-qt5-base                   x86_64             5.12.2-5.fc30              @updates                   28 M
 python3-qt5-webkit                 x86_64             5.12.2-5.fc30              @updates                  950 k
 python3-scikit-image               x86_64             0.14.2-1.fc30              @updates                   40 M
 vitables                           noarch             3.0.0-6.fc31               @@commandline             1.5 M
 vitables-doc                       noarch             3.0.0-6.fc31               @@commandline             8.5 M
...

If I then reinstall python3-pyqt5-sip, the error doesn't occur.
When I reinstall python3-qt5-base-5.12.2-5.fc30.x86_64 the error happens again.

So this seems to be some incompatibility between python3-qt5-base and python3-wxpython4.

HTH.

Comment 17 Scott Talbert 2019-08-14 00:22:26 UTC
Okay, I've reduced the problem to the following:

$ python3
Python 3.7.4 (default, Jul  9 2019, 16:32:37) 
[GCC 9.1.1 20190503 (Red Hat 9.1.1-1)] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import PyQt5.sip
>>> import wx
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/usr/lib64/python3.7/site-packages/wx/__init__.py", line 17, in <module>
    from wx.core import *
  File "/usr/lib64/python3.7/site-packages/wx/core.py", line 12, in <module>
    from ._core import *
ValueError: PyCapsule_GetPointer called with incorrect name
>>> 

The problem is because of the following, which doesn't make any sense to me:

$ python3
Python 3.7.4 (default, Jul  9 2019, 16:32:37) 
[GCC 9.1.1 20190503 (Red Hat 9.1.1-1)] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import PyQt5.sip
>>> import sip
>>> sip
<module 'PyQt5.sip' from '/usr/lib64/python3.7/site-packages/PyQt5/sip.so'>
>>> 

Why is the PyQt5.sip module getting set as the non-namespaced sip module when I do 'import sip'?  Is that how Python's import mechanism is supposed to work?

Comment 18 Ankur Sinha (FranciscoD) 2019-08-14 07:40:35 UTC
I looked into it a bit more. Until `import sip` is run, sip is not defined but after `import sip`, sip points to the `PyQt5.sip` module:


$ ipython3 
Python 3.7.4 (default, Jul  9 2019, 16:32:37) 
Type 'copyright', 'credits' or 'license' for more information
IPython 7.2.0 -- An enhanced Interactive Python. Type '?' for help.

In [1]: import PyQt5.sip                                   

In [2]: sip                                                
---------------------------------------------------------------------------
NameError                                 Traceback (most recent call last)
<ipython-input-2-0992bfba5214> in <module>
----> 1 sip

NameError: name 'sip' is not defined

In [3]: import sip                                         

In [4]: sip                                                
Out[4]: <module 'PyQt5.sip' from '/usr/lib64/python3.7/site-packages/PyQt5/sip.so'>

In [5]:                     


This seems to be because on successive imports, python simply uses the cached module values in `sys.modules`. As the next test shows, the `sip` module name does indeed point to PyQt5.sip. Here, PyQt5, sip and PyQt5.sip are all already cached. This also seems to be normal behaviour for "regular packages" in Python: https://docs.python.org/3/reference/import.html#regular-packages

                               
$ ipython3 
Python 3.7.4 (default, Jul  9 2019, 16:32:37) 
Type 'copyright', 'credits' or 'license' for more information
IPython 7.2.0 -- An enhanced Interactive Python. Type '?' for help.

In [1]: import PyQt5.sip                                   

In [2]: import sys                                         

In [3]: print(sys.modules)            

......
 'jedi.evaluate.context.namespace': <module 'jedi.evaluate.context.namespace' from '/usr/lib/python3.7/site-packages/jedi/evaluate/context/namespace.py'>, 'PyQt5': <module 'Py
Qt5' from '/usr/lib64/python3.7/site-packages/PyQt5/__init__.py'>, 'sip': <module 'PyQt5.sip' from '/usr/lib64/python3.7/site-packages/PyQt5/sip.so'>, 'PyQt5.sip': <module 'PyQt5.sip' from '/usr/lib64/python3.7/site-packages/PyQt5/sip.so'
>}                                                                                                                                                                                                                                            
                                                                                    


As you've pointed out, wx seems to have issues with PyQt5.sip (pyqt5 bug?), so if we ensure that it *never* imports PyQt5.sip, it'll always use the standalone sip module (and not crash)?

Comment 19 Ankur Sinha (FranciscoD) 2019-08-14 07:56:22 UTC
(In reply to Zbigniew Jędrzejewski-Szmek from comment #16)
> <snip>
> ...
> 
> If I then reinstall python3-pyqt5-sip, the error doesn't occur.
> When I reinstall python3-qt5-base-5.12.2-5.fc30.x86_64 the error happens
> again.
> 
> So this seems to be some incompatibility between python3-qt5-base and
> python3-wxpython4.

I'm not able to reproduce this unfortunately. It seems wx just doesn't work with PyQt5.sip here:


*** Without PyQt5.sip

$ rpm -qa \*python3-pyqt5\*
(ins)[asinha@CS-1E114-2  ~]$ ipython3
Python 3.7.3 (default, May 11 2019, 00:38:04)
Type 'copyright', 'credits' or 'license' for more information
IPython 7.2.0 -- An enhanced Interactive Python. Type '?' for help.

In [1]: import sip

In [2]: sip
Out[2]: <module 'sip' from '/usr/lib64/python3.7/site-packages/sip.so'>

In [3]: import ex
---------------------------------------------------------------------------
ModuleNotFoundError                       Traceback (most recent call last)
<ipython-input-3-166c19b5e415> in <module>
----> 1 import ex

ModuleNotFoundError: No module named 'ex'

In [4]: import wx

In [5]:
Do you really want to exit ([y]/n)? y


-- Now I install PyQt5.sip ---

(ins)[asinha@CS-1E114-2  ~]$ sudo dnf install python3-pyqt5-sip
Last metadata expiration check: 0:05:46 ago on Wed 14 Aug 2019 08:45:03 BST.
Dependencies resolved.
==============================================================================================================================================================================================================================================
 Package                                                        Architecture                                        Version                                                        Repository                                            Size
==============================================================================================================================================================================================================================================
Installing:
 python3-pyqt5-sip                                              x86_64                                              4.19.17-1.fc30                                                 updates                                               89 k

Transaction Summary
==============================================================================================================================================================================================================================================
Install  1 Package

Total download size: 89 k
Installed size: 352 k
Is this ok [y/N]: y
Downloading Packages:
python3-pyqt5-sip-4.19.17-1.fc30.x86_64.rpm                                                                                                                                                                   1.4 MB/s |  89 kB     00:00
----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
Total                                                                                                                                                                                                         131 kB/s |  89 kB     00:00
Running transaction check
Transaction check succeeded.
Running transaction test
Transaction test succeeded.
Running transaction
  Preparing        :                                                                                                                                                                                                                      1/1
  Installing       : python3-pyqt5-sip-4.19.17-1.fc30.x86_64                                                                                                                                                                              1/1
  Running scriptlet: python3-pyqt5-sip-4.19.17-1.fc30.x86_64                                                                                                                                                                              1/1
  Verifying        : python3-pyqt5-sip-4.19.17-1.fc30.x86_64                                                                                                                                                                              1/1

Installed:
  python3-pyqt5-sip-4.19.17-1.fc30.x86_64

Complete!


*** Works with standalone sip even if PyQt5.sip is installed, as long as PyQt5.sip is *not* imported:

(ins)[asinha@CS-1E114-2  ~]$ ipython3
Python 3.7.3 (default, May 11 2019, 00:38:04)
Type 'copyright', 'credits' or 'license' for more information
IPython 7.2.0 -- An enhanced Interactive Python. Type '?' for help.

In [1]: import sip

In [2]: sip
Out[2]: <module 'sip' from '/usr/lib64/python3.7/site-packages/sip.so'>

In [3]: import wx

In [4]:
Do you really want to exit ([y]/n)? y



*** Doesn't work with PyQt5.sip:

(ins)[asinha@CS-1E114-2  ~]$ ipython3
Python 3.7.3 (default, May 11 2019, 00:38:04)
Type 'copyright', 'credits' or 'license' for more information
IPython 7.2.0 -- An enhanced Interactive Python. Type '?' for help.

In [1]: import PyQt5.sip

In [2]: import wx
---------------------------------------------------------------------------
ValueError                                Traceback (most recent call last)
<ipython-input-2-03faa7660341> in <module>
----> 1 import wx

/usr/lib64/python3.7/site-packages/wx/__init__.py in <module>
     15 # Import all items from the core wxPython module so they appear in the wx
     16 # package namespace.
---> 17 from wx.core import *
     18
     19

/usr/lib64/python3.7/site-packages/wx/core.py in <module>
     10 """
     11
---> 12 from ._core import *
     13
     14 #-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=

ValueError: PyCapsule_GetPointer called with incorrect name

In [3]: import sip

In [4]: import wx
---------------------------------------------------------------------------
AttributeError                            Traceback (most recent call last)
<ipython-input-4-03faa7660341> in <module>
----> 1 import wx

/usr/lib64/python3.7/site-packages/wx/__init__.py in <module>
     10 # Load the main version string into the package namespace
     11 import wx.__version__
---> 12 __version__ = wx.__version__.VERSION_STRING
     13
     14

AttributeError: module 'wx' has no attribute '__version__'

In [5]:
Do you really want to exit ([y]/n)? y





(ins)[asinha@CS-1E114-2  ~]$ ipython3
impoPython 3.7.3 (default, May 11 2019, 00:38:04)
Type 'copyright', 'credits' or 'license' for more information
IPython 7.2.0 -- An enhanced Interactive Python. Type '?' for help.
r
In [1]: import PyQt5.sip as sip

In [2]: import wx
---------------------------------------------------------------------------
ValueError                                Traceback (most recent call last)
<ipython-input-2-03faa7660341> in <module>
----> 1 import wx

/usr/lib64/python3.7/site-packages/wx/__init__.py in <module>
     15 # Import all items from the core wxPython module so they appear in the wx
     16 # package namespace.
---> 17 from wx.core import *
     18
     19

/usr/lib64/python3.7/site-packages/wx/core.py in <module>
     10 """
     11
---> 12 from ._core import *
     13
     14 #-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=

ValueError: PyCapsule_GetPointer called with incorrect name

In [3]:
Do you really want to exit ([y]/n)? y





(ins)[asinha@CS-1E114-2  ~]$ ipython3
Python 3.7.3 (default, May 11 2019, 00:38:04)
Type 'copyright', 'credits' or 'license' for more information
IPython 7.2.0 -- An enhanced Interactive Python. Type '?' for help.

In [1]: import PyQt5.sip

In [2]: import sip

In [3]: sip
Out[3]: <module 'PyQt5.sip' from '/usr/lib64/python3.7/site-packages/PyQt5/sip.so'>

In [4]: import wx
---------------------------------------------------------------------------
ValueError                                Traceback (most recent call last)
<ipython-input-4-03faa7660341> in <module>
----> 1 import wx

/usr/lib64/python3.7/site-packages/wx/__init__.py in <module>
     15 # Import all items from the core wxPython module so they appear in the wx
     16 # package namespace.
---> 17 from wx.core import *
     18
     19

/usr/lib64/python3.7/site-packages/wx/core.py in <module>
     10 """
     11
---> 12 from ._core import *
     13
     14 #-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=

ValueError: PyCapsule_GetPointer called with incorrect name

In [5]:
Do you really want to exit ([y]/n)? y

Comment 20 Scott Talbert 2019-08-15 04:20:53 UTC
@Ankur, no more troubleshooting needed, thanks.  I understand the problem, just need to figure out options for fixing it.

Comment 21 Scott Talbert 2019-08-15 23:41:44 UTC
@Rex,

It seems that we have a conflict between the PyQt sip modules and the public sip module.  The issue is that if the PyQt module is imported first, the public sip module is broken.  Here's a reproducer:

$ python3
Python 3.7.4 (default, Jul  9 2019, 16:32:37) 
[GCC 9.1.1 20190503 (Red Hat 9.1.1-1)] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import PyQt5.sip
>>> import sip
>>> sip
<module 'PyQt5.sip' from '/usr/lib64/python3.7/site-packages/PyQt5/sip.so'>
>>> 

The root cause is that the PyQt sip modules install themselves in the public namespace for "backwards compatibility."

To fix this I see the following options:

1) Patch PyQt to use the public sip module.  From a pure Fedora perspective of unbundling everything, this makes the most sense.  FTR, this is what Debian does, see: https://sources.debian.org/src/pyqt5/5.11.3+dfsg-1/debian/patches/public_sip.diff/

2) Patch sip to stop the private sip modules from installing themselves as the public sip module.  The patch is pretty simple, but it would probably need to be retained forever as upstream seems to be deprecating the public sip module.

3) Update sip packaging to start generating a private sip module (wx.siplib) for wxPython also.  This approach probably is most consistent with upstream sip and wxPython, but results in duplicated binaries that do exactly the same thing.

What's your preference on the solution?

Comment 22 Rex Dieter 2019-08-17 13:59:58 UTC
I suggest asking PyQt upstream, this is effectively a problem of their own making.

To be clear, this is a case of an application/library that ends up pulling in dependencies that depend on both PyQt5 and wxPython?

Comment 23 Rex Dieter 2019-08-17 14:06:48 UTC
Reading the prior comments, that does appear to be the case.  and, looking at wxpython package, I see unbundle-sip.patch which also appears to undo using a private wx.siplib.

So, while I still think asking upstream is the way to go, option 3 and dropping that non-upstreamed patch seems to be the path of least resistance to me.

unbundle-sip.patch doesn't seem to have any reasoning or justification mentioned in the .spec, why is that being used?

Comment 24 Scott Talbert 2019-08-17 15:18:08 UTC
(In reply to Rex Dieter from comment #23)
> Reading the prior comments, that does appear to be the case.  and, looking
> at wxpython package, I see unbundle-sip.patch which also appears to undo
> using a private wx.siplib.
> 
> So, while I still think asking upstream is the way to go, option 3 and
> dropping that non-upstreamed patch seems to be the path of least resistance
> to me.
> 
> unbundle-sip.patch doesn't seem to have any reasoning or justification
> mentioned in the .spec, why is that being used?

The actual problem is somewhat complicated.  fsleyes uses only wxPython (and not PyQt), but it also uses matplotlib, which imports PyQt (if it is present) as part of its backend detection.  So PyQt gets imported but not actually used, but that's enough to break things.

We've discussed the unbundling before.  :-). Basically it's done because of Fedora's policy against bundling, plus the fact that wxPython doesn't include the complete source for sip, so it's not actually possible to build it from the bundled copy.  The upstream build process for wxPython downloads precompiled binaries from the internet.

I will ask upstream for their thoughts on the matter but I suspect their answer will be to use a private sip module as they have been trying to deprecate the public one.

Assuming we go with option 3, do you want me to provide a patch for that?

Comment 25 Rex Dieter 2019-08-18 01:35:38 UTC
Bundling policy is different and better now... recent version only encourages unbundling *if upstream supports it*

As for option 3, I guess I was opting for you to simply drop use of unbundle-sip.patch, is that alone not sufficient?

Comment 26 Scott Talbert 2019-08-18 03:00:52 UTC
(In reply to Rex Dieter from comment #25)
> Bundling policy is different and better now... recent version only
> encourages unbundling *if upstream supports it*
> 
> As for option 3, I guess I was opting for you to simply drop use of
> unbundle-sip.patch, is that alone not sufficient?

Did you not read my earlier comment about it not being possible to build wxPython's bundled sip copy?

Comment 27 Fedora Update System 2019-08-20 15:09:34 UTC
FEDORA-EPEL-2019-bcc0722d63 has been submitted as an update to Fedora EPEL 8. https://bodhi.fedoraproject.org/updates/FEDORA-EPEL-2019-bcc0722d63

Comment 28 Scott Talbert 2019-08-20 15:28:10 UTC
Upstream's response was basically as I expected - that he doesn't really support use of the top-level sip module anymore.  So I guess let's go with option 3 for a fix.  I'm working on a patch for sip, but hampered a bit at the moment due to broken mock.

Sorry for comment #27 - I accidentally tagged this bug in another spec changelog.

Comment 29 Rex Dieter 2019-08-20 15:29:47 UTC
what's wxpython upstream's take on the issue?  their bundled sip broken too?

Comment 30 Scott Talbert 2019-08-20 15:42:09 UTC
(In reply to Rex Dieter from comment #29)
> what's wxpython upstream's take on the issue?  their bundled sip broken too?

Like I explained earlier, wxpython's upstream build process downloads a precompiled sipgen binary.  So, yes, the bundled siplib is broken from a Fedora perspective.

Comment 31 Rex Dieter 2019-08-20 15:52:25 UTC
sorry, that's just horrible. :(

wxpython process is in the least against the spirit of opensource, at worst, against the letter as well.  Has fedora legal reviewed that situation?

Comment 32 Rex Dieter 2019-08-20 15:54:56 UTC
So I (we) and others don't have to go through this extended explanation again, can that situation please be documented in the package somewhere?  Either in the patch, or .spec, or README, or something.

Comment 33 Fedora Update System 2019-08-21 02:45:22 UTC
python-execnet-1.6.0-1.el8.2 has been pushed to the Fedora EPEL 8 testing repository. If problems still persist, please make note of it in this bug report.
See https://fedoraproject.org/wiki/QA:Updates_Testing for
instructions on how to install test updates.
You can provide feedback for this update here: https://bodhi.fedoraproject.org/updates/FEDORA-EPEL-2019-bcc0722d63

Comment 34 Scott Talbert 2019-08-28 02:07:05 UTC
Pull request for the sip package change part of this:
https://src.fedoraproject.org/rpms/sip/pull-request/8

Comment 35 Rex Dieter 2019-08-28 15:35:12 UTC
merged, building for rawhide.

Moving forward, will likely require maintanence help carrying that patch forward (if it ever requires non-trivial rebasing)

Comment 36 Scott Talbert 2019-08-28 15:41:41 UTC
(In reply to Rex Dieter from comment #35)
> merged, building for rawhide.
> 
> Moving forward, will likely require maintanence help carrying that patch
> forward (if it ever requires non-trivial rebasing)

Thanks.  I would like to also get this backported to F31 and F30, but let me get wxpython (and I think fsleyes) changes merged in Rawhide first.  We'll probably want a coordinated Bodhi update for F31 and F30.

No problem on helping maintain that patch.  Upstream sip didn't seem interested in wanting to fix that in sip 4.x, but he says that sip 5.x is not affected so it should be able to be dropped when 5.x comes along.

Comment 37 Rex Dieter 2019-08-28 16:12:55 UTC
sounds like a good plan, *thumbs-up*

Comment 38 Scott Talbert 2019-08-30 03:56:16 UTC
Okay, the wxpython changes are done in rawhide and here's the fsleyes change: https://src.fedoraproject.org/rpms/python-fsleyes/pull-request/1

After that, Rex, if you want to build the sip changes in F31 and F30 that would be appreciated.  F31 could probably just be fast-forwarded.  F30, I'm not sure if you want to push 4.19.18 back, so might need to do a separate patch there if you don't want to do that.

Comment 39 Scott Talbert 2019-09-03 13:33:45 UTC
Rex, I think we're ready for the sip updates in F31 and F30, whenever you have time. Thanks.

Comment 40 Fedora Update System 2019-09-09 08:14:21 UTC
FEDORA-2019-d10d453d2b has been submitted as an update to Fedora 30. https://bodhi.fedoraproject.org/updates/FEDORA-2019-d10d453d2b

Comment 41 Fedora Update System 2019-09-09 08:15:20 UTC
FEDORA-2019-e58677d9dd has been submitted as an update to Fedora 31. https://bodhi.fedoraproject.org/updates/FEDORA-2019-e58677d9dd

Comment 42 Fedora Update System 2019-09-09 23:15:45 UTC
python-fsleyes-0.30.1-1.fc31, python-fsleyes-widgets-0.8.0-1.fc31, python-fslpy-2.5.0-1.fc31, python-wxpython4-4.0.6-8.fc31, sip-4.19.18-6.fc31 has been pushed to the Fedora 31 testing repository. If problems still persist, please make note of it in this bug report.
See https://fedoraproject.org/wiki/QA:Updates_Testing for
instructions on how to install test updates.
You can provide feedback for this update here: https://bodhi.fedoraproject.org/updates/FEDORA-2019-e58677d9dd

Comment 43 Fedora Update System 2019-09-11 02:58:30 UTC
python-fsleyes-0.30.1-1.fc30, python-fsleyes-widgets-0.8.0-1.fc30, python-fslpy-2.5.0-1.fc30, python-wxpython4-4.0.6-8.fc30, sip-4.19.18-5.fc30 has been pushed to the Fedora 30 testing repository. If problems still persist, please make note of it in this bug report.
See https://fedoraproject.org/wiki/QA:Updates_Testing for
instructions on how to install test updates.
You can provide feedback for this update here: https://bodhi.fedoraproject.org/updates/FEDORA-2019-d10d453d2b

Comment 44 Fedora Blocker Bugs Application 2019-09-12 15:42:38 UTC
Proposed as a Freeze Exception for 31-beta by Fedora user zbyszek using the blocker tracking app because:

 fsleyes package is unusable (crash on startup) without the patches in this update.

Comment 45 Fedora Update System 2019-09-19 01:29:21 UTC
python-fsleyes-0.30.1-1.fc30, python-fsleyes-widgets-0.8.0-1.fc30, python-fslpy-2.5.0-1.fc30, python-wxpython4-4.0.6-8.fc30, sip-4.19.18-5.fc30 has been pushed to the Fedora 30 stable repository. If problems still persist, please make note of it in this bug report.

Comment 46 Fedora Update System 2019-09-21 00:01:21 UTC
python-fsleyes-0.30.1-1.fc31, python-fsleyes-widgets-0.8.0-1.fc31, python-fslpy-2.5.0-1.fc31, python-wxpython4-4.0.6-8.fc31, sip-4.19.18-6.fc31 has been pushed to the Fedora 31 stable repository. If problems still persist, please make note of it in this bug report.


Note You need to log in before you can comment on or make changes to this bug.