question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Intel TBB is required, no threading layer could be loaded, however TBB is already installed

See original GitHub issue

Using Numba 0.50.1, and Python 3.8.2, here is the code causing the bug:

from numba import config, njit, threading_layer
import numpy as np

# set the threading layer before any parallel target compilation
config.THREADING_LAYER = 'tbb'

@njit(parallel=True)
def foo(a, b):
	return a + b
x = np.arange(10.)
y = x.copy()

foo(x, y)
# demonstrate the threading layer chosen
print("Threading layer chosen: %s" % threading_layer())

Which gives me the error

Traceback (most recent call last):
  File "/home/ilknull/.local/lib/python3.8/site-packages/numba/core/errors.py", line 745, in new_error_context
    yield
  File "/home/ilknull/.local/lib/python3.8/site-packages/numba/core/lowering.py", line 273, in lower_block
    self.lower_inst(inst)
  File "/home/ilknull/.local/lib/python3.8/site-packages/numba/core/lowering.py", line 486, in lower_inst
    func(self, inst)
  File "/home/ilknull/.local/lib/python3.8/site-packages/numba/parfors/parfor_lowering.py", line 271, in _lower_parfor_parallel
    call_parallel_gufunc(
  File "/home/ilknull/.local/lib/python3.8/site-packages/numba/parfors/parfor_lowering.py", line 1398, in call_parallel_gufunc
    _launch_threads()
  File "/home/ilknull/.local/lib/python3.8/site-packages/numba/np/ufunc/parallel.py", line 486, in _launch_threads
    raise_with_hint(requirements)
  File "/home/ilknull/.local/lib/python3.8/site-packages/numba/np/ufunc/parallel.py", line 431, in raise_with_hint
    raise ValueError(errmsg % hint)
ValueError: No threading layer could be loaded.
HINT:
Intel TBB is required, try:
$ conda/pip install tbb

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "test.py", line 17, in <module>
    foo(x, y)
  File "/home/ilknull/.local/lib/python3.8/site-packages/numba/core/dispatcher.py", line 434, in _compile_for_args
    raise e
  File "/home/ilknull/.local/lib/python3.8/site-packages/numba/core/dispatcher.py", line 367, in _compile_for_args
    return self.compile(tuple(argtypes))
  File "/home/ilknull/.local/lib/python3.8/site-packages/numba/core/compiler_lock.py", line 32, in _acquire_compile_lock
    return func(*args, **kwargs)
  File "/home/ilknull/.local/lib/python3.8/site-packages/numba/core/dispatcher.py", line 808, in compile
    cres = self._compiler.compile(args, return_type)
  File "/home/ilknull/.local/lib/python3.8/site-packages/numba/core/dispatcher.py", line 78, in compile
    status, retval = self._compile_cached(args, return_type)
  File "/home/ilknull/.local/lib/python3.8/site-packages/numba/core/dispatcher.py", line 92, in _compile_cached
    retval = self._compile_core(args, return_type)
  File "/home/ilknull/.local/lib/python3.8/site-packages/numba/core/dispatcher.py", line 105, in _compile_core
    cres = compiler.compile_extra(self.targetdescr.typing_context,
  File "/home/ilknull/.local/lib/python3.8/site-packages/numba/core/compiler.py", line 603, in compile_extra
    return pipeline.compile_extra(func)
  File "/home/ilknull/.local/lib/python3.8/site-packages/numba/core/compiler.py", line 339, in compile_extra
    return self._compile_bytecode()
  File "/home/ilknull/.local/lib/python3.8/site-packages/numba/core/compiler.py", line 401, in _compile_bytecode
    return self._compile_core()
  File "/home/ilknull/.local/lib/python3.8/site-packages/numba/core/compiler.py", line 381, in _compile_core
    raise e
  File "/home/ilknull/.local/lib/python3.8/site-packages/numba/core/compiler.py", line 372, in _compile_core
    pm.run(self.state)
  File "/home/ilknull/.local/lib/python3.8/site-packages/numba/core/compiler_machinery.py", line 341, in run
    raise patched_exception
  File "/home/ilknull/.local/lib/python3.8/site-packages/numba/core/compiler_machinery.py", line 332, in run
    self._runPass(idx, pass_inst, state)
  File "/home/ilknull/.local/lib/python3.8/site-packages/numba/core/compiler_lock.py", line 32, in _acquire_compile_lock
    return func(*args, **kwargs)
  File "/home/ilknull/.local/lib/python3.8/site-packages/numba/core/compiler_machinery.py", line 291, in _runPass
    mutated |= check(pss.run_pass, internal_state)
  File "/home/ilknull/.local/lib/python3.8/site-packages/numba/core/compiler_machinery.py", line 264, in check
    mangled = func(compiler_state)
  File "/home/ilknull/.local/lib/python3.8/site-packages/numba/core/typed_passes.py", line 442, in run_pass
    NativeLowering().run_pass(state)
  File "/home/ilknull/.local/lib/python3.8/site-packages/numba/core/typed_passes.py", line 370, in run_pass
    lower.lower()
  File "/home/ilknull/.local/lib/python3.8/site-packages/numba/core/lowering.py", line 179, in lower
    self.lower_normal_function(self.fndesc)
  File "/home/ilknull/.local/lib/python3.8/site-packages/numba/core/lowering.py", line 233, in lower_normal_function
    entry_block_tail = self.lower_function_body()
  File "/home/ilknull/.local/lib/python3.8/site-packages/numba/core/lowering.py", line 259, in lower_function_body
    self.lower_block(block)
  File "/home/ilknull/.local/lib/python3.8/site-packages/numba/core/lowering.py", line 273, in lower_block
    self.lower_inst(inst)
  File "/usr/lib/python3.8/contextlib.py", line 131, in __exit__
    self.gen.throw(type, value, traceback)
  File "/home/ilknull/.local/lib/python3.8/site-packages/numba/core/errors.py", line 752, in new_error_context
    reraise(type(newerr), newerr, tb)
  File "/home/ilknull/.local/lib/python3.8/site-packages/numba/core/utils.py", line 81, in reraise
    raise value
numba.core.errors.LoweringError: Failed in nopython mode pipeline (step: nopython mode backend)
No threading layer could be loaded.
HINT:
Intel TBB is required, try:
$ conda/pip install tbb

File "test.py", line 10:
def foo(a, b):
	return a + b
 ^

During: lowering "id=0[LoopNest(index_variable = parfor_index.8, range = (0, a_size0.1, 1))]{1: <ir.Block at test.py (10)>}Var(parfor_index.8, test.py:10)" at test.py (10)

However, pip3 install tbb produces:

Requirement already satisfied: tbb in /home/ilknull/.local/lib/python3.8/site-packages (2020.0.133)

Any ways I could fix this issue? I’m not sure what is happening, I also used pip3 install numba to install Numba. Much appreciated

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:9 (4 by maintainers)

github_iconTop GitHub Comments

2reactions
JeppeDruedahlcommented, Aug 6, 2020

I have a similar problem. I have installed Anaconda3-2020.07-Windows-x86_64 (Python 3.8.3) on two computers. TBB is installed and running numba -s it is recognized. But I still get the error when setting the threading layer to ‘tbb’.

0reactions
stuartarchibaldcommented, Feb 26, 2021

@HugoStrand Could you perhaps open a new issue about this please? The code as-is is to handle common problems in practice, patches to add improvements for dealing with diagnosing new problems are welcomed. This is possibly related https://github.com/numba/numba/issues/6108.

Read more comments on GitHub >

github_iconTop Results From Across the Web

The Threading Layers - Numba documentation - Read the Docs
The tbb layer requires the presence of Intel's TBB libraries, these can be obtained via the conda command: $ conda install tbb. If...
Read more >
Pointing Numba to the TBB - python - Stack Overflow
Found TBB_INTERFACE_VERSION = 10003. The TBB threading layer is disabled. Although the installed version of TBB is: Name: tbb Version: 2021.5 ...
Read more >
Windows, Python 3.8 and TBB support - Numba Discussion
I want to use TBB threading layer with the Numba. My environment is Windows 10 Python 3.8 numba 0.51.2 tbb 2020.3.254 But the...
Read more >
Intel® Math Kernel Library for Windows OS ® User's Guide
The -qopenmp option has higher priority than -tbb in choosing the Intel MKL threading layer for linking. For more information on the /Qmkl...
Read more >
Jumping Right In: “Hello, TBB!” | SpringerLink
Importantly, TBB does not require us to restrict the parallelism we ... of the Intel C++ compiler installed, you likely already have TBB...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found