Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Google Colab | ImportError: cannot import name 'PCA' from 'albumentations.augmentations.utils' #560

Open
3 tasks done
cidjesus34 opened this issue Nov 1, 2024 · 5 comments
Labels
bug Something isn't working ⛔ dependencies conflict

Comments

@cidjesus34
Copy link

First, confirm

  • I have read the instruction carefully
  • I have searched the existing issues
  • I have updated the extension to the latest version

What happened?

After installing Reactor via URL on automatic 111 google colab it won't start

Steps to reproduce the problem

  1. Go to github
  2. Install wereactor by gourieff
  3. Error shown on log

Sysinfo

I am running it on python 3 t4 gpu

Relevant console log

Warning: caught exception 'Found no NVIDIA driver on your system. Please check that you have an NVIDIA GPU and installed a driver from http://www.nvidia.com/Download/index.aspx', memory monitor disabled
ControlNet preprocessor location: /content/gdrive/MyDrive/sd/stable-diffusion-webui/extensions/sd-webui-controlnet/annotator/downloads
2024-11-01 19:25:33,010 - ControlNet - INFO - ControlNet v1.1.455
*** Error loading script: console_log_patch.py
    Traceback (most recent call last):
      File "/content/gdrive/MyDrive/sd/stable-diffusion-webui/modules/scripts.py", line 515, in load_scripts
        script_module = script_loading.load_module(scriptfile.path)
      File "/content/gdrive/MyDrive/sd/stable-diffusion-webui/modules/script_loading.py", line 13, 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 "/content/gdrive/MyDrive/sd/stable-diffusion-webui/extensions/sd-webui-reactor/scripts/console_log_patch.py", line 4, in <module>
        import insightface
      File "/usr/local/lib/python3.10/dist-packages/insightface/__init__.py", line 18, in <module>
        from . import app
      File "/usr/local/lib/python3.10/dist-packages/insightface/app/__init__.py", line 2, in <module>
        from .mask_renderer import *
      File "/usr/local/lib/python3.10/dist-packages/insightface/app/mask_renderer.py", line 4, in <module>
        import albumentations as A
      File "/usr/local/lib/python3.10/dist-packages/albumentations/__init__.py", line 3, in <module>
        from .augmentations import *
      File "/usr/local/lib/python3.10/dist-packages/albumentations/augmentations/__init__.py", line 5, in <module>
        from .domain_adaptation import *
      File "/usr/local/lib/python3.10/dist-packages/albumentations/augmentations/domain_adaptation/__init__.py", line 1, in <module>
        from .functional import *
      File "/usr/local/lib/python3.10/dist-packages/albumentations/augmentations/domain_adaptation/functional.py", line 13, in <module>
        from albumentations.augmentations.utils import PCA
    ImportError: cannot import name 'PCA' from 'albumentations.augmentations.utils' (/usr/local/lib/python3.10/dist-packages/albumentations/augmentations/utils.py)

---
*** Error loading script: reactor_api.py
    Traceback (most recent call last):
      File "/content/gdrive/MyDrive/sd/stable-diffusion-webui/modules/scripts.py", line 515, in load_scripts
        script_module = script_loading.load_module(scriptfile.path)
      File "/content/gdrive/MyDrive/sd/stable-diffusion-webui/modules/script_loading.py", line 13, 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 "/content/gdrive/MyDrive/sd/stable-diffusion-webui/extensions/sd-webui-reactor/scripts/reactor_api.py", line 28, in <module>
        from scripts.reactor_swapper import EnhancementOptions, blend_faces, swap_face, DetectionOptions
      File "/content/gdrive/MyDrive/sd/stable-diffusion-webui/extensions/sd-webui-reactor/scripts/reactor_swapper.py", line 10, in <module>
        import insightface
      File "/usr/local/lib/python3.10/dist-packages/insightface/__init__.py", line 18, in <module>
        from . import app
      File "/usr/local/lib/python3.10/dist-packages/insightface/app/__init__.py", line 2, in <module>
        from .mask_renderer import *
      File "/usr/local/lib/python3.10/dist-packages/insightface/app/mask_renderer.py", line 4, in <module>
        import albumentations as A
      File "/usr/local/lib/python3.10/dist-packages/albumentations/__init__.py", line 3, in <module>
        from .augmentations import *
      File "/usr/local/lib/python3.10/dist-packages/albumentations/augmentations/__init__.py", line 5, in <module>
        from .domain_adaptation import *
      File "/usr/local/lib/python3.10/dist-packages/albumentations/augmentations/domain_adaptation/__init__.py", line 1, in <module>
        from .functional import *
      File "/usr/local/lib/python3.10/dist-packages/albumentations/augmentations/domain_adaptation/functional.py", line 13, in <module>
        from albumentations.augmentations.utils import PCA
    ImportError: cannot import name 'PCA' from 'albumentations.augmentations.utils' (/usr/local/lib/python3.10/dist-packages/albumentations/augmentations/utils.py)

