numba: Using TBB with numba fails with pip install, works with apt install
Reporting a bug
- I have tried using the latest released version of Numba (most recent is visible in the change log (https://github.com/numba/numba/blob/master/CHANGE_LOG).
- I have included a self contained code sample to reproduce the problem. i.e. it’s possible to run as ‘python bug.py’.
Basically the title. Running the following commands fails:
python3 -m venv env
source env/bin/activate
pip install tbb numba
numba -s | grep TBB
Specifically, this returns:
TBB Threading Layer Available : False
The following does work:
sudo apt install libtbb-dev
numba -s | grep TBB
returning
TBB Threading Layer Available : True
+-->TBB imported successfully.
Two guesses.
- The tbb version on pypi is bricked.
- Numba is looking for a specific path that doesn’t exist when installing with pip, but does exist when you install from apt.
About this issue
- Original URL
- State: closed
- Created 3 years ago
- Comments: 19 (11 by maintainers)
TL;DR: This works. After you install through
pip install --upgrade tbbset your LD_LIBRARY_PATH to the.../venv/lib.I’m not sure anyone knows for certain. During our issue triage yesterday we discussed this and apparently the location of where to place libraries is a compile-time flag of the python interpreter. This means, the location will most likely be different depending on who compiled your python and thus, where you obtained it from.
Another issue, is that
wheelswere not designed as a binary packaging format. That is, thetbbpackage does not ship any Python code, only a compiled shared object / library and it’s “not really” a properly supported use-case. We have asked about this before and you can read more here:https://github.com/numba/numba/pulls?q=is%3Aopen+is%3Apr+milestone%3A"Numba+0.54+RC"
Incidentally, we actually have a script that unpacks the wheel we generate and removes
libtbb.soagain and repackages the wheel so that people can (if they are lucky).pip install tbband have that work.So, what I would recommend perhaps, is to point the
LD_LIBRARY_PATHto the location of thelibtbb.sofile an try to launch it like that.Hope that helps!