# Suppress TBB Warning

**URL:** https://numba.discourse.group/t/suppress-tbb-warning/80
**Category:** Support: What is this error message?
**Created:** [June 30, 2020, 11:16am UTC](https://numba.discourse.group/t/suppress-tbb-warning/80 "2020-06-30T11:16:33Z")
**Posts on this page:** 11
**Page:** 1

<div class="post-metadata">

### Author: ![seanlaw](https://yyz2.discourse-cdn.com/free1/user_avatar/numba.discourse.group/seanlaw/32/506_2.png) [@seanlaw](https://numba.discourse.group/u/seanlaw)
#### Post date: [June 30, 2020, 11:16am UTC](https://numba.discourse.group/t/suppress-tbb-warning/80/1 "2020-06-30T11:16:33Z")

</div>

The STUMPY library relies on Numba as a core dependency and we perform unit testing on Azure Pipelines (i.e., it’s a fresh installation every time). STUMPY only depends on NumPy, SciPy, and Numba and nothing else. We noticed that as of Numba 0.48.0+, we are seeing TBB warnings like:

```auto
##[warning]The TBB threading layer requires TBB version 2019.5 or later i.e., TBB_INTERFACE_VERSION >= 11005. Found TBB_INTERFACE_VERSION = 9002. The TBB threading layer is disabled.

```

On Azure Pipelines, we test on Windows, Mac OSX, and Linux (ubuntu-16.04) and this is repeated on Python 3.6, 3.7, and 3.8. This warning only appears on Linux.

Interestingly, on a local server running on Ubuntu 18.04, this warning does not appear. I want to ensure that my users aren’t seeing this warning when they are running their code and I would like to suppress this warning when testing on Azure Pipelines. What’s the best way to solve this problem?

---

<div class="post-metadata">

### Author: ![stuartarchibald](https://yyz2.discourse-cdn.com/free1/user_avatar/numba.discourse.group/stuartarchibald/32/10_2.png) [@stuartarchibald](https://numba.discourse.group/u/stuartarchibald)
#### Post date: [June 30, 2020, 12:40pm UTC](https://numba.discourse.group/t/suppress-tbb-warning/80/2 "2020-06-30T12:40:35Z")

</div>

The warning is because there’s probably an incompatible TBB library installed somewhere in the environment and the code is using Numba’s parallelisation capabilities without explicitly specifying a threading layer. As a result, Numba will scan the environment for threading libraries, and it’s then reporting that it found TBB but it’s too old to use. Options to “fix” include:

- not installing TBB in the first place
- installing a sufficiently recent version of TBB
- [specifying a threading layer](http://numba.pydata.org/numba-doc/latest/user/threading-layer.html#setting-the-threading-layer)

hope this helps?

---

<div class="post-metadata">

### Author: ![seanlaw](https://yyz2.discourse-cdn.com/free1/user_avatar/numba.discourse.group/seanlaw/32/506_2.png) [@seanlaw](https://numba.discourse.group/u/seanlaw)
#### Post date: [June 30, 2020, 12:45pm UTC](https://numba.discourse.group/t/suppress-tbb-warning/80/3 "2020-06-30T12:45:48Z")

</div>

Thanks @stuartarchibald. Considering that this is a warning and it states at the end of it that “The TBB threading layer is disabled”. Is there a way to know what Numba is defaulting to since TBB is disabled? And is there a command to manually disable TBB (I don’t install it explicitly and so I suspect that it is coming natively with the Azure Pipelines image).

---

<div class="post-metadata">

### Author: ![stuartarchibald](https://yyz2.discourse-cdn.com/free1/user_avatar/numba.discourse.group/stuartarchibald/32/10_2.png) [@stuartarchibald](https://numba.discourse.group/u/stuartarchibald)
#### Post date: [June 30, 2020, 12:51pm UTC](https://numba.discourse.group/t/suppress-tbb-warning/80/4 "2020-06-30T12:51:41Z")

</div>

> Is there a way to know what Numba is defaulting to since TBB is disabled?

Yes. [The Threading Layers — Numba 0.50.1 documentation](http://numba.pydata.org/numba-doc/latest/user/threading-layer.html#selecting-a-threading-layer-for-safe-parallel-execution) see the example, it’s just a call to `numba.threading_layer()`.

> And is there a command to manually disable TBB (I don’t install it explicitly and so I suspect that it is coming natively with the Azure Pipelines image).

Not explicitly short of simply uninstalling it. You can elect to select a specific threading layer that is not TBB [as described here](http://numba.pydata.org/numba-doc/latest/user/threading-layer.html#selecting-a-named-threading-layer).

---

<div class="post-metadata">

### Author: ![seanlaw](https://yyz2.discourse-cdn.com/free1/user_avatar/numba.discourse.group/seanlaw/32/506_2.png) [@seanlaw](https://numba.discourse.group/u/seanlaw)
#### Post date: [June 30, 2020, 1:44pm UTC](https://numba.discourse.group/t/suppress-tbb-warning/80/5 "2020-06-30T13:44:06Z")

</div>

Thank you. That helps!

---

<div class="post-metadata">

### Author: ![stuartarchibald](https://yyz2.discourse-cdn.com/free1/user_avatar/numba.discourse.group/stuartarchibald/32/10_2.png) [@stuartarchibald](https://numba.discourse.group/u/stuartarchibald)
#### Post date: [July 6, 2020, 6:26pm UTC](https://numba.discourse.group/t/suppress-tbb-warning/80/6 "2020-07-06T18:26:55Z")

</div>

No problem, glad that helps with it!

---

<div class="post-metadata">

### Author: ![seanlaw](https://yyz2.discourse-cdn.com/free1/user_avatar/numba.discourse.group/seanlaw/32/506_2.png) [@seanlaw](https://numba.discourse.group/u/seanlaw)
#### Post date: [December 28, 2021, 2:43pm UTC](https://numba.discourse.group/t/suppress-tbb-warning/80/7 "2021-12-28T14:43:06Z")

</div>

@stuartarchibald In the case where `numba` is being downloaded as a package dependency, is there a good way to automate the selection/specification of the threading layer without user intervention? We also don’t know the platform a priori and so any automation to detect and handle this would be great. Or, maybe to ask the question differently, if `numba` is going to disable TBB anyways, is there a good way to silence that warning without requiring the user to explicitly specify the threading layer?

I have considered adding

```auto
import warnings
warnings.filterwarnings('ignore')

```

to the top of my modules but this seems reckless and would also hide other important warnings. I think that 99% of my users don’t care what threading layer is being used and would accept the best choice discovered by `numba`.

---

<div class="post-metadata">

### Author: ![stuartarchibald](https://yyz2.discourse-cdn.com/free1/user_avatar/numba.discourse.group/stuartarchibald/32/10_2.png) [@stuartarchibald](https://numba.discourse.group/u/stuartarchibald)
#### Post date: [January 11, 2022, 10:26am UTC](https://numba.discourse.group/t/suppress-tbb-warning/80/8 "2022-01-11T10:26:31Z")

</div>

@seanlaw I guess there’s two options. In the upcoming Numba 0.55 release (currently at RC1) there’s a `config` setting that lets you adjust the threading layer priority:  
[https://numba.readthedocs.io/en/0.55.0rc1/user/threading-layer.html#setting-the-threading-layer-selection-priority](https://numba.readthedocs.io/en/0.55.0rc1/user/threading-layer.html#setting-the-threading-layer-selection-priority)  
with this you could make it so that TBB is tried only as a last resort, this won’t suppress the warning but would potentially make it very unlikely to appear (but also potentially prevents the use of TBB!).

It’s also possible to selectively suppress warnings, an example of suppressing _just_ Numba’s deprecation warnings is here:  
[Deprecation Notices — Numba 0.54.1+0.g39aef3deb.dirty-py3.7-linux-x86\_64.egg documentation](https://numba.readthedocs.io/en/stable/reference/deprecation.html#suppressing-deprecation-warnings) something similar could be done for that specific TBB related warning if desired. I would probably try this first for your use case.

Hope this helps?

---

<div class="post-metadata">

### Author: ![seanlaw](https://yyz2.discourse-cdn.com/free1/user_avatar/numba.discourse.group/seanlaw/32/506_2.png) [@seanlaw](https://numba.discourse.group/u/seanlaw)
#### Post date: [January 11, 2022, 2:23pm UTC](https://numba.discourse.group/t/suppress-tbb-warning/80/9 "2022-01-11T14:23:00Z")

</div>

Thank you. I will poke around to see if there is a way to suppress that specific warning in Python without suppressing all deprecation warnings.

---

<div class="post-metadata">

### Author: ![seanlaw](https://yyz2.discourse-cdn.com/free1/user_avatar/numba.discourse.group/seanlaw/32/506_2.png) [@seanlaw](https://numba.discourse.group/u/seanlaw)
#### Post date: [January 11, 2022, 2:56pm UTC](https://numba.discourse.group/t/suppress-tbb-warning/80/10 "2022-01-11T14:56:17Z")

</div>

Alright, it looks like this minimum example should solve the problem:

```auto
import numpy as np
import warnings
from numba import njit, prange

@njit(parallel=True)
def go_fast(a): # Function is compiled and runs in machine code
    trace = 0.0
    for i in prange(a.shape[0]):
        trace += np.tanh(a[i, i])
    return a + trace

x = np.arange(100).reshape(10, 10)

with warnings.catch_warnings():
    warnings.filterwarnings("ignore", message="The TBB threading layer requires TBB version")
    print(go_fast(x))

```

---

<div class="post-metadata">

### Author: ![stuartarchibald](https://yyz2.discourse-cdn.com/free1/user_avatar/numba.discourse.group/stuartarchibald/32/10_2.png) [@stuartarchibald](https://numba.discourse.group/u/stuartarchibald)
#### Post date: [January 12, 2022, 10:23am UTC](https://numba.discourse.group/t/suppress-tbb-warning/80/11 "2022-01-12T10:23:17Z")

</div>

@seanlaw thanks for sharing that, glad you now have something that now works for your use case!
