Closed jcpayne closed 5 years ago
@jcpayne Before that it might be worth testing which import is failing. I suggest opening the python console and entering each of these lines in turn, and see which one fails. I'm not sure why matplotlib would require the qt4 component (especially as QGIS3 uses qt5). I suspect that this installation fixed some other missing component in matplotlib.
import numpy as np
import matplotlib as mpl
import matplotlib.pyplot as plt
from matplotlib.mlab import griddata
from shapely.geometry import MultiLineString, MultiPolygon
Numpy and shapely both worked. Seems that matplotlib is the culprit:
Traceback (most recent call last): File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/code.py", line 91, in runcode
exec(code, self.locals) File "<input>", line 1, in <module> File "/Applications/QGIS3.app/Contents/MacOS/../Resources/python/qgis/utils.py", line 674,
in _import mod = _builtin_import(name, globals, locals, fromlist, level) ModuleNotFoundError: No module named 'matplotlib'
Got same error on Archlinux
>>> from matplotlib.mlab import griddata
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>
ImportError: cannot import name 'griddata' from 'matplotlib.mlab' (/usr/lib/python3.7/site-packages/matplotlib/mlab.py)
griddata is deprecated in matplotlib !
pacman -Q python-matplotlib
python-matplotlib 3.1.0-1
Plugin need update to scipy griddata => https://www.reddit.com/r/Python/comments/87lbao/matplotlib_griddata_deprecation_help/
@kikislater
Also using Archlinux. It doesn't look like griddata is actually used anywhere that I can tell. In my ~/.local/share/QGIS/QGIS3/profiles/default/python/plugins/contour
directory I simply commented out the griddata imports in both:
So far, QGIS loads without the error and contour works on DEM rasters...
@jcpayne @kikislater Apologies for slow response on this. @kikislater you are absolutely correct - griddata is not used (and hasn't been for quite some time!) Thanks for identifying (and resolving) this issue.
I just installed QGIS 3.2 with GDAL complete on a Mac (running the latest OS X 10.13.6) from the official QGIS page (it is a Kyngchaos distribution). I followed the instructions for setting the environment PATH variable, and I have confirmed that the latest versions of numpy and matplotlib are in /Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages. However, I still get the error "The contour plugin is disabled as it requires python modules numpy and matplotlib which are not both installed".