---
*** Error loading script: reactor_faceswap.py
    Traceback (most recent call last):
      File "/content/gdrive/MyDrive/sd/stable-diffusion-webui/modules/scripts.py", line 515, in load_scripts
        script_module = script_loading.load_module(scriptfile.path)
      File "/content/gdrive/MyDrive/sd/stable-diffusion-webui/modules/script_loading.py", line 13, 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 "/content/gdrive/MyDrive/sd/stable-diffusion-webui/extensions/sd-webui-reactor/scripts/reactor_faceswap.py", line 26, in <module>
        from scripts.reactor_swapper import EnhancementOptions, swap_face, check_process_halt, reset_messaged
      File "/content/gdrive/MyDrive/sd/stable-diffusion-webui/extensions/sd-webui-reactor/scripts/reactor_swapper.py", line 10, in <module>
        import insightface
      File "/usr/local/lib/python3.10/dist-packages/insightface/__init__.py", line 18, in <module>
        from . import app
      File "/usr/local/lib/python3.10/dist-packages/insightface/app/__init__.py", line 2, in <module>
        from .mask_renderer import *
      File "/usr/local/lib/python3.10/dist-packages/insightface/app/mask_renderer.py", line 4, in <module>
        import albumentations as A
      File "/usr/local/lib/python3.10/dist-packages/albumentations/__init__.py", line 3, in <module>
        from .augmentations import *
      File "/usr/local/lib/python3.10/dist-packages/albumentations/augmentations/__init__.py", line 5, in <module>
        from .domain_adaptation import *
      File "/usr/local/lib/python3.10/dist-packages/albumentations/augmentations/domain_adaptation/__init__.py", line 1, in <module>
        from .functional import *
      File "/usr/local/lib/python3.10/dist-packages/albumentations/augmentations/domain_adaptation/functional.py", line 13, in <module>
        from albumentations.augmentations.utils import PCA
    ImportError: cannot import name 'PCA' from 'albumentations.augmentations.utils' (/usr/local/lib/python3.10/dist-packages/albumentations/augmentations/utils.py)

---
*** Error loading script: reactor_swapper.py
    Traceback (most recent call last):
      File "/content/gdrive/MyDrive/sd/stable-diffusion-webui/modules/scripts.py", line 515, in load_scripts
        script_module = script_loading.load_module(scriptfile.path)
      File "/content/gdrive/MyDrive/sd/stable-diffusion-webui/modules/script_loading.py", line 13, 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 "/content/gdrive/MyDrive/sd/stable-diffusion-webui/extensions/sd-webui-reactor/scripts/reactor_swapper.py", line 10, in <module>
        import insightface
      File "/usr/local/lib/python3.10/dist-packages/insightface/__init__.py", line 18, in <module>
        from . import app
      File "/usr/local/lib/python3.10/dist-packages/insightface/app/__init__.py", line 2, in <module>
        from .mask_renderer import *
      File "/usr/local/lib/python3.10/dist-packages/insightface/app/mask_renderer.py", line 4, in <module>
        import albumentations as A
      File "/usr/local/lib/python3.10/dist-packages/albumentations/__init__.py", line 3, in <module>
        from .augmentations import *
      File "/usr/local/lib/python3.10/dist-packages/albumentations/augmentations/__init__.py", line 5, in <module>
        from .domain_adaptation import *
      File "/usr/local/lib/python3.10/dist-packages/albumentations/augmentations/domain_adaptation/__init__.py", line 1, in <module>
        from .functional import *
      File "/usr/local/lib/python3.10/dist-packages/albumentations/augmentations/domain_adaptation/functional.py", line 13, in <module>
        from albumentations.augmentations.utils import PCA
    ImportError: cannot import name 'PCA' from 'albumentations.augmentations.utils' (/usr/local/lib/python3.10/dist-packages/albumentations/augmentations/utils.py)

