krita-ai-diffusion icon indicating copy to clipboard operation
krita-ai-diffusion copied to clipboard

Server error: No module named 'insightface'

Open toybrand opened this issue 4 months ago • 4 comments

Server error: No module named 'insightface' Upgrade and no face conversion

toybrand avatar Aug 29 '25 01:08 toybrand

That can happen I think since insightface is only installed when you download the face related models (not when you update/reinstall).

Workaround: find those models in models/ipadapter and models/loras folders and delete them, then use the installer to download them again. That should install insightface too.

Acly avatar Aug 30 '25 18:08 Acly

Thanks,

I have the same problem as the original poster and followed your hint, deleted the models and tried to reinstall them via the GUI. But it fails with this log:

Exception: Error during installation: Using Python 3.12.11 environment at: venv
Resolved 44 packages in 27ms
   Building insightface==0.7.3
  × Failed to build `insightface==0.7.3`
  ├─▶ The build backend returned an error
  ╰─▶ Call to `setuptools.build_meta.build_wheel` failed (exit status: 1)

      [stdout]
      WARNING: pandoc not enabled
      running bdist_wheel
      running build
      running build_py
      copying insightface/__init__.py ->
      build/lib.linux-x86_64-cpython-312/insightface
      copying insightface/app/__init__.py ->
      build/lib.linux-x86_64-cpython-312/insightface/app
      copying insightface/app/common.py ->
      build/lib.linux-x86_64-cpython-312/insightface/app
      copying insightface/app/face_analysis.py ->
      build/lib.linux-x86_64-cpython-312/insightface/app
      copying insightface/app/mask_renderer.py ->
      build/lib.linux-x86_64-cpython-312/insightface/app
      copying insightface/commands/__init__.py ->
      build/lib.linux-x86_64-cpython-312/insightface/commands
      copying insightface/commands/insightface_cli.py ->
      build/lib.linux-x86_64-cpython-312/insightface/commands
      copying insightface/commands/model_download.py ->
      build/lib.linux-x86_64-cpython-312/insightface/commands
      copying insightface/commands/rec_add_mask_param.py ->
      build/lib.linux-x86_64-cpython-312/insightface/commands
      copying insightface/data/__init__.py ->
      build/lib.linux-x86_64-cpython-312/insightface/data
      copying insightface/data/image.py ->
      build/lib.linux-x86_64-cpython-312/insightface/data
      copying insightface/data/pickle_object.py ->
      build/lib.linux-x86_64-cpython-312/insightface/data
      copying insightface/data/rec_builder.py ->
      build/lib.linux-x86_64-cpython-312/insightface/data
      copying insightface/model_zoo/__init__.py ->
      build/lib.linux-x86_64-cpython-312/insightface/model_zoo
      copying insightface/model_zoo/arcface_onnx.py ->
      build/lib.linux-x86_64-cpython-312/insightface/model_zoo
      copying insightface/model_zoo/attribute.py ->
      build/lib.linux-x86_64-cpython-312/insightface/model_zoo
      copying insightface/model_zoo/inswapper.py ->
      build/lib.linux-x86_64-cpython-312/insightface/model_zoo
      copying insightface/model_zoo/landmark.py ->
      build/lib.linux-x86_64-cpython-312/insightface/model_zoo
      copying insightface/model_zoo/model_store.py ->
      build/lib.linux-x86_64-cpython-312/insightface/model_zoo
      copying insightface/model_zoo/model_zoo.py ->
      build/lib.linux-x86_64-cpython-312/insightface/model_zoo
      copying insightface/model_zoo/retinaface.py ->
      build/lib.linux-x86_64-cpython-312/insightface/model_zoo
      copying insightface/model_zoo/scrfd.py ->
      build/lib.linux-x86_64-cpython-312/insightface/model_zoo
      copying insightface/thirdparty/__init__.py ->
      build/lib.linux-x86_64-cpython-312/insightface/thirdparty
      copying insightface/utils/__init__.py ->
      build/lib.linux-x86_64-cpython-312/insightface/utils
      copying insightface/utils/constant.py ->
      build/lib.linux-x86_64-cpython-312/insightface/utils
      copying insightface/utils/download.py ->
      build/lib.linux-x86_64-cpython-312/insightface/utils
      copying insightface/utils/face_align.py ->
      build/lib.linux-x86_64-cpython-312/insightface/utils
      copying insightface/utils/filesystem.py ->
      build/lib.linux-x86_64-cpython-312/insightface/utils
      copying insightface/utils/storage.py ->
      build/lib.linux-x86_64-cpython-312/insightface/utils
      copying insightface/utils/transform.py ->
      build/lib.linux-x86_64-cpython-312/insightface/utils
      copying insightface/thirdparty/face3d/__init__.py ->
      build/lib.linux-x86_64-cpython-312/insightface/thirdparty/face3d
      copying insightface/thirdparty/face3d/mesh/__init__.py ->
      build/lib.linux-x86_64-cpython-312/insightface/thirdparty/face3d/mesh
      copying insightface/thirdparty/face3d/mesh/io.py ->
      build/lib.linux-x86_64-cpython-312/insightface/thirdparty/face3d/mesh
      copying insightface/thirdparty/face3d/mesh/light.py ->
      build/lib.linux-x86_64-cpython-312/insightface/thirdparty/face3d/mesh
      copying insightface/thirdparty/face3d/mesh/render.py ->
      build/lib.linux-x86_64-cpython-312/insightface/thirdparty/face3d/mesh
      copying insightface/thirdparty/face3d/mesh/transform.py ->
      build/lib.linux-x86_64-cpython-312/insightface/thirdparty/face3d/mesh
      copying insightface/thirdparty/face3d/mesh/vis.py ->
      build/lib.linux-x86_64-cpython-312/insightface/thirdparty/face3d/mesh
      copying insightface/thirdparty/face3d/mesh_numpy/__init__.py ->
      build/lib.linux-x86_64-cpython-312/insightface/thirdparty/face3d/mesh_numpy
      copying insightface/thirdparty/face3d/mesh_numpy/io.py ->
      build/lib.linux-x86_64-cpython-312/insightface/thirdparty/face3d/mesh_numpy
      copying insightface/thirdparty/face3d/mesh_numpy/light.py ->
      build/lib.linux-x86_64-cpython-312/insightface/thirdparty/face3d/mesh_numpy
      copying insightface/thirdparty/face3d/mesh_numpy/render.py ->
      build/lib.linux-x86_64-cpython-312/insightface/thirdparty/face3d/mesh_numpy
      copying insightface/thirdparty/face3d/mesh_numpy/transform.py ->
      build/lib.linux-x86_64-cpython-312/insightface/thirdparty/face3d/mesh_numpy
      copying insightface/thirdparty/face3d/mesh_numpy/vis.py ->
      build/lib.linux-x86_64-cpython-312/insightface/thirdparty/face3d/mesh_numpy
      copying insightface/thirdparty/face3d/morphable_model/__init__.py ->
      build/lib.linux-x86_64-cpython-312/insightface/thirdparty/face3d/morphable_model
      copying insightface/thirdparty/face3d/morphable_model/fit.py ->
      build/lib.linux-x86_64-cpython-312/insightface/thirdparty/face3d/morphable_model
      copying insightface/thirdparty/face3d/morphable_model/load.py ->
      build/lib.linux-x86_64-cpython-312/insightface/thirdparty/face3d/morphable_model
      copying
      insightface/thirdparty/face3d/morphable_model/morphabel_model.py ->
      build/lib.linux-x86_64-cpython-312/insightface/thirdparty/face3d/morphable_model
      running egg_info
      writing insightface.egg-info/PKG-INFO
      writing dependency_links to insightface.egg-info/dependency_links.txt
      writing entry points to insightface.egg-info/entry_points.txt
      writing requirements to insightface.egg-info/requires.txt
      writing top-level names to insightface.egg-info/top_level.txt
      reading manifest file 'insightface.egg-info/SOURCES.txt'
      writing manifest file 'insightface.egg-info/SOURCES.txt'
      copying insightface/data/images/Tom_Hanks_54745.png ->
      build/lib.linux-x86_64-cpython-312/insightface/data/images
      copying insightface/data/images/mask_black.jpg ->
      build/lib.linux-x86_64-cpython-312/insightface/data/images
      copying insightface/data/images/mask_blue.jpg ->
      build/lib.linux-x86_64-cpython-312/insightface/data/images
      copying insightface/data/images/mask_green.jpg ->
      build/lib.linux-x86_64-cpython-312/insightface/data/images
      copying insightface/data/images/mask_white.jpg ->
      build/lib.linux-x86_64-cpython-312/insightface/data/images
      copying insightface/data/images/t1.jpg ->
      build/lib.linux-x86_64-cpython-312/insightface/data/images
      copying insightface/data/objects/meanshape_68.pkl ->
      build/lib.linux-x86_64-cpython-312/insightface/data/objects
      copying insightface/thirdparty/face3d/mesh/cython/mesh_core.cpp ->
      build/lib.linux-x86_64-cpython-312/insightface/thirdparty/face3d/mesh/cython
      copying insightface/thirdparty/face3d/mesh/cython/mesh_core.h ->
      build/lib.linux-x86_64-cpython-312/insightface/thirdparty/face3d/mesh/cython
      copying insightface/thirdparty/face3d/mesh/cython/mesh_core_cython.c ->
      build/lib.linux-x86_64-cpython-312/insightface/thirdparty/face3d/mesh/cython
      copying insightface/thirdparty/face3d/mesh/cython/mesh_core_cython.cpp ->
      build/lib.linux-x86_64-cpython-312/insightface/thirdparty/face3d/mesh/cython
      copying insightface/thirdparty/face3d/mesh/cython/mesh_core_cython.pyx ->
      build/lib.linux-x86_64-cpython-312/insightface/thirdparty/face3d/mesh/cython
      copying insightface/thirdparty/face3d/mesh/cython/setup.py ->
      build/lib.linux-x86_64-cpython-312/insightface/thirdparty/face3d/mesh/cython
      running build_ext
      building 'insightface.thirdparty.face3d.mesh.cython.mesh_core_cython'
      extension
      x86_64-unknown-linux-gnu-c++ -fno-strict-overflow
      -Wsign-compare -DNDEBUG -g -O3 -Wall -O2 -pipe -g
      -Wp,-D_FORTIFY_SOURCE=3 -Wp,-D_GLIBCXX_ASSERTIONS
      -fexceptions -fstack-protector-strong -grecord-gcc-switches
      -fasynchronous-unwind-tables -fstack-clash-protection -fcf-protection
      -fno-omit-frame-pointer -mno-omit-leaf-frame-pointer -O3 -O2
      -pipe -g -Wp,-D_FORTIFY_SOURCE=3 -Wp,-D_GLIBCXX_ASSERTIONS
      -fexceptions -fstack-protector-strong -grecord-gcc-switches
      -fasynchronous-unwind-tables -fstack-clash-protection
      -fcf-protection -fno-omit-frame-pointer -mno-omit-leaf-frame-pointer
      -O3 -fPIC -Iinsightface/thirdparty/face3d/mesh/cython
      -I/home/steffen/.var/app/org.kde.krita/cache/uv/builds-v0/.tmp2CoKHo/lib/python3.12/site-packages/numpy/_core/include
      -I/home/steffen/.var/app/org.kde.krita/cache/uv/builds-v0/.tmp2CoKHo/include
      -I/usr/include/python3.12 -c
      insightface/thirdparty/face3d/mesh/cython/mesh_core.cpp -o
      build/temp.linux-x86_64-cpython-312/insightface/thirdparty/face3d/mesh/cython/mesh_core.o

      [stderr]
      /home/steffen/.var/app/org.kde.krita/cache/uv/builds-v0/.tmp2CoKHo/lib/python3.12/site-packages/setuptools/command/build_py.py:212:
      _Warning: Package 'insightface.data.images' is absent from the
      `packages` configuration.
      !!

      
      ********************************************************************************
              ############################
              # Package would be ignored #
              ############################
              Python recognizes 'insightface.data.images' as an importable
      package[^1],
              but it is absent from setuptools' `packages` configuration.

              This leads to an ambiguous overall configuration. If you want to
      distribute this
              package, please make sure that 'insightface.data.images' is
      explicitly added
              to the `packages` configuration field.

              Alternatively, you can also rely on setuptools' discovery
      methods
              (for example by using
      `find_namespace_packages(...)`/`find_namespace:`
              instead of `find_packages(...)`/`find:`).

              You can read more about "package discovery" on setuptools
      documentation page:

              -
      https://setuptools.pypa.io/en/latest/userguide/package_discovery.html

              If you don't want 'insightface.data.images' to be distributed
      and are
              already explicitly excluding 'insightface.data.images' via
              `find_namespace_packages(...)/find_namespace` or
      `find_packages(...)/find`,
              you can try to use `exclude_package_data`, or
      `include-package-data=False` in
              combination with a more fine grained `package-data`
      configuration.

              You can read more about "package data files" on setuptools
      documentation page:

              - https://setuptools.pypa.io/en/latest/userguide/datafiles.html


              [^1]: For Python, any directory (with suitable naming) can be
      imported,
                    even if it does not contain any `.py` files.
                    On the other hand, currently there is no concept of
      package data
                    directory, all directories are treated like packages.
      
      ********************************************************************************

      !!
        check.warn(importable)
      /home/steffen/.var/app/org.kde.krita/cache/uv/builds-v0/.tmp2CoKHo/lib/python3.12/site-packages/setuptools/command/build_py.py:212:
      _Warning: Package 'insightface.data.objects' is absent from the
      `packages` configuration.
      !!

      
      ********************************************************************************
              ############################
              # Package would be ignored #
              ############################
              Python recognizes 'insightface.data.objects' as an importable
      package[^1],
              but it is absent from setuptools' `packages` configuration.

              This leads to an ambiguous overall configuration. If you want to
      distribute this
              package, please make sure that 'insightface.data.objects' is
      explicitly added
              to the `packages` configuration field.

              Alternatively, you can also rely on setuptools' discovery
      methods
              (for example by using
      `find_namespace_packages(...)`/`find_namespace:`
              instead of `find_packages(...)`/`find:`).

              You can read more about "package discovery" on setuptools
      documentation page:

              -
      https://setuptools.pypa.io/en/latest/userguide/package_discovery.html

              If you don't want 'insightface.data.objects' to be distributed
      and are
              already explicitly excluding 'insightface.data.objects' via
              `find_namespace_packages(...)/find_namespace` or
      `find_packages(...)/find`,
              you can try to use `exclude_package_data`, or
      `include-package-data=False` in
              combination with a more fine grained `package-data`
      configuration.

              You can read more about "package data files" on setuptools
      documentation page:

              - https://setuptools.pypa.io/en/latest/userguide/datafiles.html


              [^1]: For Python, any directory (with suitable naming) can be
      imported,
                    even if it does not contain any `.py` files.
                    On the other hand, currently there is no concept of
      package data
                    directory, all directories are treated like packages.
      
      ********************************************************************************

      !!
        check.warn(importable)
      /home/steffen/.var/app/org.kde.krita/cache/uv/builds-v0/.tmp2CoKHo/lib/python3.12/site-packages/setuptools/command/build_py.py:212:
      _Warning: Package 'insightface.thirdparty.face3d.mesh.cython' is absent
      from the `packages` configuration.
      !!

      
      ********************************************************************************
              ############################
              # Package would be ignored #
              ############################
              Python recognizes 'insightface.thirdparty.face3d.mesh.cython' as
      an importable package[^1],
              but it is absent from setuptools' `packages` configuration.

              This leads to an ambiguous overall configuration. If you want to
      distribute this
              package, please make sure that
      'insightface.thirdparty.face3d.mesh.cython' is explicitly added
              to the `packages` configuration field.

              Alternatively, you can also rely on setuptools' discovery
      methods
              (for example by using
      `find_namespace_packages(...)`/`find_namespace:`
              instead of `find_packages(...)`/`find:`).

              You can read more about "package discovery" on setuptools
      documentation page:

              -
      https://setuptools.pypa.io/en/latest/userguide/package_discovery.html

              If you don't want 'insightface.thirdparty.face3d.mesh.cython' to
      be distributed and are
              already explicitly excluding
      'insightface.thirdparty.face3d.mesh.cython' via
              `find_namespace_packages(...)/find_namespace` or
      `find_packages(...)/find`,
              you can try to use `exclude_package_data`, or
      `include-package-data=False` in
              combination with a more fine grained `package-data`
      configuration.

              You can read more about "package data files" on setuptools
      documentation page:

              - https://setuptools.pypa.io/en/latest/userguide/datafiles.html


              [^1]: For Python, any directory (with suitable naming) can be
      imported,
                    even if it does not contain any `.py` files.
                    On the other hand, currently there is no concept of
      package data
                    directory, all directories are treated like packages.
      
      ********************************************************************************

      !!
        check.warn(importable)
      error: command 'x86_64-unknown-linux-gnu-c++' failed: No such file or
      directory

      hint: This usually indicates a problem with the package or the build
      environment.

2025-09-05 15:42:03,195 INFO Found server installation v1.38.0 [cuda] at /media/steffen/Transcend/Projects/ai_diffusion/.server

SteffenDuenner avatar Sep 05 '25 13:09 SteffenDuenner

OK, in my case I found a solution:

I installed Krita via Flatpak and obviously the compiler / toolchain wasn't installed or the Flatpak didn't have access to it. What helped was downloading the Krita Appimage and installing the insightface stuff from there.

SteffenDuenner avatar Sep 08 '25 16:09 SteffenDuenner

OK, in my case I found a solution:

I installed Krita via Flatpak and obviously the compiler / toolchain wasn't installed or the Flatpak didn't have access to it. What helped was downloading the Krita Appimage and installing the insightface stuff from there.

Same problem i'll try this solution too..

Didt worked for me. I installed Krita AppImage

alperktt avatar Oct 18 '25 20:10 alperktt