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' #565

Open
3 tasks done
danmay777 opened this issue Nov 22, 2024 · 2 comments
Labels
bug Something isn't working ⛔ dependencies conflict 👯‍♀️ duplicate This issue or pull request already exists

Comments

@danmay777
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?

Started getting these errors in google colab and cant find an answer on how to fix it. Reactor doesnt load :(

Steps to reproduce the problem

  1. Go to google colab
  2. Press Latest_webui and null_model
  3. Error shown on log

Sysinfo

Windows 10, Chrome, 4070

Relevant console log

Python 3.10.12 (main, Nov  6 2024, 20:22:13) [GCC 11.4.0]
Version: v1.10.1
Commit hash: 82a973c04367123ae98bd9abdf80d9eda9b910e2
Cloning assets into /content/sdw/repositories/stable-diffusion-webui-assets...
Cloning into '/content/sdw/repositories/stable-diffusion-webui-assets'...
remote: Enumerating objects: 20, done.
remote: Counting objects: 100% (20/20), done.
remote: Compressing objects: 100% (18/18), done.
remote: Total 20 (delta 0), reused 20 (delta 0), pack-reused 0 (from 0)
Receiving objects: 100% (20/20), 132.70 KiB | 44.23 MiB/s, done.
Installing requirements
Installing sd-webui-controlnet requirement: changing opencv-python version from 4.10.0.84 to 4.8.0
ReActor preheating... Device: CUDA
Launching Web UI with arguments: --enable-insecure-extension-access --opt-sdp-attention --share --no-half-vae --disable-safe-unpickle --no-hashing --gradio-queue --ckpt /content/sdw/models/Stable-diffusion//nullModelzeros.ckpt
2024-11-22 16:18:50.662564: E external/local_xla/xla/stream_executor/cuda/cuda_fft.cc:485] Unable to register cuFFT factory: Attempting to register factory for plugin cuFFT when one has already been registered
2024-11-22 16:18:50.889274: E external/local_xla/xla/stream_executor/cuda/cuda_dnn.cc:8454] Unable to register cuDNN factory: Attempting to register factory for plugin cuDNN when one has already been registered
2024-11-22 16:18:50.958072: E external/local_xla/xla/stream_executor/cuda/cuda_blas.cc:1452] Unable to register cuBLAS factory: Attempting to register factory for plugin cuBLAS when one has already been registered
2024-11-22 16:18:53.056404: W tensorflow/compiler/tf2tensorrt/utils/py_utils.cc:38] TF-TRT Warning: Could not find TensorRT
WARNING:xformers:WARNING[XFORMERS]: xFormers can't load C++/CUDA extensions. xFormers was built for:
    PyTorch 2.0.1+cu118 with CUDA 1108 (you have 2.5.1+cu121)
    Python  3.10.11 (you have 3.10.12)
  Please reinstall xformers (see https://github.com/facebookresearch/xformers#installing-xformers)
  Memory-efficient attention, SwiGLU, sparse and more won't be available.
  Set XFORMERS_MORE_DETAILS=1 for more details
No module 'xformers'. Proceeding without it.
converting cache: 100% 7/7 [00:00<00:00, 72.96it/s]
ControlNet preprocessor location: /content/sdw/extensions/ControlNet/annotator/downloads
2024-11-22 16:18:57,966 - ControlNet - INFO - ControlNet v1.1.426
2024-11-22 16:18:58,151 - ControlNet - INFO - ControlNet v1.1.426
Model Downloader v1.0.8
Checking Directories...
all Directories already Created.
*** Error loading script: console_log_patch.py
    Traceback (most recent call last):
      File "/content/sdw/modules/scripts.py", line 515, in load_scripts
        script_module = script_loading.load_module(scriptfile.path)
      File "/content/sdw/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/sdw/extensions/sd-webui-roop-nsfw/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 5, in <module>
        from .augmentations import *
      File "/usr/local/lib/python3.10/dist-packages/albumentations/augmentations/__init__.py", line 8, 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/sdw/modules/scripts.py", line 515, in load_scripts
        script_module = script_loading.load_module(scriptfile.path)
      File "/content/sdw/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/sdw/extensions/sd-webui-roop-nsfw/scripts/reactor_api.py", line 17, in <module>
        from scripts.reactor_swapper import EnhancementOptions, swap_face
      File "/content/sdw/extensions/sd-webui-roop-nsfw/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 5, in <module>
        from .augmentations import *
      File "/usr/local/lib/python3.10/dist-packages/albumentations/augmentations/__init__.py", line 8, 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/sdw/modules/scripts.py", line 515, in load_scripts
        script_module = script_loading.load_module(scriptfile.path)
      File "/content/sdw/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/sdw/extensions/sd-webui-roop-nsfw/scripts/reactor_faceswap.py", line 18, in <module>
        from reactor_ui import ui_main, ui_upscale, ui_tools, ui_settings
      File "/content/sdw/extensions/sd-webui-roop-nsfw/reactor_ui/__init__.py", line 2, in <module>
        import reactor_ui.reactor_tools_ui as ui_tools
      File "/content/sdw/extensions/sd-webui-roop-nsfw/reactor_ui/reactor_tools_ui.py", line 2, in <module>
        from scripts.reactor_swapper import build_face_model
      File "/content/sdw/extensions/sd-webui-roop-nsfw/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 5, in <module>
        from .augmentations import *
      File "/usr/local/lib/python3.10/dist-packages/albumentations/augmentations/__init__.py", line 8, 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/sdw/modules/scripts.py", line 515, in load_scripts
        script_module = script_loading.load_module(scriptfile.path)
      File "/content/sdw/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/sdw/extensions/sd-webui-roop-nsfw/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 5, in <module>
        from .augmentations import *
      File "/usr/local/lib/python3.10/dist-packages/albumentations/augmentations/__init__.py", line 8, 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)

---
16:18:58 - ReActor - STATUS - Running v0.6.0-a4
Tag Autocomplete: Could not locate model-keyword extension, Lora trigger word completion will be limited to those added through the extra networks menu.
Loading weights [None] from /content/sdw/models/Stable-diffusion/nullModelzeros.ckpt
Creating model from config: /content/sdw/configs/v1-inference.yaml
/content/sdw/extensions/sd-model-downloader/scripts/model-downloader.py:310: GradioDeprecationWarning: The `style` method is deprecated. Please set these arguments in the constructor instead.
  image.style(width=156, height=234)

Additional information

No response

@danmay777 danmay777 added bug Something isn't working new labels Nov 22, 2024
@Gourieff
Copy link
Owner

Try to downgrade albumentations to 1.4.20

@Gourieff
Copy link
Owner

Or you can try this #560 (comment)

@Gourieff Gourieff changed the title REactor Does Not Work When Using Script In Google Colab Google Colab | ImportError: cannot import name 'PCA' from 'albumentations.augmentations.utils' Nov 30, 2024
@Gourieff Gourieff added the 👯‍♀️ duplicate This issue or pull request already exists label Nov 30, 2024
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 👯‍♀️ duplicate This issue or pull request already exists
Projects
None yet
Development

No branches or pull requests

2 participants