fast-stable-diffusion icon indicating copy to clipboard operation
fast-stable-diffusion copied to clipboard

IP-Adapter error(ModuleNotFoundError: No module named 'onnx')

Open Takuya0331 opened this issue 1 year ago • 23 comments

After upgrading to the latest version, I started getting an error with the Controlnet IP-Adapter.

ModuleNotFoundError: No module named 'onnx'

It says this and I can't load images. Is there a solution?

Takuya0331 avatar Jan 24 '25 21:01 Takuya0331

I am getting the same error.

I ran the following code before running [Start Stable-Diffusion]. !pip install onnx Then when I run [Start Stable-Diffusion] I get the following error: ImportError: cannot import name 'mesh_core_cython' from 'insightface.thirdparty.face3d.mesh.cython' (unknown location)

foobar-san avatar Jan 26 '25 04:01 foobar-san

I've created a "new issue" with more details here: https://github.com/AUTOMATIC1111/stable-diffusion-webui/issues/16811

foobar-san avatar Jan 27 '25 02:01 foobar-san

要怎么解决图片生成不了问题?

xiahongyu939 avatar Jan 27 '25 09:01 xiahongyu939

It seems that insightface needs to be installed. I ran the following code before running [Start Stable-Diffusion].

!pip install cmake !pip install cython !pip install onnxruntime !pip install insightface

