[GIS] QGIS 3.4 Couldn’t load SIP module. Python support will be disabled on Windows 10

file pathpythonqgis-3qgis-pluginssip

I upgraded from QGIS 3.2 to 3.4 and bad things happened. On start-up I get the error.

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


Traceback (most recent call last):
  File "", line 1, in 
  File "C:/PROGRA~1/QGIS3~1.4/apps/qgis/./python\qgis\__init__.py", line 80, in 
    import qgis.gui
  File "C:/PROGRA~1/QGIS3~1.4/apps/qgis/./python\qgis\gui\__init__.py", line 27, in 
    from qgis._gui import *
ValueError: PyCapsule_GetPointer called with incorrect name


Python version:
3.7.0 (v3.7.0:1bf9cc5093, Jun 27 2018, 04:59:51) [MSC v.1914 64 bit (AMD64)]

QGIS version:
3.4.2-Madeira 'Madeira', 22034aa070

Python path:
['C:/PROGRA~1/QGIS3~1.4/apps/qgis/./python', 'C:/Users/Cary/AppData/Roaming/QGIS/QGIS3\\profiles\\default/python', 'C:/Users/Cary/AppData/Roaming/QGIS/QGIS3\\profiles\\default/python/plugins', 'C:/PROGRA~1/QGIS3~1.4/apps/qgis/./python/plugins', 'C:\\Program Files\\QGIS 3.4\\bin\\python37.zip', 'C:\\PROGRA~1\\QGIS3~1.4\\apps\\Python37\\DLLs', 'C:\\PROGRA~1\\QGIS3~1.4\\apps\\Python37\\lib', 'C:\\Program Files\\QGIS 3.4\\bin', 'C:\\Users\\Cary\\AppData\\Roaming\\Python\\Python37\\site-packages', 'C:\\PROGRA~1\\QGIS3~1.4\\apps\\Python37', 'C:\\PROGRA~1\\QGIS3~1.4\\apps\\Python37\\lib\\site-packages', 'C:\\PROGRA~1\\QGIS3~1.4\\apps\\Python37\\lib\\site-packages\\win32', 'C:\\PROGRA~1\\QGIS3~1.4\\apps\\Python37\\lib\\site-packages\\win32\\lib', 'C:\\PROGRA~1\\QGIS3~1.4\\apps\\Python37\\lib\\site-packages\\Pythonwin']

I feel that there is an issue with my Python Path but I've tried several things to fix it and I am not there yet.

Does anyone know a fix for this?

Best Answer

I encountered this problem on Ubuntu 18.04 with QGIS-Madeira 3.4.13 after installing PyQt5. I didn't put it in virtual environment because I didn't anticipate there would be any issues; it must have overwritten PyQt4 and the older version of sip, as there is a special version associated with PyQt5. I was able to fix the issues with QGIS by uninstalling PyQt5's sip (and PyQt5, which could always be re-installed properly within a virtual environment), then re-installing sip system-wide (in the environment in which QGIS looks for it).

In the example below, I am making sure to use the Python 3 pip as I have both Python 2 and 3 on my system.

sudo -H pip3 uninstall PyQt5-sip
sudo -H pip3 uninstall PyQt5

# This seems to be the Python package QGIS requires
sudo -H pip3 install sip
Related Question