[GIS] Couldn’t load SIP Module

pythonqgissipUbuntu

After reinstalling QGIS, the desktop program runs but generates the python error "Couldn't load SIP Module
Pythin support will be disabled"

Because of this error, no plug-ins will load. I found a couple of descriptions of a similar problem on-line, which recommended:

sudo apt-get install python-sip4
sudo apt-get install python-qt4

Neither of these worked, and in fact neither even returned an installation candidate. Note that the error reports that recommended these were at least 1 year old, or older.

I installed SIP from this source http://www.riverbankcomputing.com/software/sip/download and confirmed its installation, but QGIS continues to generate the same error.

System details:

OS: Xubuntu 12.04 with Xcfe desktop
QGIS: 1.8
Python: 2.7.3
SIP: 4.13.3

Any help would be greatly appreciated.

Best Answer

I most commonly get this error when starting QGIS if I'm running qgis from a terminal that has a Python virtualenv activated. (In particular, if it's a virtualenv set up with --no-site-packages, but that has been the default for some time so is almost always the case for me.) That means that it won't find the system installed Python packages that are installed as dependencies by apt-get.

The solution for me is to start QGIS from a new shell, when there should be no active virtualenv.

(I suspect this is not the problem that the original questioner was having 6 years ago, but it may well be useful to other people searching for the problem, and this seems like the best question to add this answer to!)

Related Question