[Execution result] Requirement already satisfied: cmake in /usr/local/lib/python3.11/dist-packages (3.31.4) WARNING: Error parsing dependencies of pytorch-lightning: .* suffix can only be used with == or != operators torch (>=1.9.) ~~~~~~^ WARNING: Error parsing dependencies of torchsde: . suffix can only be used with == or != operators numpy (>=1.19.) ; python_version >= "3.7" ~~~~~~~^ Requirement already satisfied: cython in /usr/local/lib/python3.11/dist-packages (3.0.11) WARNING: Error parsing dependencies of pytorch-lightning: . suffix can only be used with == or != operators torch (>=1.9.) ~~~~~~^ WARNING: Error parsing dependencies of torchsde: . suffix can only be used with == or != operators numpy (>=1.19.) ; python_version >= "3.7" ~~~~~~~^ Requirement already satisfied: onnxruntime in /usr/local/lib/python3.11/dist-packages (1.20.1) Requirement already satisfied: coloredlogs in /usr/local/lib/python3.11/dist-packages (from onnxruntime) (15.0.1) Requirement already satisfied: flatbuffers in /usr/local/lib/python3.11/dist-packages (from onnxruntime) (25.1.21) Requirement already satisfied: numpy>=1.21.6 in /usr/local/lib/python3.11/dist-packages (from onnxruntime) (1.26.4) Requirement already satisfied: packaging in /usr/local/lib/python3.11/dist-packages (from onnxruntime) (24.2) Requirement already satisfied: protobuf in /usr/local/lib/python3.11/dist-packages (from onnxruntime) (3.20.3) Requirement already satisfied: sympy in /usr/local/lib/python3.11/dist-packages (from onnxruntime) (1.13.1) Requirement already satisfied: humanfriendly>=9.1 in /usr/local/lib/python3.11/dist-packages (from coloredlogs->onnxruntime) (10.0) Requirement already satisfied: mpmath<1.4,>=1.1.0 in /usr/local/lib/python3.11/dist-packages (from sympy->onnxruntime) (1.3.0) WARNING: Error parsing dependencies of pytorch-lightning: . suffix can only be used with == or != operators torch (>=1.9.) ~~~~~~^ WARNING: Error parsing dependencies of torchsde: . suffix can only be used with == or != operators numpy (>=1.19.) ; python_version >= "3.7" ~~~~~~~^ Requirement already satisfied: insightface in /usr/local/lib/python3.11/dist-packages (0.7.3) Requirement already satisfied: numpy in /usr/local/lib/python3.11/dist-packages (from insightface) (1.26.4) Collecting onnx (from insightface) Downloading onnx-1.17.0-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.metadata (16 kB) Requirement already satisfied: tqdm in /usr/local/lib/python3.11/dist-packages (from insightface) (4.67.1) Requirement already satisfied: requests in /usr/local/lib/python3.11/dist-packages (from insightface) (2.28.2) Requirement already satisfied: matplotlib in /usr/local/lib/python3.11/dist-packages (from insightface) (3.10.0) Requirement already satisfied: Pillow in /usr/local/lib/python3.11/dist-packages (from insightface) (11.1.0) Requirement already satisfied: scipy in /usr/local/lib/python3.11/dist-packages (from insightface) (1.13.1) Requirement already satisfied: scikit-learn in /usr/local/lib/python3.11/dist-packages (from insightface) (1.3.2) Requirement already satisfied: scikit-image in /usr/local/lib/python3.11/dist-packages (from insightface) (0.24.0) Requirement already satisfied: easydict in /usr/local/lib/python3.11/dist-packages (from insightface) (1.13) Requirement already satisfied: cython in /usr/local/lib/python3.11/dist-packages (from insightface) (3.0.11) Requirement already satisfied: albumentations in /usr/local/lib/python3.11/dist-packages (from insightface) (0.4.3) Requirement already satisfied: prettytable in /usr/local/lib/python3.11/dist-packages (from insightface) (3.13.0) Requirement already satisfied: imgaug<0.2.7,>=0.2.5 in /usr/local/lib/python3.11/dist-packages (from albumentations->insightface) (0.2.6) Requirement already satisfied: PyYAML in /usr/local/lib/python3.11/dist-packages (from albumentations->insightface) (6.0.2) Requirement already satisfied: opencv-python>=4.1.1 in /usr/local/lib/python3.11/dist-packages (from albumentations->insightface) (4.10.0.84) Requirement already satisfied: contourpy>=1.0.1 in /usr/local/lib/python3.11/dist-packages (from matplotlib->insightface) (1.3.1) Requirement already satisfied: cycler>=0.10 in /usr/local/lib/python3.11/dist-packages (from matplotlib->insightface) (0.12.1) Requirement already satisfied: fonttools>=4.22.0 in /usr/local/lib/python3.11/dist-packages (from matplotlib->insightface) (4.55.6) Requirement already satisfied: kiwisolver>=1.3.1 in /usr/local/lib/python3.11/dist-packages (from matplotlib->insightface) (1.4.8) Requirement already satisfied: packaging>=20.0 in /usr/local/lib/python3.11/dist-packages (from matplotlib->insightface) (24.2) Requirement already satisfied: pyparsing>=2.3.1 in /usr/local/lib/python3.11/dist-packages (from matplotlib->insightface) (3.2.1) Requirement already satisfied: python-dateutil>=2.7 in /usr/local/lib/python3.11/dist-packages (from matplotlib->insightface) (2.8.2) Requirement already satisfied: protobuf>=3.20.2 in /usr/local/lib/python3.11/dist-packages (from onnx->insightface) (3.20.3) Requirement already satisfied: wcwidth in /usr/local/lib/python3.11/dist-packages (from prettytable->insightface) (0.2.13) Requirement already satisfied: charset-normalizer<4,>=2 in /usr/local/lib/python3.11/dist-packages (from requests->insightface) (3.1.0) Requirement already satisfied: idna<4,>=2.5 in /usr/local/lib/python3.11/dist-packages (from requests->insightface) (3.10) Requirement already satisfied: urllib3<1.27,>=1.21.1 in /usr/local/lib/python3.11/dist-packages (from requests->insightface) (1.26.12) Requirement already satisfied: certifi>=2017.4.17 in /usr/local/lib/python3.11/dist-packages (from requests->insightface) (2024.12.14) Requirement already satisfied: networkx>=2.8 in /usr/local/lib/python3.11/dist-packages (from scikit-image->insightface) (3.4.2) Requirement already satisfied: imageio>=2.33 in /usr/local/lib/python3.11/dist-packages (from scikit-image->insightface) (2.36.1) Requirement already satisfied: tifffile>=2022.8.12 in /usr/local/lib/python3.11/dist-packages (from scikit-image->insightface) (2025.1.10) Requirement already satisfied: lazy-loader>=0.4 in /usr/local/lib/python3.11/dist-packages (from scikit-image->insightface) (0.4) Requirement already satisfied: joblib>=1.1.1 in /usr/local/lib/python3.11/dist-packages (from scikit-learn->insightface) (1.4.2) Requirement already satisfied: threadpoolctl>=2.0.0 in /usr/local/lib/python3.11/dist-packages (from scikit-learn->insightface) (3.5.0) Requirement already satisfied: six in /usr/local/lib/python3.11/dist-packages (from imgaug<0.2.7,>=0.2.5->albumentations->insightface) (1.17.0) Downloading onnx-1.17.0-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (16.0 MB) ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 16.0/16.0 MB 99.2 MB/s eta 0:00:00 WARNING: Error parsing dependencies of pytorch-lightning: . suffix can only be used with == or != operators torch (>=1.9.) ~~~~~~^ WARNING: Error parsing dependencies of torchsde: . suffix can only be used with == or != operators numpy (>=1.19.*) ; python_version >= "3.7" ~~~~~~~^ Installing collected packages: onnx Successfully installed onnx-1.17.0

foobar-san avatar Jan 29 '25 09:01 foobar-san

Then when I run [Start Stable-Diffusion] I get the following error: ImportError: cannot import name 'mesh_core_cython' from 'insightface.thirdparty.face3d.mesh.cython' (unknown location)

