InsightSoftwareConsortium / ITK

Insight Toolkit (ITK) -- Official Repository. ITK builds on a proven, spatially-oriented architecture for processing, segmentation, and registration of scientific images in two, three, or more dimensions.
https://itk.org
Apache License 2.0
1.37k stars 660 forks source link

libtbb missing from some ITK 5.4.0 wheels #4713

Open SimonRit opened 3 weeks ago

SimonRit commented 3 weeks ago

On my old linux box, pip install itk does not work anymore because libtbb is missing. Here is the list of commands I execute and the relevant output:

srit@russula:~> conda env create -y --name py39 python=3.9
srit@russula:~> conda activate py39
(py39) srit@russula:~> pip install itk
Collecting itk
  Using cached itk-5.4.0-cp39-cp39-manylinux_2_17_x86_64.whl.metadata (22 kB)
Collecting itk-core==5.4.0 (from itk)
  Using cached itk_core-5.4.0-cp39-cp39-manylinux_2_17_x86_64.whl.metadata (22 kB)
Collecting itk-numerics==5.4.0 (from itk)
  Using cached itk_numerics-5.4.0-cp39-cp39-manylinux_2_17_x86_64.whl.metadata (22 kB)
Collecting itk-io==5.4.0 (from itk)
  Using cached itk_io-5.4.0-cp39-cp39-manylinux_2_17_x86_64.whl.metadata (22 kB)
Collecting itk-filtering==5.4.0 (from itk)
  Using cached itk_filtering-5.4.0-cp39-cp39-manylinux_2_17_x86_64.whl.metadata (22 kB)
Collecting itk-registration==5.4.0 (from itk)
  Using cached itk_registration-5.4.0-cp39-cp39-manylinux_2_17_x86_64.whl.metadata (22 kB)
Collecting itk-segmentation==5.4.0 (from itk)
  Using cached itk_segmentation-5.4.0-cp39-cp39-manylinux_2_17_x86_64.whl.metadata (22 kB)
Collecting numpy (from itk)
  Using cached numpy-1.26.4-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.metadata (61 kB)
Using cached itk-5.4.0-cp39-cp39-manylinux_2_17_x86_64.whl (17 kB)
Using cached itk_core-5.4.0-cp39-cp39-manylinux_2_17_x86_64.whl (80.5 MB)
Using cached itk_filtering-5.4.0-cp39-cp39-manylinux_2_17_x86_64.whl (67.5 MB)
Using cached itk_io-5.4.0-cp39-cp39-manylinux_2_17_x86_64.whl (26.1 MB)
Using cached itk_numerics-5.4.0-cp39-cp39-manylinux_2_17_x86_64.whl (56.2 MB)
Using cached itk_registration-5.4.0-cp39-cp39-manylinux_2_17_x86_64.whl (27.2 MB)
Using cached itk_segmentation-5.4.0-cp39-cp39-manylinux_2_17_x86_64.whl (14.7 MB)
Using cached numpy-1.26.4-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (18.2 MB)
Installing collected packages: numpy, itk-core, itk-numerics, itk-io, itk-filtering, itk-segmentation, itk-registration, itk
Successfully installed itk-5.4.0 itk-core-5.4.0 itk-filtering-5.4.0 itk-io-5.4.0 itk-numerics-5.4.0 itk-registration-5.4.0 itk-segmentation-5.4.0 numpy-1.26.4
(py39) srit@russula:~> python
Python 3.9.19 (main, May  6 2024, 19:43:03) 
[GCC 11.2.0] :: Anaconda, Inc. on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import itk
i>>> itk.Image[itk.F, 3].New()
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/home/srit/miniconda3/envs/py39/lib/python3.9/site-packages/itk/support/lazy.py", line 138, in __getattribute__
    base.itk_load_swig_module(module, namespace)
  File "/home/srit/miniconda3/envs/py39/lib/python3.9/site-packages/itk/support/base.py", line 94, in itk_load_swig_module
    itk_load_swig_module(dep, namespace)
  File "/home/srit/miniconda3/envs/py39/lib/python3.9/site-packages/itk/support/base.py", line 130, in itk_load_swig_module
    l_module = loader.load(swig_module_name)
  File "/home/srit/miniconda3/envs/py39/lib/python3.9/site-packages/itk/support/base.py", line 289, in load
    l_spec.loader.exec_module(l_module)  # pytype: disable=attribute-error
  File "<frozen importlib._bootstrap_external>", line 850, in exec_module
  File "<frozen importlib._bootstrap>", line 228, in _call_with_frames_removed
  File "/home/srit/miniconda3/envs/py39/lib/python3.9/site-packages/itk/support/../ITKPyBasePython.py", line 63, in <module>
    from itk.pyBasePython import *
  File "/home/srit/miniconda3/envs/py39/lib/python3.9/site-packages/itk/pyBasePython.py", line 15, in <module>
    from . import _ITKCommonPython
ImportError: libtbb.so.12: cannot open shared object file: No such file or directory
>>> 
(py39) srit@russula:~> find miniconda3/envs/py39 -name libtbb*
(py39) srit@russula:~> 
SimonRit commented 1 week ago

I had a similar problem when building RTK wheels. The problem seems to be caused by the recent upgrade of scikit-build-core from 0.8.2 to 0.9.5. Downgrading it produces a wheel with libtbb. The main difference I observe is that 0.9.5 does not move a linux wheel at the end (see here) whereas 0.8.2 replaces the manylinux file with linux file (see here). I don't know what's the solution but that might help...

thewtex commented 1 week ago

CC @henryiii @jcfr