FS#75571 - [tensorflow] libiomp5.so not provided

Attached to Project: Community Packages
Opened by Juan (jap48) - Wednesday, 10 August 2022, 04:32 GMT
Last edited by Konstantin Gizdov (kgizdov) - Tuesday, 06 September 2022, 11:30 GMT
Task Type Bug Report
Category Packages
Status Closed
Assigned To Sven-Hendrik Haase (Svenstaro)
Konstantin Gizdov (kgizdov)
Architecture All
Severity Medium
Priority Normal
Reported Version
Due in Version Undecided
Due Date Undecided
Percent Complete 100%
Votes 1
Private No

Details

Description:

The tensorflow C API library (libtensorflow.so) cannot be loaded because
the dependency libiomp5.so cannot be found.

This is also the case for the -opt and -cuda variants; besides, the same
issue occurs with the C++ library (libtensorflow_cc.so).

This issue does not apply to the python packages (like python-tensorflow),
because a version of libiomp5.so is included, currently at:
/usr/lib/python3.10/site-packages/_solib_k8/_U_S_Sthird_Uparty_Smkl_Cmkl_Ulibs_Ulinux___Uexternal_Sllvm_Uopenmp/libiomp5.so

----

Possible solutions:

1 - Include libiomp5.so (and whatever deps it needs?) as part of the TF
packages (similar to what is done on the python TF ones).

It could be installed into /usr/lib or somewhere else, if that's too inconvenient.

Note that one version of libiomp5.so can be found somewhere inside
the bazel build tree, so that one could be installed.

2 - Add a dependency of TF on intel-oneapi-openmp (which provides libiomp5.so)
and intel-oneapi-openmp (which provides a source-able vars.sh to allow
loading the .so library)

----

Steps to reproduce:

[In python REPL]

>>> from ctypes import CDLL
>>> lib = CDLL('/usr/lib/libtensorflow.so')

Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/usr/lib/python3.10/ctypes/__init__.py", line 374, in __init__
self._handle = _dlopen(self._name, mode)
OSError: libiomp5.so: cannot open shared object file: No such file or directory

This task depends upon

Closed by  Konstantin Gizdov (kgizdov)
Tuesday, 06 September 2022, 11:30 GMT
Reason for closing:  Fixed
Additional comments about closing:  tensorflow 2.9.2-2
Comment by Konstantin Gizdov (kgizdov) - Thursday, 18 August 2022, 10:28 GMT
libiomp5.so is just a backwards compatible symlink alias that is no longer shipped (https://bugs.archlinux.org/task/63007). I'm guessing TF does its own thing of building separate libs and ignoring what the system provides. I will need some time to figure this out in a sustainable way.
Comment by Juan (jap48) - Thursday, 18 August 2022, 22:25 GMT
Thanks, I didn't know it was an alias, and my search results were not clarifying.

Maybe if we're lucky this will be automagically solved in TF 2.10.
In the meantime I'll be using my hackish workaround.
Comment by Wolfgang Seifert (wolfseifert) - Monday, 29 August 2022, 04:50 GMT
With tensorflow 2.9.1-4 now "libomp.so" is missing.

My new workaround is: /usr/lib/libomp.so -> /opt/intel/oneapi/lib/intel64/libiomp5.so
Comment by Konstantin Gizdov (kgizdov) - Sunday, 04 September 2022, 21:43 GMT
Is this still an issue? Maybe we need to add openmp as a dependency if so.
Comment by Wolfgang Seifert (wolfseifert) - Monday, 05 September 2022, 03:40 GMT
Yes, installing "openmp" solves the problem (tested with tensorflow 2.9.2).
So adding a dependency to "openmp" should do the trick...
Comment by Wolfgang Seifert (wolfseifert) - Tuesday, 06 September 2022, 07:54 GMT
tensorflow 2.9.2-2 has a dependency on "openmp" now and everything seems to be fine.

Loading...