After installing the 3.4.x Madeira LTR release, upon opening QGIS I am encountering the following error:

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

Traceback (most recent call last):
  File "", line 1, in 
ModuleNotFoundError: No module named 'qgis'

Python version:
3.6.8 (default, Jan 14 2019, 11:02:34) 
[GCC 8.0.1 20180414 (experimental) [trunk revision 259383]]

QGIS version:
3.4.10-Madeira 'Madeira', 3d97aaae88

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

I suspect the issue lies with my Python path (or possibly anaconda?), but I did recently upgrade from Xenial to Bionic so I suspect that may also be a factor.

How can I resolve or begin to troubleshoot this error ModuleNotFoundError: No module named 'qgis'?

sudo vim /etc/apt/sources.list

deb https://qgis.org/ubuntu-ltr bionic main
deb-src https://qgis.org/ubuntu-ltr bionic main

Possibly related:

QGIS 2.18.3 path and sip module cannot be load in ubuntu 16.04

Couldn't load SIP Module

Update 7-23-2019

Digging further, I've noticed the qgis directory and PyQt5 directory seem to be missing from /usr/share/qgis/python

ls -l /usr/share/qgis/python returns...

drwxr-xr-x 2 root root 4096 Jul 22 16:16 console
drwxr-xr-x 5 root root 4096 Jul 22 16:16 plugins
drwxr-xr-x 2 root root 4096 Jul 22 16:16 pyplugin_installer
drwxr-xr-x 2 root root 4096 Jul 22 16:16 qsci_apis

Anaconda was the problem. I launched qgis without errors by removing all the anaconda directories from $PATH:

PATH=$(python -c "print(':'.join(i for i in '$PATH'.split(':') if 'anaconda' not in i))")
echo $PATH # verify anaconda removed, but nothing else is
| improve this answer | |

Reimaging my machine addressed the issue.

I was able to install without the error with a fresh install of Ubuntu 18.04. In case it's helpful to anyone in the future, I suspect a recent installation of Anaconda was the real culprit but I'm still not entirely sure it wasn't the upgrade from Xenial to Bionic.

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.