I just installed rembg by “pip install rembg” but not able to generate an image that the background is removed
from rembg import remove
from PIL import Image
img = Image.open("input.png")
out = remove(img)
out.save("output.png")
I have an error:
PS C:UsersHyeonseungDownloadsCodes> & C:/Users/Hyeonseung/AppData/Local/Microsoft/WindowsApps/python3.12.exe c:/Users/Hyeonseung/Downloads/Codes/Python/Temp/main.py
Traceback (most recent call last):
File "c:UsersHyeonseungDownloadsCodesPythonTempmain.py", line 2, in <module>
from rembg import remove
^^^^^^^^^^^^^^^^^^^^^^^^
File "C:UsersHyeonseungAppDataLocalPackagesPythonSoftwareFoundation.Python.3.12_qbz5n2kfra8p0LocalCachelocal-packagesPython312site-packagesrembg__init__.py", line 5, in <module>
from .bg import remove
File "C:UsersHyeonseungAppDataLocalPackagesPythonSoftwareFoundation.Python.3.12_qbz5n2kfra8p0LocalCachelocal-packagesPython312site-packagesrembgbg.py", line 6, in <module>
import onnxruntime as ort
File "C:UsersHyeonseungAppDataLocalPackagesPythonSoftwareFoundation.Python.3.12_qbz5n2kfra8p0LocalCachelocal-packagesPython312site-packagesonnxruntime__init__.py", line 57, in <module>
raise import_capi_exception
File "C:UsersHyeonseungAppDataLocalPackagesPythonSoftwareFoundation.Python.3.12_qbz5n2kfra8p0LocalCachelocal-packagesPython312site-packagesonnxruntime__init__.py", line 23, in <module>
from onnxruntime.capi._pybind_state import ExecutionMode # noqa: F401
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:UsersHyeonseungAppDataLocalPackagesPythonSoftwareFoundation.Python.3.12_qbz5n2kfra8p0LocalCachelocal-packagesPython312site-packagesonnxruntimecapi_pybind_state.py", line 32, in <module>
from .onnxruntime_pybind11_state import * # noqa
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
ImportError: DLL load failed while importing onnxruntime_pybind11_state: The specified module could not be found.
What is problen I just followed the correct way.
p.s. my python’s version is 3.12