Encountering error in importing onnxruntime

iam using rembg python module in my project to remove the background of image, but when deploying iam getting this error
‘’‘File “/home/adminuser/venv/lib/python3.11/site-packages/streamlit/runtime/scriptrunner/script_runner.py”, line 589, in _run_script
exec(code, module.dict)
File “/mount/src/removeimgbackground/testing.py”, line 3, in
from rembg import remove
File “/home/adminuser/venv/lib/python3.11/site-packages/rembg/init.py”, line 5, in
from .bg import remove
File “/home/adminuser/venv/lib/python3.11/site-packages/rembg/bg.py”, line 6, in
import onnxruntime as ort
File “/home/adminuser/venv/lib/python3.11/site-packages/onnxruntime/init.py”, line 57, in
raise import_capi_exception
File “/home/adminuser/venv/lib/python3.11/site-packages/onnxruntime/init.py”, line 23, in
from onnxruntime.capi._pybind_state import ExecutionMode # noqa: F401
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File “/home/adminuser/venv/lib/python3.11/site-packages/onnxruntime/capi/_pybind_state.py”, line 32, in
from .onnxruntime_pybind11_state import * # noqa
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ‘’’
i tried to check for compatibility with multiple versions of streamlit onnxruntime rembg but none of them worked.
please help me out with this i created the app with the hope i could make it shareable but now due this import error iam not able make it live.
if you have something else to suggest can also mail me at
adityakhopade2003@gmail.com.

1 Like

Try numpy<2.

3 Likes

Thankyou sooo much GOYO!!
you are great. i spent a whole day resolving the stuff and was damm frustated, Life saver response!! Thankyou so much

This topic was automatically closed 2 days after the last reply. New replies are no longer allowed.