---
19:25:33 - ReActor - INFO - Running v0.4.2
Loading weights [33e58e8668] from /content/drive/MyDrive/Modelos IA/juggernautXL_juggXIByRundiffusion.safetensors
2024-11-01 19:25:34,825 - ControlNet - INFO - ControlNet UI callback registered.
Running on public URL: https://76935d221fe1b1155d.gradio.live
✔ Connected
Startup time: 37.6s (import torch: 23.5s, import gradio: 2.1s, setup paths: 2.4s, other imports: 1.4s, list SD models: 0.4s, load scripts: 3.7s, create ui: 1.9s, gradio launch: 1.2s, add APIs: 0.9s).
Creating model from config: /content/gdrive/MyDrive/sd/stablediffusion/generative-models/configs/inference/sd_xl_base.yaml
Applying attention optimization: InvokeAI... done.
loading stable diffusion model: RuntimeError
Traceback (most recent call last):
  File "/usr/lib/python3.10/threading.py", line 973, in _bootstrap
    self._bootstrap_inner()
  File "/usr/lib/python3.10/threading.py", line 1016, in _bootstrap_inner
    self.run()
  File "/usr/lib/python3.10/threading.py", line 953, in run
    self._target(*self._args, **self._kwargs)
  File "/content/gdrive/MyDrive/sd/stable-diffusion-webui/modules/initialize.py", line 149, in load_model
    shared.sd_model  # noqa: B018
  File "/content/gdrive/MyDrive/sd/stable-diffusion-webui/modules/shared_items.py", line 175, in sd_model
    return modules.sd_models.model_data.get_sd_model()
  File "/content/gdrive/MyDrive/sd/stable-diffusion-webui/modules/sd_models.py", line 693, in get_sd_model
    load_model()
  File "/content/gdrive/MyDrive/sd/stable-diffusion-webui/modules/sd_models.py", line 868, in load_model
    with devices.autocast(), torch.no_grad():
  File "/content/gdrive/MyDrive/sd/stable-diffusion-webui/modules/devices.py", line 228, in autocast
    if has_xpu() or has_mps() or cuda_no_autocast():
  File "/content/gdrive/MyDrive/sd/stable-diffusion-webui/modules/devices.py", line 28, in cuda_no_autocast
    device_id = get_cuda_device_id()
  File "/content/gdrive/MyDrive/sd/stable-diffusion-webui/modules/devices.py", line 40, in get_cuda_device_id
    ) or torch.cuda.current_device()
  File "/usr/local/lib/python3.10/dist-packages/torch/cuda/__init__.py", line 940, in current_device
    _lazy_init()
  File "/usr/local/lib/python3.10/dist-packages/torch/cuda/__init__.py", line 319, in _lazy_init
    torch._C._cuda_init()
RuntimeError: Found no NVIDIA driver on your system. Please check that you have an NVIDIA GPU and installed a driver from http://www.nvidia.com/Download/index.aspx


Stable diffusion model failed to load

Additional information

I have tried erasing the insightface folders and replacing the scripts but it still wont work

@cidjesus34 cidjesus34 added bug Something isn't working new labels Nov 1, 2024
@ajyachuarasiya
Copy link

Facing the same issue from 3-4 days can someone please help

@AxelGod
Copy link

AxelGod commented Nov 5, 2024

same issue here, maybe the mov2mov?

@Bobstein13
Copy link

Anyone figure this out? I've tried reinstalling albumentations, python, insightface and can't get anything to work...

@iamrenny
Copy link

iamrenny commented Nov 29, 2024

Anyone figure this out? I've tried reinstalling albumentations, python, insightface and can't get anything to work...

Hey! The issue comes when installing reactor with the sd-webui-roop dependencies installed. I solved it by uninstalling sd-webui-roop, deleting the the extension folder, uninstalling its python dependencies and installing the ones for reactor. Try this:

!pip uninstall -y insightface==0.7.3 onnx==1.14.0 onnxruntime==1.15.0 opencv-python==4.7.0.72 ifnude cython
!pip install albumentations==1.4.3 insightface==0.7.3 onnx==1.16.1 opencv-python>=4.7.0.72

Don't forget to remove the sd-webui-roop plugin or deleting the folder from extensions.

Hope it helps!

@Gourieff Gourieff changed the title Reactor does not load after installing on automatic 111 google colab Google Colab | ImportError: cannot import name 'PCA' from 'albumentations.augmentations.utils' Nov 30, 2024
@Gourieff
Copy link
Owner

Or guys you also can try this #565 (comment)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working ⛔ dependencies conflict
Projects
None yet
Development

No branches or pull requests

6 participants