Bug report #20542

PyCapsule_GetPointer called with incorrect name

Added by codywohlers _ almost 2 years ago. Updated over 1 year ago.

Status:Closed
Priority:Normal
Assignee:-
Category:Python bindings / sipify
Affected QGIS version:3.4.1 Regression?:No
Operating System:KDE neon LTS User Edition 5.12 (bionic) Linux 4.15.0-39-generic x86_64 Easy fix?:No
Pull Request or Patch supplied:No Resolution:invalid
Crashes QGIS or corrupts data:No Copied to github as #:28362

Description

Couldn't load SIP module.
Python support will be disabled.

Traceback (most recent call last):
  File "", line 1, in 
  File "/usr/lib/python3/dist-packages/qgis/__init__.py", line 80, in 
    import qgis.gui
  File "/usr/lib/python3/dist-packages/qgis/gui/__init__.py", line 27, in 
    from qgis._gui import *
ValueError: PyCapsule_GetPointer called with incorrect name

Python version:
3.6.6 (default, Sep 12 2018, 18:26:19) 
[GCC 8.0.1 20180414 (experimental) [trunk revision 259383]]

QGIS version:
3.4.1-Madeira 'Madeira', 383851c

Python path:
['/usr/share/qgis/python', '/home/codyw/.local/share/QGIS/QGIS3/profiles/default/python', '/home/codyw/.local/share/QGIS/QGIS3/profiles/default/python/plugins', '/usr/share/qgis/python/plugins', '/usr/lib/python36.zip', '/usr/lib/python3.6', '/usr/lib/python3.6/lib-dynload', '/home/codyw/.local/lib/python3.6/site-packages', '/usr/local/lib/python3.6/dist-packages', '/usr/lib/python3/dist-packages']

History

#1 Updated by Jürgen Fischer almost 2 years ago

  • Description updated (diff)

#2 Updated by codywohlers _ almost 2 years ago

codywohlers _ wrote:

Installed a fresh up to date Neon in a vm and got the same error I got during my original install, and my workaround doesn't work I guess as I get the same error when I run it as I do on my main system.

[email protected]:~$ sudo apt install qgis
Reading package lists... Done
Building dependency tree       
Reading state information... Done
Starting pkgProblemResolver with broken count: 1
Starting 2 pkgProblemResolver with broken count: 1
Investigating (0) qgis:amd64 < none -> 1:3.4.1+28bionic @un puN Ib >
Broken qgis:amd64 Depends on qgis-providers:amd64 < none | 1:3.4.1+28bionic @un uH > (= 1:3.4.1+28bionic)
  Considering qgis-providers:amd64 0 as a solution to qgis:amd64 10000
  Re-Instated qgis-providers-common:amd64
    Reinst Failed early because of qtbase-abi-5-9-5:amd64
Done
Some packages could not be installed. This may mean that you have
requested an impossible situation or if you are using the unstable
distribution that some required packages have not yet been created
or been moved out of Incoming.
The following information may help resolve the situation:

The following packages have unmet dependencies:
 qgis : Depends: qgis-providers (= 1:3.4.1+28bionic) but it is not going to be installed
E: Unable to correct problems, you have held broken packages.
[email protected]:~$ sudo apt install qtbase-abi-5-9-5
Reading package lists... Done
Building dependency tree       
Reading state information... Done
Package qtbase-abi-5-9-5 is a virtual package provided by:
  libqt5core5a 5.9.5+dfsg-0ubuntu1 [Not candidate version]

E: Package 'qtbase-abi-5-9-5' has no installation candidate

