numpy import error (module version conflict 0xb vs 0xa)
okanisis opened this issue · comments
Trying to install the LecoS plugin v2.0.7 on Linux but getting some numpy related errors:
First error:
Python error[1] RuntimeError: module compiled against API version 0xb but this version of numpy is 0xa
Second error:
Python warning[1] warning:/usr/lib/python2.7/site-packages/osgeo/gdal.py:107: DeprecationWarning: gdalnumeric.py was placed in a namespace, it is now available as osgeo.gdalnumeric
DeprecationWarning)
traceback: File "<string>", line 1, in <module>
File "/usr/share/qgis/python/pyplugin_installer/installer.py", line 253, in showPluginManagerWhenReady
iface.pluginManagerInterface().showPluginManager(tabIndex)
File "<string>", line 1, in <module>
File "/usr/share/qgis/python/pyplugin_installer/installer.py", line 305, in installPlugin
plugins.getAllInstalled(testLoad=True)
File "/usr/share/qgis/python/pyplugin_installer/installer_data.py", line 718, in getAllInstalled
plugin = self.getInstalledPlugin(key, path=path, readOnly=readOnly, testLoad=testLoadThis)
File "/usr/share/qgis/python/pyplugin_installer/installer_data.py", line 624, in getInstalledPlugin
pkg.classFactory(iface)
File "/home/saultdon/.qgis2/python/plugins/LecoS/__init__.py", line 35, in classFactory
from lecos_main import LecoS
File "/usr/share/qgis/python/qgis/utils.py", line 607, in _import
mod = _builtin_import(name, globals, locals, fromlist, level)
File "/home/saultdon/.qgis2/python/plugins/LecoS/lecos_main.py", line 37, in <module>
from lecos_dlg import LecosDialog
File "/usr/share/qgis/python/qgis/utils.py", line 607, in _import
mod = _builtin_import(name, globals, locals, fromlist, level)
File "/home/saultdon/.qgis2/python/plugins/LecoS/lecos_dlg.py", line 37, in <module>
import landscape_statistics as lcs
File "/usr/share/qgis/python/qgis/utils.py", line 607, in _import
mod = _builtin_import(name, globals, locals, fromlist, level)
File "/home/saultdon/.qgis2/python/plugins/LecoS/landscape_statistics.py", line 62, in <module>
import gdalnumeric
File "/usr/share/qgis/python/qgis/utils.py", line 607, in _import
mod = _builtin_import(name, globals, locals, fromlist, level)
File "/usr/lib/python2.7/site-packages/gdalnumeric.py", line 3, in <module>
deprecation_warn('gdalnumeric')
src/core/qgsmessagelog.cpp: 45: (logMessage) [3ms] 2017-06-20T10:53:11 Python error[1] RuntimeError: module compiled against API version 0xb but this version of numpy is 0xa
Third error:
The plugin is broken. Python said:
numpy.core.multiarray failed to import
I have the following installed:
python2-numpy 1.13.0
python2-scipy 0.19.0
python2-pillow 4.1.1
gdal 2.2.r39205
qgis 2.18.9.r97.g5ef70f1ab7
I tried to recompile them in the order listed above. Do you think this is related to GDAL?
I'm guessing that it could be a GDAL issue, but not entirely sure because I did the following in python2 terminal and can manually import numpy.core.multiarray but not gdalnumeric or osgeo.gdalnumeric
>>> from gdal import *
>>> from numpy import *
>>> import gdalnumeric
RuntimeError: module compiled against API version 0xb but this version of numpy is 0xa
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/usr/lib/python2.7/site-packages/gdalnumeric.py", line 5, in <module>
from osgeo.gdal_array import *
File "/usr/lib/python2.7/site-packages/osgeo/gdal_array.py", line 28, in <module>
_gdal_array = swig_import_helper()
File "/usr/lib/python2.7/site-packages/osgeo/gdal_array.py", line 24, in swig_import_helper
_mod = imp.load_module('_gdal_array', fp, pathname, description)
ImportError: numpy.core.multiarray failed to import
>>> import osgeo.gdalnumeric
RuntimeError: module compiled against API version 0xb but this version of numpy is 0xa
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/usr/lib/python2.7/site-packages/osgeo/gdalnumeric.py", line 1, in <module>
from osgeo.gdal_array import *
File "/usr/lib/python2.7/site-packages/osgeo/gdal_array.py", line 28, in <module>
_gdal_array = swig_import_helper()
File "/usr/lib/python2.7/site-packages/osgeo/gdal_array.py", line 24, in swig_import_helper
_mod = imp.load_module('_gdal_array', fp, pathname, description)
ImportError: numpy.core.multiarray failed to import
>>> import numpy.core.multiarray
>>>
Very likely. It works just fine on my Ubuntu linux. Also the gdal is usually/should be imported via from osgeo import gdal
gdal 2.2.r39205
You are also running some bleeding edge gdal version (and QGIS) there...
Unless you definetly need the most developer gdal version (I see no reason why?), why not install the stable sources and see if it works.
Generally I think this issue is setup related and not an issue of LecoS.
Looks like I have numpy in two places and different versions.
$HOME/.local/lib/python2.7 as 1.10.4
/usr/lib/python2.7 as 1.13.0
This creates a conflict on my system because python2 tries to import modules found in $HOME/.local/lib/python2.7 before it searches the system path at /usr/lib/python2.7