I'm trying to add the sentencepiece Python module to a python program in a (distroless) Docker container.
However, whenever I run the program, the Python interpreter immediately aborts with
File "/usr/local/lib/python3.10/site-packages/sentencepiece/__init__.py", line 13, in <module>
from . import _sentencepiece
ImportError: cannot import name '_sentencepiece' from 'sentencepiece' (/usr/local/lib/python3.10/site-packages/sentencepiece/__init__.py)
After a bit of headscratching, I believe that the real error is that Python can't load the shared object /usr/local/lib/python3.10/site-packages/sentencepiece/_sentencepiece.cpython-310-x86_64-linux-gnu.so
.
I used ldd
to get the static dependencies for the shared object and double-checked that the dependencies are in the container, but the error hasn't gone away.
I've tried some other approaches, namely, trying to get strace
loaded into the container, but it's been very error-prone, and I'm not sure I'm going down the right path.
So -
What should I be investigating instead?