So I tried a workaround by making a fake package for qtbase-abi-5-9-5 (similar to https://gis.stackexchange.com/a/264244 ) since it's just a virtual package for libqt5core5a, which is installed.

[email protected]:~/tmp$ cat tmp.txt 
Section: misc
Priority: optional
Standards-Version: 3.9.2

Package: qtbase-abi-5-9-5
Version: 5.9.5
Depends: libqt5core5a
Description: fake package for qgis
[email protected]:~/tmp$ equivs-build tmp.txt
[...]
dpkg-deb: building package 'qtbase-abi-5-9-5' in '../qtbase-abi-5-9-5_5.9.5_all.deb'.

[email protected]:~/tmp$ sudo dpkg -i qtbase-abi-5-9-5_5.9.5_all.deb 
Selecting previously unselected package qtbase-abi-5-9-5.
(Reading database ... 143021 files and directories currently installed.)
Preparing to unpack qtbase-abi-5-9-5_5.9.5_all.deb ...
Unpacking qtbase-abi-5-9-5 (5.9.5) ...
Setting up qtbase-abi-5-9-5 (5.9.5) ...

and then got qgis to install but I still get an error when I run it.

[email protected]:~$ sudo apt install qgis
Reading package lists... Done
Building dependency tree       
Reading state information... Done
Starting pkgProblemResolver with broken count: 0
Starting 2 pkgProblemResolver with broken count: 0
Done
The following additional packages will be installed:
  blt dh-python fonts-lyx gdal-bin gdal-data grass-core grass-doc libaec0 libarmadillo8 libarpack2 libassimp4 libblas3 libboost-system1.65.1
  libboost-thread1.65.1 libclang1-6.0 libdap25 libdapclient6v5 libepsilon1 libexpat1-dev libfcgi-bin libfcgi0ldbl libfreexl1 libfyba0 libgdal20 libgeos-3.6.2
  libgeos-c1v5 libgeotiff2 libgfortran4 libgsl23 libgslcblas0 libhdf4-0-alt libhdf5-100 libjs-jquery-ui libjs-leaflet libkmlbase1 libkmldom1 libkmlengine1
  liblapack3 liblas-c3 liblas3 liblwgeom-2.4-0 liblwgeom-dev libnetcdf13 libodbc1 libogdi3.2 libpq5 libproj12 libpython-stdlib libpython3-dev libpython3.6-dev
  libqgis-3d3.4.1 libqgis-analysis3.4.1 libqgis-app3.4.1 libqgis-core3.4.1 libqgis-customwidgets libqgis-gui3.4.1 libqgis-native3.4.1 libqgis-server3.4.1
  libqgisgrass7-3.4.1 libqgispython3.4.1 libqhull7 libqscintilla2-qt5-13 libqscintilla2-qt5-l10n libqt53danimation5 libqt53dcore5 libqt53dextras5
  libqt53dinput5 libqt53dlogic5 libqt53dquickscene2d5 libqt53drender5 libqt5charts5 libqt5designercomponents5 libqt5keychain1 libqt5serialport5 libqwt-qt5-6
  libspatialindex4v5 libspatialite7 libsqlite3-mod-spatialite libsuperlu5 libsz2 libtcl8.6 libtk8.6 liburiparser1 libxerces-c3.2 ocl-icd-libopencl1 odbcinst
  odbcinst1debian2 proj-bin proj-data python python-enum34 python-matplotlib-data python-minimal python-numpy python-pip-whl python-qgis python-qgis-common
  python-sip python2.7 python2.7-minimal python3-asn1crypto python3-bs4 python3-cffi-backend python3-crypto python3-cryptography python3-cycler
  python3-dateutil python3-decorator python3-dev python3-distutils python3-future python3-gdal python3-html5lib python3-ipython-genutils python3-jinja2
  python3-jsonschema python3-jupyter-core python3-keyring python3-keyrings.alt python3-lib2to3 python3-lxml python3-markupsafe python3-matplotlib
  python3-nbformat python3-numpy python3-owslib python3-pip python3-plotly python3-psycopg2 python3-pygments python3-pyparsing python3-pyproj
  python3-pyqt5.qsci python3-pyqt5.qtsql python3-pyqt5.qtsvg python3-pyqt5.qtwebkit python3-secretstorage python3-setuptools python3-tk python3-traitlets
  python3-tz python3-webencodings python3-wheel python3-xdg python3.6-dev qgis-common qgis-plugin-grass qgis-plugin-grass-common qgis-provider-grass
  qgis-providers qgis-providers-common qml-module-qtcharts qt3d-assimpsceneimport-plugin qt3d-defaultgeometryloader-plugin qt3d-gltfsceneio-plugin
  qt3d-scene2d-plugin qt5-assistant qttools5-dev-tools tk8.6-blt2.5 ttf-bitstream-vera
Suggested packages:
  blt-demo libgdal-grass python-gdal grass-dev grass-gui e00compr avce00 gnuplot gpsbabel gpstrans python-rpy2 python-termcolor grass grass-dev-doc
  geotiff-bin libgeotiff-epsg gsl-ref-psdoc | gsl-doc-pdf | gsl-doc-info | gsl-ref-html libhdf4-doc libhdf4-alt-dev hdf4-tools libjs-jquery-ui-docs libmyodbc
  odbc-postgresql tdsodbc unixodbc-bin ogdi-bin libqscintilla2-doc tcl8.6 tk8.6 opencl-icd python-doc python-tk python-enum34-doc gfortran python-dev
  python-nose python-numpy-dbg python-numpy-doc saga python2.7-doc binfmt-support python-crypto-doc python-cryptography-doc python3-cryptography-vectors
  python-cycler-doc python-future-doc python3-genshi python-jinja2-doc gnome-keyring gir1.2-gnomekeyring-1.0 python3-lxml-dbg python-lxml-doc dvipng ffmpeg
  inkscape ipython3 python-matplotlib-doc python3-cairocffi python3-gi-cairo python3-gobject python3-nose python3-pyqt4 python3-scipy python3-tornado
  texlive-extra-utils texlive-latex-extra ttf-staypuft python3-numpy-dbg owslib-doc python3-pandas python3-ipykernel python-psycopg2-doc python-pyparsing-doc
  python-secretstorage-doc python-setuptools-doc tix python3-tk-dbg qt5-doc
The following NEW packages will be installed:
  blt dh-python fonts-lyx gdal-bin gdal-data grass-core grass-doc libaec0 libarmadillo8 libarpack2 libassimp4 libblas3 libboost-system1.65.1
  libboost-thread1.65.1 libclang1-6.0 libdap25 libdapclient6v5 libepsilon1 libexpat1-dev libfcgi-bin libfcgi0ldbl libfreexl1 libfyba0 libgdal20 libgeos-3.6.2
  libgeos-c1v5 libgeotiff2 libgfortran4 libgsl23 libgslcblas0 libhdf4-0-alt libhdf5-100 libjs-jquery-ui libjs-leaflet libkmlbase1 libkmldom1 libkmlengine1
  liblapack3 liblas-c3 liblas3 liblwgeom-2.4-0 liblwgeom-dev libnetcdf13 libodbc1 libogdi3.2 libpq5 libproj12 libpython-stdlib libpython3-dev libpython3.6-dev
  libqgis-3d3.4.1 libqgis-analysis3.4.1 libqgis-app3.4.1 libqgis-core3.4.1 libqgis-customwidgets libqgis-gui3.4.1 libqgis-native3.4.1 libqgis-server3.4.1
  libqgisgrass7-3.4.1 libqgispython3.4.1 libqhull7 libqscintilla2-qt5-13 libqscintilla2-qt5-l10n libqt53danimation5 libqt53dcore5 libqt53dextras5
  libqt53dinput5 libqt53dlogic5 libqt53dquickscene2d5 libqt53drender5 libqt5charts5 libqt5designercomponents5 libqt5keychain1 libqt5serialport5 libqwt-qt5-6
  libspatialindex4v5 libspatialite7 libsqlite3-mod-spatialite libsuperlu5 libsz2 libtcl8.6 libtk8.6 liburiparser1 libxerces-c3.2 ocl-icd-libopencl1 odbcinst
  odbcinst1debian2 proj-bin proj-data python python-enum34 python-matplotlib-data python-minimal python-numpy python-pip-whl python-qgis python-qgis-common
  python-sip python2.7 python2.7-minimal python3-asn1crypto python3-bs4 python3-cffi-backend python3-crypto python3-cryptography python3-cycler
  python3-dateutil python3-decorator python3-dev python3-distutils python3-future python3-gdal python3-html5lib python3-ipython-genutils python3-jinja2
  python3-jsonschema python3-jupyter-core python3-keyring python3-keyrings.alt python3-lib2to3 python3-lxml python3-markupsafe python3-matplotlib
  python3-nbformat python3-numpy python3-owslib python3-pip python3-plotly python3-psycopg2 python3-pygments python3-pyparsing python3-pyproj
  python3-pyqt5.qsci python3-pyqt5.qtsql python3-pyqt5.qtsvg python3-pyqt5.qtwebkit python3-secretstorage python3-setuptools python3-tk python3-traitlets
  python3-tz python3-webencodings python3-wheel python3-xdg python3.6-dev qgis qgis-common qgis-plugin-grass qgis-plugin-grass-common qgis-provider-grass
  qgis-providers qgis-providers-common qml-module-qtcharts qt3d-assimpsceneimport-plugin qt3d-defaultgeometryloader-plugin qt3d-gltfsceneio-plugin
  qt3d-scene2d-plugin qt5-assistant qttools5-dev-tools tk8.6-blt2.5 ttf-bitstream-vera
0 upgraded, 161 newly installed, 0 to remove and 0 not upgraded.
Need to get 221 MB of archives.
After this operation, 636 MB of additional disk space will be used.
Do you want to continue? [Y/n] 

[...]

[email protected]:~$ qgis
Couldn't load SIP module.
Python support will be disabled.

Traceback (most recent call last):
  File "", line 1, in 
  File "/usr/lib/python3/dist-packages/qgis/__init__.py", line 80, in 
    import qgis.gui
  File "/usr/lib/python3/dist-packages/qgis/gui/__init__.py", line 27, in 
    from qgis._gui import *
RuntimeError: qgis._gui cannot import type 'QMap' from PyQt5.QtCore

Python version:
3.6.6 (default, Sep 12 2018, 18:26:19) 
[GCC 8.0.1 20180414 (experimental) [trunk revision 259383]]

QGIS version:
3.4.1-Madeira 'Madeira', 383851c

Python path:
['/usr/share/qgis/python', '/home/user/.local/share/QGIS/QGIS3/profiles/default/python', '/home/user/.local/share/QGIS/QGIS3/profiles/default/python/plugins', '/usr/share/qgis/python/plugins', '/usr/lib/python36.zip', '/usr/lib/python3.6', '/usr/lib/python3.6/lib-dynload', '/usr/local/lib/python3.6/dist-packages', '/usr/lib/python3/dist-packages']

So then I tried using pip to install pyqt5

[email protected]:~$ pip3 install pyqt5
Collecting pyqt5
  Downloading https://files.pythonhosted.org/packages/d4/bf/d884da8e2f7096d201c891d515eb6813a8e85df5eb6f5e12e867bf1d831c/PyQt5-5.11.3-5.11.2-cp35.cp36.cp37.cp38-abi3-manylinux1_x86_64.whl (117.8MB)
    100% |████████████████████████████████| 117.8MB 12kB/s 
Collecting PyQt5_sip<4.20,>=4.19.11 (from pyqt5)
  Downloading https://files.pythonhosted.org/packages/46/ba/30995383332fd46e4ee59a405bd75ae8ee099001360e7a680f1685985a49/PyQt5_sip-4.19.13-cp36-cp36m-manylinux1_x86_64.whl (66kB)
    100% |████████████████████████████████| 71kB 1.9MB/s 
Installing collected packages: PyQt5-sip, pyqt5
Successfully installed PyQt5-sip-4.19.13 pyqt5-5.11.3

and now I get the same error I get on my main system.

Couldn't load SIP module.
Python support will be disabled.

Traceback (most recent call last):
  File "", line 1, in 
  File "/usr/lib/python3/dist-packages/qgis/__init__.py", line 80, in 
    import qgis.gui
  File "/usr/lib/python3/dist-packages/qgis/gui/__init__.py", line 27, in 
    from qgis._gui import *
ValueError: PyCapsule_GetPointer called with incorrect name

Python version:
3.6.6 (default, Sep 12 2018, 18:26:19) 
[GCC 8.0.1 20180414 (experimental) [trunk revision 259383]]

QGIS version:
3.4.1-Madeira 'Madeira', 383851c

Python path:
['/usr/share/qgis/python', '/home/user/.local/share/QGIS/QGIS3/profiles/default/python', '/home/user/.local/share/QGIS/QGIS3/profiles/default/python/plugins', '/usr/share/qgis/python/plugins', '/usr/lib/python36.zip', '/usr/lib/python3.6', '/usr/lib/python3.6/lib-dynload', '/home/user/.local/lib/python3.6/site-packages', '/usr/local/lib/python3.6/dist-packages', '/usr/lib/python3/dist-packages']

Is there a problem with my workaround? How should python/pip/sip be configured?

#3 Updated by codywohlers _ almost 2 years ago

So I think it's an issue with KDE Neon (and Kubuntu). I've seen several other python-based apps that don't work anymore. The latest Neon is based on ubuntu 18.04 (bionic) but uses libqt5core5a 5.11.2. But ubuntu only has 5.9.5 in the bionic repo and 5.11.1 and above is in the cosmic repo.

https://packages.ubuntu.com/bionic/libqt5core5a (5.9.5)
https://packages.ubuntu.com/cosmic/libqt5core5a (5.11.1)

and downgrading isn't an option :(

plasma-desktop : Depends: libqt5core5a (>= 5.11.2+dfsg)

I guess qgis 3.4.1 needs qt 5.9.5? My fake package pointing to 5.11.2 obviously didn't work...

#4 Updated by codywohlers _ almost 2 years ago

Found a similar bug for qgis 3.2.0 where an update of pyqt5-common (5.10.1-7 -> 5.11.2-1) caused qgis to stop working. The bug was closed as "fixed" with no explanation of the solution.
https://bugs.archlinux.org/task/59291

For fun I tried:

$ pip3 install 'pyqt5==5.10.1'
...
Successfully installed pyqt5-5.10.1 sip-4.19.8

but I get a new error
RuntimeError: qgis._gui cannot import type '����' from PyQt5.QtCore

#5 Updated by codywohlers _ almost 2 years ago

I'm running it without Python support for now. But I notice I can't see layers anymore if I move them to a group. Is that related to this bug?

#6 Updated by codywohlers _ almost 2 years ago

QGIS installs successfully on a Ubuntu 18.04.1 vm. I compared the following directories and found no difference in file contents:

~/.local/share/QGIS/QGIS3/profiles/default/python
/usr/share/qgis/python
/usr/lib/python3.6 (differnt cache)
/usr/local/lib/python3.6

/usr/lib/python3/dist-packages

Why won't it run?

#7 Updated by codywohlers _ almost 2 years ago

These are the only differences in packages between Neon and Ubuntu:

ii python-sip 4.19.11+dfsg-1+18.04+bionic+build1              | ii python-sip 4.19.7+dfsg-1
ii python3-distupgrade 1:18.04.29+p18.04+git20181121.1124     | ii python3-distupgrade 1:18.04.28
ii python3-pyqt5 5.11.3+dfsg-1+18.04+bionic+build4            | ii python3-pyqt5 5.10.1+dfsg-1ubuntu2
ii python3-pyqt5.qtsql 5.11.3+dfsg-1+18.04+bionic+build4      | ii python3-pyqt5.qtsql 5.10.1+dfsg-1ubuntu2
ii python3-pyqt5.qtsvg 5.11.3+dfsg-1+18.04+bionic+build4      | ii python3-pyqt5.qtsvg 5.10.1+dfsg-1ubuntu2
ii python3-pyqt5.qtwebkit 5.11.3+dfsg-1+18.04+bionic+build4   | ii python3-pyqt5.qtwebkit 5.10.1+dfsg-1ubuntu2
ii python3-sip 4.19.11+dfsg-1+18.04+bionic+build1             | ii python3-sip 4.19.7+dfsg-1

#8 Updated by codywohlers _ almost 2 years ago

WORKAROUND:

Got it working by copying

/usr/lib/python3/dist-packages/PyQt5

from an Ubuntu install and over-write that folder in Neon.

#9 Updated by Jürgen Fischer over 1 year ago

  • Resolution set to invalid
  • Status changed from Open to Closed

codywohlers _ wrote:

WORKAROUND:

Got it working by copying
[...]
from an Ubuntu install and over-write that folder in Neon.

Ok, it's a neon issue.

Also available in: Atom PDF