The result remains the same :( The installation of insightface seems to have failed, but I don't know why.

foobar-san avatar Jan 29 '25 09:01 foobar-san

I have never installed insightface before. Previously, was insightface automatically installed when I ran ip-adapter-faceid-plus for the first time...?

foobar-san avatar Jan 29 '25 09:01 foobar-san

So what should I do to get the picture generated?

xiahongyu939 avatar Jan 29 '25 13:01 xiahongyu939

安装了这些直接无法运行了

xiahongyu939 avatar Jan 29 '25 13:01 xiahongyu939

具体是什么版本

xiahongyu939 avatar Jan 29 '25 13:01 xiahongyu939

When I was running, it was disconnected directly.

xiahongyu939 avatar Jan 29 '25 16:01 xiahongyu939

AttributeError: 'NoneType' object has no attribute 'mode'

xiahongyu939 avatar Jan 30 '25 04:01 xiahongyu939

it should work now, use the latest unmodified notebook

TheLastBen avatar Feb 01 '25 19:02 TheLastBen

it should work now, use the latest unmodified notebook

@TheLastBen Great God, the following error occurred when I generated the picture, please fix it! Warning: unknown mime-type for "outputs/txt2img-images" -- using "application/octet-stream" Error: no "view" mailcap rules found for type "application/octet-stream" /usr/bin/xdg-open: 882: www-browser: not found /usr/bin/xdg-open: 882: links2: not found /usr/bin/xdg-open: 882: elinks: not found /usr/bin/xdg-open: 882: links: not found /usr/bin/xdg-open: 882: lynx: not found /usr/bin/xdg-open: 882: w3m: not found xdg-open: no method available for opening 'outputs/txt2img-images' 100% 50/50 [00:12<00:00, 3.97it/s]

xiahongyu939 avatar Feb 02 '25 02:02 xiahongyu939

Thank you, TheLastBen :)

I used the latest unmodified notebook. I get the following error: RuntimeError: Failed downloading url http://insightface.cn-sh2.ufileos.com/models/buffalo_l.zip

When I access the URL, I get the following error: {"RetCode":-148643, "ErrMsg":"no authorization found"}

foobar-san avatar Feb 03 '25 02:02 foobar-san

Thank you, TheLastBen :)

I used the latest unmodified notebook. I get the following error: RuntimeError: Failed downloading url http://insightface.cn-sh2.ufileos.com/models/buffalo_l.zip

When I access the URL, I get the following error: {"RetCode":-148643, "ErrMsg":"no authorization found"}

That's an issue related to insightface, this is a working link https://github.com/deepinsight/insightface/releases/download/v0.7/buffalo_l.zip

TheLastBen avatar Feb 03 '25 06:02 TheLastBen

Solved! Thank you! The folder structure was as follows: https://github.com/Mikubill/sd-webui-controlnet/issues/2511#issuecomment-1905211766

foobar-san avatar Feb 03 '25 07:02 foobar-san

@TheLastBen Why can't I generate images?

xiahongyu939 avatar Feb 03 '25 12:02 xiahongyu939

@TheLastBen I still can't generate images.You can go to the website I listed to run stable diffusion and see if you can generate images(remember to enter the prompt). https://colab.research.google.com/github/Van-wise/sd-colab/blob/main/fast/fast_stable_diffusion.ipynb

xiahongyu939 avatar Feb 03 '25 12:02 xiahongyu939

@TheLastBen I still can't generate images.You can go to the website I listed to run stable diffusion and see if you can generate images(remember to enter the prompt). https://colab.research.google.com/github/Van-wise/sd-colab/blob/main/fast/fast_stable_diffusion.ipynb

use this notebook for generating images https://colab.research.google.com/github/TheLastBen/fast-stable-diffusion/blob/main/fast_stable_diffusion_AUTOMATIC1111.ipynb

TheLastBen avatar Feb 03 '25 12:02 TheLastBen

How install lora?

xiahongyu939 avatar Feb 03 '25 15:02 xiahongyu939

@TheLastBen I still can't generate images.You can go to the website I listed to run stable diffusion and see if you can generate images(remember to enter the prompt). https://colab.research.google.com/github/Van-wise/sd-colab/blob/main/fast/fast_stable_diffusion.ipynb

use this notebook for generating images https://colab.research.google.com/github/TheLastBen/fast-stable-diffusion/blob/main/fast_stable_diffusion_AUTOMATIC1111.ipynb

@TheLastBen How to install lora?

xiahongyu939 avatar Feb 03 '25 17:02 xiahongyu939

@TheLastBen I still can't generate images.You can go to the website I listed to run stable diffusion and see if you can generate images(remember to enter the prompt). https://colab.research.google.com/github/Van-wise/sd-colab/blob/main/fast/fast_stable_diffusion.ipynb

use this notebook for generating images https://colab.research.google.com/github/TheLastBen/fast-stable-diffusion/blob/main/fast_stable_diffusion_AUTOMATIC1111.ipynb

@TheLastBen How to install lora?

you can find plenty of turorials on youtube

TheLastBen avatar Feb 03 '25 17:02 TheLastBen

@TheLastBen what?I mean how to install lora your code.

xiahongyu939 avatar Feb 04 '25 02:02 xiahongyu939