blender-3.5.1-linux-x64/3.5/python/lib/python3.10/site-packages/OpenEXR.cpython-310-x86_64-linux-gnu.so: 未定义符号:_ZTIN13IlmThread_3_14TaskE

blender-3.5.1-linux-x64/3.5/python/lib/python3.10/site-packages/OpenEXR.cpython-310-x86_64-linux-gnu.so: 未定义符号:_ZTIN13IlmThread_3_14TaskE

我正在尝试使用 Blender 3.5 附带的捆绑 Python 3.10 在 Ubuntu 22.04 中安装 OpenEXR Python 包。

(base) mona@ada:~/pvnet-rendering$ /home/mona/Downloads/blender-3.5.1-linux-x64/3.5/python/bin/python3.10 run.py --type rendering
Traceback (most recent call last):
  File "/home/mona/pvnet-rendering/run.py", line 24, in <module>
    globals()['run_' + args.type]()
  File "/home/mona/pvnet-rendering/run.py", line 11, in run_rendering
    from blender.render_utils import Renderer, YCBRenderer
  File "/home/mona/pvnet-rendering/blender/render_utils.py", line 9, in <module>
    import OpenEXR
ModuleNotFoundError: No module named 'OpenEXR'
(base) mona@ada:~/pvnet-rendering$ /home/mona/Downloads/blender-3.5.1-linux-x64/3.5/python/bin/pip  install openexr
Looking in indexes: https://pypi.org/simple, https://pypi.ngc.nvidia.com
Collecting openexr
  Downloading OpenEXR-1.3.9-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.metadata (534 bytes)
Downloading OpenEXR-1.3.9-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (1.2 MB)
   ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 1.2/1.2 MB 9.7 MB/s eta 0:00:00
DEPRECATION: pytorch-lightning 1.6.0 has a non-standard dependency specifier torch>=1.8.*. pip 24.0 will enforce this behaviour change. A possible replacement is to upgrade to a newer version of pytorch-lightning or contact the author to suggest that they release a version with a conforming dependency specifiers. Discussion can be found at https://github.com/pypa/pip/issues/12063
Installing collected packages: openexr
Successfully installed openexr-1.3.9
(base) mona@ada:~/pvnet-rendering$ /home/mona/Downloads/blender-3.5.1-linux-x64/3.5/python/bin/python3.10 run.py --type rendering
Traceback (most recent call last):
  File "/home/mona/pvnet-rendering/run.py", line 24, in <module>
    globals()['run_' + args.type]()
  File "/home/mona/pvnet-rendering/run.py", line 11, in run_rendering
    from blender.render_utils import Renderer, YCBRenderer
  File "/home/mona/pvnet-rendering/blender/render_utils.py", line 9, in <module>
    import OpenEXR
ImportError: /home/mona/Downloads/blender-3.5.1-linux-x64/3.5/python/lib/python3.10/site-packages/OpenEXR.cpython-310-x86_64-linux-gnu.so: undefined symbol: _ZTIN13IlmThread_3_14TaskE

我该如何修复这个错误?

答案1

此版本的 Blender 捆绑的 OpenEXR 库与 PyPI 上预构建的 OpenEXR 轮子冲突。

最简单的替代方法是在 Ubuntu 23.04 或 Ubuntu 23.10 上安装该 wheel。Ubuntu 22.10 及更低版本具有版本 2,而不是 wheel 所需的版本 3。从 开始sudo apt install openexr python3-venv。然后以下内容有效:

python3 -m venv venv
. venv/bin/activate
pip install OpenEXR
python3 -c 'import OpenEXR'
# No error from Python

轮子无法工作的最终原因是 Blender 版本想要void throwErrnoExc (const std::string& text)调用_ZN7Iex_3_113throwErrnoExcERKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEEi,但 PyPI 轮子正在寻找 _ZN7Iex_3_113throwErrnoExcERKSs。这看起来像是 glibc 或 C++ ABI 问题,由使用不同编译器或其他环境差异构建的库引起。

修复_ZTIN13IlmThread_3_14TaskE没有帮助。您可以使用修复一系列错误LD_PRELOAD=lib/libIlmThread.so:lib/libImath.so:/lib/x86_64-linux-gnu/libz.so 3.5/python/bin/python3.10 -c 'import OpenEXR'。遗憾的是,如果不重建 Blender,则无法修复最终_ZN7Iex_3_113throwErrnoExcERKSs错误,因此使用 Ubuntu 23.04 或更高版本以及存储库中官方打包的 Blender 版本会更容易。

相关内容