invoke-ai / InvokeAI

Invoke is a leading creative engine for Stable Diffusion models, empowering professionals, artists, and enthusiasts to generate and create visual media using the latest AI-driven technologies. The solution offers an industry leading WebUI, and serves as the foundation for multiple commercial products.
https://invoke-ai.github.io/InvokeAI/
Apache License 2.0
23.49k stars 2.42k forks source link

[bug]: DLL load failed while importing onnx_cpp2py_export #7111

Open TobiasReich opened 1 week ago

TobiasReich commented 1 week ago

Is there an existing issue for this problem?

Operating system

Windows

GPU vendor

Nvidia (CUDA)

GPU model

RTX 4080

GPU VRAM

16

Version number

5.2.0rc1

Browser

Firefox

Python dependencies

No response

What happened

I had some dependency issues (newer ones were installed during installation and thus I could not proceed with the installation). The latest version 5.2.0rc1 solved this. I installed invokeAI the usual way but when I started it I got this error.

Desired action:

  1. Generate images with the browser-based interface
  2. Open the developer console
  3. Command-line help Q - Quit

To update, download and run the installer from https://github.com/invoke-ai/InvokeAI/releases/latest

Please enter 1-4, Q: [1] Starting the InvokeAI browser-based UI.. Traceback (most recent call last): File "C:\Users\T\AppData\Local\Programs\Python\Python310\lib\runpy.py", line 196, in _run_module_as_main return _run_code(code, main_globals, None, File "C:\Users\T\AppData\Local\Programs\Python\Python310\lib\runpy.py", line 86, in _run_code exec(code, run_globals) File "C:\Users\T\invokeai.venv\Scripts\invokeai-web.exe__main__.py", line 7, in sys.exit(run_app()) File "C:\Users\T\invokeai.venv\lib\site-packages\invokeai\app\run_app.py", line 10, in run_app from invokeai.app.api_app import invoke_api File "C:\Users\T\invokeai.venv\lib\site-packages\invokeai\app\api_app.py", line 24, in from invokeai.app.api.dependencies import ApiDependencies File "C:\Users\T\invokeai.venv\lib\site-packages\invokeai\app\api\dependencies.py", line 14, in from invokeai.app.services.download.download_default import DownloadQueueService File "C:\Users\T\invokeai.venv\lib\site-packages\invokeai\app\services\download__init.py", line 3, in from invokeai.app.services.download.download_base import ( File "C:\Users\T\invokeai.venv\lib\site-packages\invokeai\app\services\download\download_base.py", line 13, in from invokeai.backend.model_manager.metadata import RemoteModelFile File "C:\Users\T\invokeai.venv\lib\site-packages\invokeai\backend\model_manager\init.py", line 16, in from invokeai.backend.model_manager.load import LoadedModel File "C:\Users\T\invokeai.venv\lib\site-packages\invokeai\backend\model_manager\load\init.py", line 9, in from invokeai.backend.model_manager.load.load_base import LoadedModel, LoadedModelWithoutConfig, ModelLoaderBase File "C:\Users\T\invokeai.venv\lib\site-packages\invokeai\backend\model_manager\load\load_base.py", line 21, in from invokeai.backend.model_manager.load.model_cache.model_cache_base import ModelCacheBase, ModelLockerBase File "C:\Users\T\invokeai.venv\lib\site-packages\invokeai\backend\model_manager\load\model_cache\init.py", line 4, in from .model_cache_default import ModelCache # noqa F401 File "C:\Users\T\invokeai.venv\lib\site-packages\invokeai\backend\model_manager\load\model_cache\model_cache_default.py", line 23, in from invokeai.backend.model_manager.load.model_util import calc_model_size_by_data File "C:\Users\T\invokeai.venv\lib\site-packages\invokeai\backend\model_manager\load\model_util.py", line 20, in from invokeai.backend.onnx.onnx_runtime import IAIOnnxRuntimeModel File "C:\Users\T\invokeai.venv\lib\site-packages\invokeai\backend\onnx\onnx_runtime.py", line 8, in import onnx File "C:\Users\T\invokeai.venv\lib\site-packages\onnx\init__.py", line 77, in from onnx.onnx_cpp2py_export import ONNX_ML ImportError: DLL load failed while importing onnx_cpp2py_export: A dynamic link library (DLL) initialization routine failed.

I did the usual fixes like

Any idea what I might try next?

What you expected to happen

The application should start as usual.

How to reproduce the problem

No response

Additional context

No response

Discord username

No response

BeastDD commented 1 week ago

There is currently an issue between ONNX and ONNX runtime on the latest version of InvokeAI. For some reason when I use the InvokeAI installer, after updating it my InvokeAI installation I realized that it doesn't create all the folder it used to. I also tried it on a random new folder installation to trigger a full new install, and it did the same thing once again. It just created a .venv folder but none of the models, config, database and so on little folders that it used to make... It just generate or update the .venv folder and it downloads incompatible versions of ONNX and ONNX Runtime. You're the lucky though as I pieced a solution together after looking into forums and running some test.

  1. Update the Invoke AI installer
  2. Pick a place to install the InvokeAI app. (it can be new or an old one that you are updating)
  3. Launch InvokeAI and pick option 2 the "Developer Console"
  4. Now enter this: pip uninstall onnx onnxruntime

Press (Y) to both time that it ask you if you want to uninstall the respective packages Then enter this next

pip install onnx==1.16.1 onnxruntime==1.16.3

Let it do its thing and write "exit"

  1. Proceed to choose option 1 - Your InvokeAI should launch no problems now.

TLDR - Uninstall the version of ONNX and ONNX Runtime that you have currently install in your venv and reinstall ONNX 1.16.1 & ONNX Runtime 1.16.3

Note:

- These are the earliest version of ONNX and ONNX Runtime I could run together with my InvokeAI installation. If you try >1.16.2 for ONNX and >1.16.3ONNX Runtime you will constantly run into this error.

- This behavior has been happening to me since the previous update of 5.2.0rc1 and is currently still happening with 5.2.0rc1. I don't know what cause this but ONNX and ONXX runtime gets updated to their latest respective version when updating InvokeAI and both of these versions seem to not be working for InvokeAI.

DLL load failed while importing onnx_cpp2py_export: A dynamic link library (DLL) initialization routine failed.