import numba crashes QGIS on linux

Issue #405 closed
Benjamin Jakimow created an issue

Calling import numba causes a QGIS crash on miniconda QGIS.

Comments (21)

  1. Benjamin Jakimow reporter

    @Augustin Lobo do you get any other error message?

    Numba makes me crazy. Seems that there is no save way to install it bundled in the requirements.txt

  2. Agustin Lobo

    This is whay I get in the qgis python error log window:

    2020-04-21T08:26:23     WARNING    Traceback (most recent call last):
    File "C:\PROGRA~1\QGIS3~1.12\apps\Python37\lib\site-packages\numba\core\typeconv\typeconv.py", line 4, in
    from numba.core.typeconv import _typeconv
    File "C:/PROGRA~1/QGIS3~1.12/apps/qgis/./python\qgis\utils.py", line 744, in _import
    mod = _builtin_import(name, globals, locals, fromlist, level)
    ImportError: DLL load failed: No se puede encontrar el módulo especificado.

    During handling of the above exception, another exception occurred:

    Traceback (most recent call last):
    File "C:/PROGRA~1/QGIS3~1.12/apps/qgis/./python\qgis\utils.py", line 334, in _startPlugin
    plugins[packageName] = package.classFactory(iface)
    File "C:/Users/1/AppData/Roaming/QGIS/QGIS3\profiles\default/python/plugins\enmapboxplugin\__init__.py", line 47, in classFactory
    raise ex
    File "C:/Users/1/AppData/Roaming/QGIS/QGIS3\profiles\default/python/plugins\enmapboxplugin\__init__.py", line 43, in classFactory
    plugin = EnMAPBoxPlugin(iface)
    File "C:/Users/1/AppData/Roaming/QGIS/QGIS3\profiles\default/python/plugins\enmapboxplugin\enmapbox\enmapboxplugin.py", line 49, in __init__
    self.initialDependencyCheck()
    File "C:/Users/1/AppData/Roaming/QGIS/QGIS3\profiles\default/python/plugins\enmapboxplugin\enmapbox\enmapboxplugin.py", line 64, in initialDependencyCheck
    missing = [p for p in requiredPackages() if not p.isInstalled()]
    File "C:/Users/1/AppData/Roaming/QGIS/QGIS3\profiles\default/python/plugins\enmapboxplugin\enmapbox\dependencycheck.py", line 391, in requiredPackages
    pkg = PIPPackage(pyPkg, cmd)
    File "C:/Users/1/AppData/Roaming/QGIS/QGIS3\profiles\default/python/plugins\enmapboxplugin\enmapbox\dependencycheck.py", line 99, in __init__
    __import__(self.pyPkgName)
    File "C:/PROGRA~1/QGIS3~1.12/apps/qgis/./python\qgis\utils.py", line 744, in _import
    mod = _builtin_import(name, globals, locals, fromlist, level)
    File "C:\PROGRA~1\QGIS3~1.12\apps\Python37\lib\site-packages\numba\__init__.py", line 20, in
    from numba.misc.special import (
    File "C:/PROGRA~1/QGIS3~1.12/apps/qgis/./python\qgis\utils.py", line 744, in _import
    mod = _builtin_import(name, globals, locals, fromlist, level)
    File "C:\PROGRA~1\QGIS3~1.12\apps\Python37\lib\site-packages\numba\misc\special.py", line 3, in
    from numba.core.typing.typeof import typeof
    File "C:/PROGRA~1/QGIS3~1.12/apps/qgis/./python\qgis\utils.py", line 744, in _import
    mod = _builtin_import(name, globals, locals, fromlist, level)
    File "C:\PROGRA~1\QGIS3~1.12\apps\Python37\lib\site-packages\numba\core\typing\__init__.py", line 1, in
    from .context import BaseContext, Context
    File "C:/PROGRA~1/QGIS3~1.12/apps/qgis/./python\qgis\utils.py", line 744, in _import
    mod = _builtin_import(name, globals, locals, fromlist, level)
    File "C:\PROGRA~1\QGIS3~1.12\apps\Python37\lib\site-packages\numba\core\typing\context.py", line 11, in
    from numba.core.typeconv import Conversion, rules
    File "C:/PROGRA~1/QGIS3~1.12/apps/qgis/./python\qgis\utils.py", line 744, in _import
    mod = _builtin_import(name, globals, locals, fromlist, level)
    File "C:\PROGRA~1\QGIS3~1.12\apps\Python37\lib\site-packages\numba\core\typeconv\rules.py", line 2, in
    from .typeconv import TypeManager, TypeCastingRules
    File "C:/PROGRA~1/QGIS3~1.12/apps/qgis/./python\qgis\utils.py", line 744, in _import
    mod = _builtin_import(name, globals, locals, fromlist, level)
    File "C:\PROGRA~1\QGIS3~1.12\apps\Python37\lib\site-packages\numba\core\typeconv\typeconv.py", line 17, in
    raise ImportError(msg % (url, reportme, str(e), sys.executable))
    ImportError: Numba could not be imported.
    If you are seeing this message and are undertaking Numba development work, you may need to re-run:

    python setup.py build_ext --inplace

    (Also, please check the development set up guide http://numba.pydata.org/numba-doc/latest/developer/contributing.html.)

    If you are not working on Numba development:

    Please report the error message and traceback, along with a minimal reproducer
    at: https://github.com/numba/numba/issues/new

    If more help is needed please feel free to speak to the Numba core developers
    directly at: https://gitter.im/numba/numba

    Thanks in advance for your help in improving Numba!

    The original error was: 'DLL load failed: No se puede encontrar el módulo especificado.'

    • -------------------------------------------------------------------------------

    If possible please include the following in your error report:

    sys.executable: C:\Program Files\QGIS 3.12\bin\qgis-bin.exe

  3. Fabian Thiel

    I can verify this, pip installation in osgeoshell works without any error messages. Once import numba is called (or try to start enmapbox) the following message pops up

    – numba version 0.49.0

    Couldn't load plugin 'enmapboxplugin' due to an error when calling its classFactory() method 
    
    ImportError: Numba could not be imported. If you are seeing this message and are undertaking Numba development work, you may need to re-run: python setup.py build_ext --inplace (Also, please check the development set up guide http://numba.pydata.org/numba-doc/latest/developer/contributing.html.) If you are not working on Numba development: Please report the error message and traceback, along with a minimal reproducer at: https://github.com/numba/numba/issues/new If more help is needed please feel free to speak to the Numba core developers directly at: https://gitter.im/numba/numba Thanks in advance for your help in improving Numba! The original error was: 'DLL load failed: Das angegebene Modul wurde nicht gefunden.' -------------------------------------------------------------------------------- If possible please include the following in your error report: sys.executable: C:\OSGeo4W64\bin\qgis-bin.exe 
    Traceback (most recent call last):
      File "C:\OSGEO4~1\apps\Python37\lib\site-packages\numba\core\typeconv\typeconv.py", line 4, in 
        from numba.core.typeconv import _typeconv
      File "C:/OSGEO4~1/apps/qgis/./python\qgis\utils.py", line 744, in _import
        mod = _builtin_import(name, globals, locals, fromlist, level)
    ImportError: DLL load failed: Das angegebene Modul wurde nicht gefunden.
    
    During handling of the above exception, another exception occurred:
    
    Traceback (most recent call last):
      File "C:/OSGEO4~1/apps/qgis/./python\qgis\utils.py", line 334, in _startPlugin
        plugins[packageName] = package.classFactory(iface)
      File "C:/Users/thielf54/AppData/Roaming/QGIS/QGIS3\profiles\default/python/plugins\enmapboxplugin\__init__.py", line 47, in classFactory
        raise ex
      File "C:/Users/thielf54/AppData/Roaming/QGIS/QGIS3\profiles\default/python/plugins\enmapboxplugin\__init__.py", line 43, in classFactory
        plugin = EnMAPBoxPlugin(iface)
      File "C:/Users/thielf54/AppData/Roaming/QGIS/QGIS3\profiles\default/python/plugins\enmapboxplugin\enmapbox\enmapboxplugin.py", line 49, in __init__
        self.initialDependencyCheck()
      File "C:/Users/thielf54/AppData/Roaming/QGIS/QGIS3\profiles\default/python/plugins\enmapboxplugin\enmapbox\enmapboxplugin.py", line 64, in initialDependencyCheck
        missing = [p for p in requiredPackages() if not p.isInstalled()]
      File "C:/Users/thielf54/AppData/Roaming/QGIS/QGIS3\profiles\default/python/plugins\enmapboxplugin\enmapbox\dependencycheck.py", line 391, in requiredPackages
        pkg = PIPPackage(pyPkg, cmd)
      File "C:/Users/thielf54/AppData/Roaming/QGIS/QGIS3\profiles\default/python/plugins\enmapboxplugin\enmapbox\dependencycheck.py", line 99, in __init__
        __import__(self.pyPkgName)
      File "C:/OSGEO4~1/apps/qgis/./python\qgis\utils.py", line 744, in _import
        mod = _builtin_import(name, globals, locals, fromlist, level)
      File "C:\OSGEO4~1\apps\Python37\lib\site-packages\numba\__init__.py", line 20, in 
        from numba.misc.special import (
      File "C:/OSGEO4~1/apps/qgis/./python\qgis\utils.py", line 744, in _import
        mod = _builtin_import(name, globals, locals, fromlist, level)
      File "C:\OSGEO4~1\apps\Python37\lib\site-packages\numba\misc\special.py", line 3, in 
        from numba.core.typing.typeof import typeof
      File "C:/OSGEO4~1/apps/qgis/./python\qgis\utils.py", line 744, in _import
        mod = _builtin_import(name, globals, locals, fromlist, level)
      File "C:\OSGEO4~1\apps\Python37\lib\site-packages\numba\core\typing\__init__.py", line 1, in 
        from .context import BaseContext, Context
      File "C:/OSGEO4~1/apps/qgis/./python\qgis\utils.py", line 744, in _import
        mod = _builtin_import(name, globals, locals, fromlist, level)
      File "C:\OSGEO4~1\apps\Python37\lib\site-packages\numba\core\typing\context.py", line 11, in 
        from numba.core.typeconv import Conversion, rules
      File "C:/OSGEO4~1/apps/qgis/./python\qgis\utils.py", line 744, in _import
        mod = _builtin_import(name, globals, locals, fromlist, level)
      File "C:\OSGEO4~1\apps\Python37\lib\site-packages\numba\core\typeconv\rules.py", line 2, in 
        from .typeconv import TypeManager, TypeCastingRules
      File "C:/OSGEO4~1/apps/qgis/./python\qgis\utils.py", line 744, in _import
        mod = _builtin_import(name, globals, locals, fromlist, level)
      File "C:\OSGEO4~1\apps\Python37\lib\site-packages\numba\core\typeconv\typeconv.py", line 17, in 
        raise ImportError(msg % (url, reportme, str(e), sys.executable))
    ImportError: Numba could not be imported.
    If you are seeing this message and are undertaking Numba development work, you may need to re-run:
    
    python setup.py build_ext --inplace
    
    (Also, please check the development set up guide http://numba.pydata.org/numba-doc/latest/developer/contributing.html.)
    
    If you are not working on Numba development:
    
    Please report the error message and traceback, along with a minimal reproducer
    at: https://github.com/numba/numba/issues/new
    
    If more help is needed please feel free to speak to the Numba core developers
    directly at: https://gitter.im/numba/numba
    
    Thanks in advance for your help in improving Numba!
    
    The original error was: 'DLL load failed: Das angegebene Modul wurde nicht gefunden.'
    --------------------------------------------------------------------------------
    If possible please include the following in your error report:
    
    sys.executable: C:\OSGeo4W64\bin\qgis-bin.exe
    
    
    
    Python version: 3.7.0 (v3.7.0:1bf9cc5093, Jun 27 2018, 04:59:51) [MSC v.1914 64 bit (AMD64)] 
    QGIS version: 3.12.2-București București, 8a1fb33634 
    

  4. Fabian Thiel

    Workaround: Going back to numba version 0.47.0 worked for me. @Agustin Lobo maybe try this.

    (Installing version 0.48.0 did not work for me, hence 0.47.0, see error below)

    ERROR: Could not install packages due to an EnvironmentError: [WinError 5] Zugriff verweigert: 'c:\\osgeo4~1\\apps\\python37\\lib\\site-packages\\~umpy\\.libs\\libopenblas.PYQHXLVVQ7VESDPUVUADXEVJOBGHJPAY.gfortran-win_amd64.dll'
    Consider using the `--user` option or check the permissions.
    

  5. Agustin Lobo

    @Fabian Thiel worked! thanks. This is what I did:

    python3 -m pip uninstall numba
    python3 -m pip install numba==0.47.0

    and then enmapbox 3.6 worked fine upon starting qgis

  6. Benjamin Jakimow reporter

    I modified the initial dependency check.
    It now handles any python Exception, i.e. the ImportError descrbied above, not just ModuleNotFound errors.

  7. Guanghui

    I can’t install Enmap correctly even I install the numba 0.47.0. I have no idea what next I can do. who can help me ?

    The numba was instelled successfully.

    >>> import numba
    >>> numba.__version__
    '0.47.0'
    

    Python error: Couldn't load plugin 'enmapboxplugin' due to an error when calling its classFactory() method See message log (Python Error) for more details.

    Couldn't load plugin 'enmapboxplugin' due to an error when calling its classFactory() method

    TypeError: create_target_machine() got an unexpected keyword argument 'jitdebug'

    Traceback (most recent call last):
      File "D:/Program Files/QGIS 3.12/apps/qgis/./python\qgis\utils.py", line 334, in _startPlugin
        plugins[packageName] = package.classFactory(iface)
      File "C:/Users/zgh/AppData/Roaming/QGIS/QGIS3\profiles\default/python/plugins\enmapboxplugin\__init__.py", line 47, in classFactory
        raise ex
      File "C:/Users/zgh/AppData/Roaming/QGIS/QGIS3\profiles\default/python/plugins\enmapboxplugin\__init__.py", line 43, in classFactory
        plugin = EnMAPBoxPlugin(iface)
      File "C:/Users/zgh/AppData/Roaming/QGIS/QGIS3\profiles\default/python/plugins\enmapboxplugin\enmapbox\enmapboxplugin.py", line 49, in __init__
        self.initialDependencyCheck()
      File "C:/Users/zgh/AppData/Roaming/QGIS/QGIS3\profiles\default/python/plugins\enmapboxplugin\enmapbox\enmapboxplugin.py", line 64, in initialDependencyCheck
        missing = [p for p in requiredPackages() if not p.isInstalled()]
      File "C:/Users/zgh/AppData/Roaming/QGIS/QGIS3\profiles\default/python/plugins\enmapboxplugin\enmapbox\dependencycheck.py", line 391, in requiredPackages
        pkg = PIPPackage(pyPkg, cmd)
      File "C:/Users/zgh/AppData/Roaming/QGIS/QGIS3\profiles\default/python/plugins\enmapboxplugin\enmapbox\dependencycheck.py", line 99, in __init__
        __import__(self.pyPkgName)
      File "D:/Program Files/QGIS 3.12/apps/qgis/./python\qgis\utils.py", line 743, in _import
        mod = _builtin_import(name, globals, locals, fromlist, level)
      File "D:\Program Files\QGIS 3.12\apps\Python37\lib\site-packages\numba\__init__.py", line 45, in 
        import numba.typed
      File "D:/Program Files/QGIS 3.12/apps/qgis/./python\qgis\utils.py", line 743, in _import
        mod = _builtin_import(name, globals, locals, fromlist, level)
      File "D:\Program Files\QGIS 3.12\apps\Python37\lib\site-packages\numba\typed\__init__.py", line 3, in 
        from .typeddict import Dict
      File "D:/Program Files/QGIS 3.12/apps/qgis/./python\qgis\utils.py", line 743, in _import
        mod = _builtin_import(name, globals, locals, fromlist, level)
      File "D:\Program Files\QGIS 3.12\apps\Python37\lib\site-packages\numba\typed\typeddict.py", line 18, in 
        @njit
      File "D:\Program Files\QGIS 3.12\apps\Python37\lib\site-packages\numba\decorators.py", line 224, in njit
        return jit(*args, **kws)
      File "D:\Program Files\QGIS 3.12\apps\Python37\lib\site-packages\numba\decorators.py", line 161, in jit
        return wrapper(pyfunc)
      File "D:\Program Files\QGIS 3.12\apps\Python37\lib\site-packages\numba\decorators.py", line 177, in wrapper
        **dispatcher_args)
      File "D:\Program Files\QGIS 3.12\apps\Python37\lib\site-packages\numba\dispatcher.py", line 576, in __init__
        self.targetctx = self.targetdescr.target_context
      File "D:\Program Files\QGIS 3.12\apps\Python37\lib\site-packages\numba\targets\registry.py", line 50, in target_context
        return self._toplevel_target_context
      File "D:\Program Files\QGIS 3.12\apps\Python37\lib\site-packages\numba\utils.py", line 381, in __get__
        res = instance.__dict__[self.name] = self.func(instance)
      File "D:\Program Files\QGIS 3.12\apps\Python37\lib\site-packages\numba\targets\registry.py", line 34, in _toplevel_target_context
        return cpu.CPUContext(self.typing_context)
      File "D:\Program Files\QGIS 3.12\apps\Python37\lib\site-packages\numba\targets\base.py", line 250, in __init__
        self.init()
      File "D:\Program Files\QGIS 3.12\apps\Python37\lib\site-packages\numba\compiler_lock.py", line 32, in _acquire_compile_lock
        return func(*args, **kwargs)
      File "D:\Program Files\QGIS 3.12\apps\Python37\lib\site-packages\numba\targets\cpu.py", line 49, in init
        self._internal_codegen = codegen.JITCPUCodegen("numba.exec")
      File "D:\Program Files\QGIS 3.12\apps\Python37\lib\site-packages\numba\targets\codegen.py", line 612, in __init__
        self._init(self._llvm_module)
      File "D:\Program Files\QGIS 3.12\apps\Python37\lib\site-packages\numba\targets\codegen.py", line 621, in _init
        tm = target.create_target_machine(**tm_options)
    TypeError: create_target_machine() got an unexpected keyword argument 'jitdebug'
    

    Python version: 3.7.0 (v3.7.0:1bf9cc5093, Jun 27 2018, 04:59:51) [MSC v.1914 64 bit (AMD64)]
    QGIS version: 3.12.3-București București, 8234261527

    Python Path:

    • D:/Program Files/QGIS 3.12/apps/qgis/./python
    • C:/Users/zgh/AppData/Roaming/QGIS/QGIS3\profiles\default/python
    • C:/Users/zgh/AppData/Roaming/QGIS/QGIS3\profiles\default/python/plugins
    • D:/Program Files/QGIS 3.12/apps/qgis/./python/plugins
    • D:\Program Files\QGIS 3.12\apps\Python37
    • D:\Program Files\QGIS 3.12\apps\Python37\Scripts
    • D:\Program Files\QGIS 3.12\bin\python37.zip
    • D:\Program Files\QGIS 3.12\apps\Python37\DLLs
    • D:\Program Files\QGIS 3.12\apps\Python37\lib
    • D:\Program Files\QGIS 3.12\bin
    • C:\Users\zgh\AppData\Roaming\Python\Python37\site-packages
    • D:\Program Files\QGIS 3.12\apps\Python37\lib\site-packages
    • D:\Program Files\QGIS 3.12\apps\Python37\lib\site-packages\win32
    • D:\Program Files\QGIS 3.12\apps\Python37\lib\site-packages\win32\lib
    • D:\Program Files\QGIS 3.12\apps\Python37\lib\site-packages\Pythonwin
    • C:/Users/zgh/AppData/Roaming/QGIS/QGIS3\profiles\default/python
    • C:\Users\zgh\AppData\Roaming\QGIS\QGIS3\profiles\default\python\plugins\enmapboxplugin\site-packages
    • C:\Users\zgh\AppData\Roaming\QGIS\QGIS3\profiles\default\python\plugins\enmapboxplugin\enmapbox\externals\qps\externals
    • C:\Users\zgh\AppData\Roaming\QGIS\QGIS3\profiles\default\python\plugins\enmapboxplugin\enmapbox
    • C:\Users\zgh\AppData\Roaming\QGIS\QGIS3\profiles\default\python\plugins\enmapboxplugin\site-packages

  8. Benjamin Jakimow reporter

    @guanhui in my system (Windows 10, OSGeo4W with QGIS 3.14.16-2) numba seems to work, if installed with pip.

  9. Log in to comment