I had been struggling to get QGIS installed because (currently) the ubuntugis repo seems to not be working well (couldn’t load Python at all). I got around that problem by installing QGIS using flatpak.
I neeed to use the ENMAPBox plugin, which requires SciPy, Numpy, and Sklearn modules. Ubuntu came with Python 3.6.8 installed and QGIS brought with it Python 3.7.3. ENMAPBox cannot start because it can’t find either of those modules, and importing them from the console yields the same response. I followed the plugin’s instructions to install those packages using python3 -m pip install.
I’ve verified that the executable used by QGIS python console is /usr/bin/python3, and inspecting sys.path shows that /usr/lib/python3/dis-packages is not in the path (so it would make sense that it can’t find the packages I installed using pip3).
Sys.path looks like this:
['/app/share/qgis/python', '/home/nav00a/.var/app/org.qgis.qgis/data/QGIS/QGIS3/profiles/default/python', '/home/nav00a/.var/app/org.qgis.qgis/data/QGIS/QGIS3/profiles/default/python/plugins', '/app/share/qgis/python/plugins', '/usr/lib/python37.zip', '/usr/lib/python3.7', '/usr/lib/python3.7/lib-dynload', '/usr/lib/python3.7/site-packages', '/app/lib/python3.7/site-packages', '/app/lib/python3.7/site-packages/numpy-1.14.3-py3.7-linux-x86_64.egg', '/app/lib/python3.7/site-packages/MarkupSafe-1.0-py3.7-linux-x86_64.egg', '/home/nav00a/.var/app/org.qgis.qgis/data/QGIS/QGIS3/profiles/default/python', '/home/nav00a/.var/app/org.qgis.qgis/data/QGIS/QGIS3/profiles/default/python/plugins/enmapboxplugin/site-packages', '/home/nav00a/.var/app/org.qgis.qgis/data/QGIS/QGIS3/profiles/default/python/plugins/enmapboxplugin/enmapbox', '/usr/lib/python3/dist-packages']�
Note the last item is there because I appended it, it’s not there by default.
To get QGIS to import SciPy I’ve tried a number of things:
- Appending /usr/lib/python3/dist-packages to sys.path
- Redirecting pip3 to /usr/lib/python3.7/site-packages
- Adding .pth files to /usr/lib/python3.7/site-packages and /home/nav00a/.var/app/org.qgis.qgis/data/QGIS/QGIS3/profiles/default/python/plugins/enmapboxplugin/site-packages with links to /usr/lib/python3/dust-packages and /usr/lib/python3.7/site-packages
Unfortunately the behaviour remains the same. If I import SciPy this is what I get:
Traceback (most recent call last): File "/usr/lib/python3.7/code.py", line 90, in runcode exec(code, self.locals) File "<input>", line 1, in <module> File "/app/share/qgis/python/qgis/utils.py", line 672, in _import mod = _builtin_import(name, globals, locals, fromlist, level) ModuleNotFoundError: No module named 'scipy'�
Am I missing something that’s very obvious?