0

Running

import onnxruntime as ort
from datasets import load_dataset

yields the error:

(env-312) dernoncourt@pc:~/test$ python SE--test_importpb.py 
Traceback (most recent call last):
  File "/home/dernoncourt/test/SE--test_importpb.py", line 2, in <module>
    from datasets import load_dataset
  File "/opt/conda/envs/env-312/lib/python3.12/site-packages/datasets/__init__.py", line 17, in <module>
    from .arrow_dataset import Dataset
  File "/opt/conda/envs/env-312/lib/python3.12/site-packages/datasets/arrow_dataset.py", line 57, in <module>
    import pyarrow as pa
  File "/opt/conda/envs/env-312/lib/python3.12/site-packages/pyarrow/__init__.py", line 65, in <module>
    import pyarrow.lib as _lib
ImportError: /lib/x86_64-linux-gnu/libstdc++.so.6: version `GLIBCXX_3.4.29' not found (required by /opt/conda/envs/env-312/lib/python3.12/site-packages/pyarrow/lib.cpython-312-x86_64-linux-gnu.so)
(env-312) dernoncourt@pc:~/test$ 

Why and how to fix? I use:

  • Python 3.12.9
  • Ubuntu 20.04.5 LTS
  • datasets==3.5.0
  • onnxruntime==1.21.0

Running from datasets import load_dataset or import onnxruntime as ort alone works fine.

1 Answer 1

2

Inversing the import order works:

from datasets import load_dataset
import onnxruntime as ort

No clue why.

Sign up to request clarification or add additional context in comments.

2 Comments

If you use LD_DEBUG=libs python ..., you will observe that libstdc++.so.6 is loaded from somewhere other than /lib/x86_64-linux-gnu/libstdc++.so.6. And that version is newer. Why that happens requires knowing which other library depends on libstdc++.so.6, and what that library's RPATH or RUNPATH is.
@EmployedRussian Thank you, this is great to know, you're welcome to add this as an answer!

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.