s0md3v / sd-webui-roop

roop extension for StableDiffusion web-ui
GNU Affero General Public License v3.0
3.4k stars 884 forks source link

Cannot import from onnxruntime #268

Open Sega01 opened 1 year ago

Sega01 commented 1 year ago

Hi,

after I got it to work I started SD a few days later and suddenly got an error when roop is active. Error see below, someone knows what to do?

Error loading script: api.py
Traceback (most recent call last):
  File "D:\Stable Diffusion\system\python\lib\site-packages\insightface\__init__.py", line 8, in <module>
    import onnxruntime
  File "D:\Stable Diffusion\system\python\lib\site-packages\onnxruntime\__init__.py", line 56, in <module>
    raise import_capi_exception
  File "D:\Stable Diffusion\system\python\lib\site-packages\onnxruntime\__init__.py", line 37, in <module>
    from onnxruntime.capi._pybind_state import create_and_register_allocator_v2  # noqa: F401
ImportError: cannot import name 'create_and_register_allocator_v2' from 'onnxruntime.capi._pybind_state' (D:\Stable Diffusion\system\python\lib\site-packages\onnxruntime\capi\_pybind_state.py)
During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "D:\Stable Diffusion\webui\modules\scripts.py", line 382, in load_scripts
    script_module = script_loading.load_module(scriptfile.path)
  File "D:\Stable Diffusion\webui\modules\script_loading.py", line 10, in load_module
    module_spec.loader.exec_module(module)
  File "<frozen importlib._bootstrap_external>", line 883, in exec_module
  File "<frozen importlib._bootstrap>", line 241, in _call_with_frames_removed
  File "D:\Stable Diffusion\webui\extensions\sd-webui-roop\scripts\api.py", line 17, in <module>
    from scripts.faceswap import get_models
  File "D:\Stable Diffusion\webui\extensions\sd-webui-roop\scripts\faceswap.py", line 16, in <module>
    from scripts.swapper import UpscaleOptions, swap_face, ImageResult
  File "D:\Stable Diffusion\webui\extensions\sd-webui-roop\scripts\swapper.py", line 12, in <module>
    import insightface
  File "D:\Stable Diffusion\system\python\lib\site-packages\insightface\__init__.py", line 10, in <module>
    raise ImportError(
ImportError: Unable to import dependency onnxruntime.

*** Error loading script: cimage.py
Traceback (most recent call last):
  File "D:\Stable Diffusion\webui\modules\scripts.py", line 382, in load_scripts
    script_module = script_loading.load_module(scriptfile.path)
  File "D:\Stable Diffusion\webui\modules\script_loading.py", line 10, in load_module
    module_spec.loader.exec_module(module)
  File "<frozen importlib._bootstrap_external>", line 883, in exec_module
  File "<frozen importlib._bootstrap>", line 241, in _call_with_frames_removed
  File "D:\Stable Diffusion\webui\extensions\sd-webui-roop\scripts\cimage.py", line 2, in <module>
    from ifnude import detect
  File "D:\Stable Diffusion\system\python\lib\site-packages\ifnude\__init__.py", line 1, in <module>
    from .detector import detect
  File "D:\Stable Diffusion\system\python\lib\site-packages\ifnude\detector.py", line 4, in <module>
    import onnxruntime
  File "D:\Stable Diffusion\system\python\lib\site-packages\onnxruntime\__init__.py", line 56, in <module>
    raise import_capi_exception
  File "D:\Stable Diffusion\system\python\lib\site-packages\onnxruntime\__init__.py", line 37, in <module>
    from onnxruntime.capi._pybind_state import create_and_register_allocator_v2  # noqa: F401
ImportError: cannot import name 'create_and_register_allocator_v2' from 'onnxruntime.capi._pybind_state' (D:\Stable Diffusion\system\python\lib\site-packages\onnxruntime\capi\_pybind_state.py)

Error loading script: faceswap.py
Traceback (most recent call last):
  File "D:\Stable Diffusion\system\python\lib\site-packages\insightface\__init__.py", line 8, in <module>
    import onnxruntime
  File "D:\Stable Diffusion\system\python\lib\site-packages\onnxruntime\__init__.py", line 56, in <module>
    raise import_capi_exception
  File "D:\Stable Diffusion\system\python\lib\site-packages\onnxruntime\__init__.py", line 37, in <module>
    from onnxruntime.capi._pybind_state import create_and_register_allocator_v2  # noqa: F401
ImportError: cannot import name 'create_and_register_allocator_v2' from 'onnxruntime.capi._pybind_state' (D:\Stable Diffusion\system\python\lib\site-packages\onnxruntime\capi\_pybind_state.py)

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "D:\Stable Diffusion\webui\modules\scripts.py", line 382, in load_scripts
    script_module = script_loading.load_module(scriptfile.path)
  File "D:\Stable Diffusion\webui\modules\script_loading.py", line 10, in load_module
    module_spec.loader.exec_module(module)
  File "<frozen importlib._bootstrap_external>", line 883, in exec_module
  File "<frozen importlib._bootstrap>", line 241, in _call_with_frames_removed
  File "D:\Stable Diffusion\webui\extensions\sd-webui-roop\scripts\faceswap.py", line 16, in <module>
    from scripts.swapper import UpscaleOptions, swap_face, ImageResult
  File "D:\Stable Diffusion\webui\extensions\sd-webui-roop\scripts\swapper.py", line 12, in <module>
    import insightface
  File "D:\Stable Diffusion\system\python\lib\site-packages\insightface\__init__.py", line 10, in <module>
    raise ImportError(
ImportError: Unable to import dependency onnxruntime.

2023-10-11 22:39:57,212 - roop - INFO - roop v0.0.2
*** Error loading script: swapper.py
Traceback (most recent call last):
  File "D:\Stable Diffusion\system\python\lib\site-packages\insightface\__init__.py", line 8, in <module>
    import onnxruntime
  File "D:\Stable Diffusion\system\python\lib\site-packages\onnxruntime\__init__.py", line 56, in <module>
    raise import_capi_exception
  File "D:\Stable Diffusion\system\python\lib\site-packages\onnxruntime\__init__.py", line 37, in <module>
    from onnxruntime.capi._pybind_state import create_and_register_allocator_v2  # noqa: F401
ImportError: cannot import name 'create_and_register_allocator_v2' from 'onnxruntime.capi._pybind_state' (D:\Stable
Diffusion\system\python\lib\site-packages\onnxruntime\capi\_pybind_state.py)

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "D:\Stable Diffusion\webui\modules\scripts.py", line 382, in load_scripts
    script_module = script_loading.load_module(scriptfile.path)
  File "D:\Stable Diffusion\webui\modules\script_loading.py", line 10, in load_module
    module_spec.loader.exec_module(module)
  File "<frozen importlib._bootstrap_external>", line 883, in exec_module
  File "<frozen importlib._bootstrap>", line 241, in _call_with_frames_removed
  File "D:\Stable Diffusion\webui\extensions\sd-webui-roop\scripts\swapper.py", line 12, in <module>
    import insightface
  File "D:\Stable Diffusion\system\python\lib\site-packages\insightface\__init__.py", line 10, in <module>
    raise ImportError(
ImportError: Unable to import dependency onnxruntime.
GRAYHUI512 commented 10 months ago

解决啦吗

HEONDRED commented 9 months ago

I have a goddamn same error with you...

drmmkyr commented 9 months ago

i fix do below

go to comfyui root folder run CMD run below command to install onnxruntime module python_embeded\python.exe -m pip install onnxruntime