Closed tsound97 closed 1 year ago
python: 3.10.6 • torch: 1.13.1+cu117 • xformers: 0.0.16rc425 • gradio: 3.16.2 • commit: [602a1864]
Launching Web UI with arguments: --listen --api --xformers --enable-insecure-extension-access --disable-safe-unpickle --styles-file styles-full.csv --port 7799 --gradio-auth *********:*********
Error loading script: ddetailer.py
Traceback (most recent call last):
File "E:\AI\A1111\modules\scripts.py", line 218, in load_scripts
script_module = script_loading.load_module(scriptfile.path)
File "E:\AI\A1111\modules\script_loading.py", line 13, in load_module
exec(compiled, module.__dict__)
File "E:\AI\A1111\extensions\ddetailer\scripts\ddetailer.py", line 458, in <module>
from mmdet.core import get_classes
File "E:\AI\A1111\venv\lib\site-packages\mmdet\core\__init__.py", line 3, in <module>
from .bbox import * # noqa: F401, F403
File "E:\AI\A1111\venv\lib\site-packages\mmdet\core\bbox\__init__.py", line 8, in <module>
from .samplers import (BaseSampler, CombinedSampler,
File "E:\AI\A1111\venv\lib\site-packages\mmdet\core\bbox\samplers\__init__.py", line 12, in <module>
from .score_hlr_sampler import ScoreHLRSampler
File "E:\AI\A1111\venv\lib\site-packages\mmdet\core\bbox\samplers\score_hlr_sampler.py", line 3, in <module>
from mmcv.ops import nms_match
File "E:\AI\A1111\venv\lib\site-packages\mmcv\ops\__init__.py", line 3, in <module>
from .active_rotated_filter import active_rotated_filter
File "E:\AI\A1111\venv\lib\site-packages\mmcv\ops\active_rotated_filter.py", line 10, in <module>
ext_module = ext_loader.load_ext(
File "E:\AI\A1111\venv\lib\site-packages\mmcv\utils\ext_loader.py", line 13, in load_ext
ext = importlib.import_module('mmcv.' + name)
File "C:\Users\Brady\AppData\Local\Programs\Python\Python310\lib\importlib\__init__.py", line 126, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
ImportError: DLL load failed while importing _ext: The specified procedure could not be found.
Same here after following the instructions I got from webui about adding two flags to "webui-user.bat" to make it reinstall the correct version of torch and xformers on the following run.
ddetailer apart, everything else seem to work fine and I haven't seen any other error messages so far.
This appears to be an issue where the extension does not request upgrades to required libraries. The libraries need to be updated for the extension to work, and these libraries are installed in a separate location from the extension itself, which is why removing the extension's folder doesn't fix it.
As a "lazy coder" solution, I found temporarily modifying the below code helped; Removing the if not
line and inserting a --upgrade
immediately after install
forced it to upgrade libraries on initialization and allowed it to run. (Thanks to a friend for doing some digging and leading me to what needed to be done.)
This appears to be an issue where the extension does not request upgrades to required libraries. The libraries need to be updated for the extension to work, and these libraries are installed in a separate location from the extension itself, which is why removing the extension's folder doesn't fix it.
As a "lazy coder" solution, I found temporarily modifying the below code helped; Removing the
if not
line and inserting a--upgrade
immediately afterinstall
forced it to upgrade libraries on initialization and allowed it to run. (Thanks to a friend for doing some digging and leading me to what needed to be done.)
It works! Great thx!
It works! Great thx!
Could you show where exactly to insert the --upgrade? Or explain it in more detail?
I've tried a few different things and get an unexpected indent error when loading the webui.
Like this:
run(f'"{python}" -m pip install --upgrade -U openmim', desc="Installing openmim", errdesc="Couldn't install openmim")
run(f'"{python}" -m mim install --upgrade mmcv-full', desc=f"Installing mmcv-full", errdesc=f"Couldn't install mmcv-full")
run(f'"{python}" -m pip install --upgrade mmdet', desc=f"Installing mmdet", errdesc=f"Couldn't install mmdet")
You would also place a #
before the if not
. Make sure to undo all the changes after you next run the code, so it doesn't take longer to start-up doing new upgrade checks.
Thanks very much
can someone upload a fixed script on pastebin? I keep running into errors.
You can run the commands externally from the terminal, you don't need to modify the script. Activate your webui's python virtual env and run:
pip install --upgrade -U openmim
mim install --upgrade mmcv-full
pip install --upgrade mmdet
and it'll run properly again. Make sure you don't mistake the second step for pip install
, has to be mim install
.
While trying to find another quick and dirty way to install additional packaged in webui venv, I copied those command after the venv activation commands in webui.bat
:activate_venv
set PYTHON="%VENV_DIR%\Scripts\Python.exe"
echo venv %PYTHON%
pip install --upgrade -U openmim
mim install --upgrade mmcv-full
pip install --upgrade mmdet
but it failed miserably saying pip & mim commands are not found... do you know why is this not working?
Anyway, after adding the pip and mim commands to the code as recommended by @MegaScience in his comment above, I'm still getting this...
Error loading script: ddetailer.py
Traceback (most recent call last):
File "C:\Users\username\desktop\stable-diffusion-webui\modules\scripts.py", line 229, in load_scripts
script_module = script_loading.load_module(scriptfile.path)
File "C:\Users\username\desktop\stable-diffusion-webui\modules\script_loading.py", line 11, 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 "C:\Users\username\desktop\stable-diffusion-webui\extensions\ddetailer\scripts\ddetailer.py", line 465, in <module>
from mmdet.core import get_classes
File "C:\Users\username\desktop\stable-diffusion-webui\venv\lib\site-packages\mmdet\core\__init__.py", line 3, in <module>
from .bbox import * # noqa: F401, F403
File "C:\Users\username\desktop\stable-diffusion-webui\venv\lib\site-packages\mmdet\core\bbox\__init__.py", line 8, in <module>
from .samplers import (BaseSampler, CombinedSampler,
File "C:\Users\username\desktop\stable-diffusion-webui\venv\lib\site-packages\mmdet\core\bbox\samplers\__init__.py", line 12, in <module>
from .score_hlr_sampler import ScoreHLRSampler
File "C:\Users\username\desktop\stable-diffusion-webui\venv\lib\site-packages\mmdet\core\bbox\samplers\score_hlr_sampler.py", line 3, in <module>
from mmcv.ops import nms_match
File "C:\Users\username\desktop\stable-diffusion-webui\venv\lib\site-packages\mmcv\ops\__init__.py", line 2, in <module>
from .active_rotated_filter import active_rotated_filter
File "C:\Users\username\desktop\stable-diffusion-webui\venv\lib\site-packages\mmcv\ops\active_rotated_filter.py", line 10, in <module>
ext_module = ext_loader.load_ext(
File "C:\Users\username\desktop\stable-diffusion-webui\venv\lib\site-packages\mmcv\utils\ext_loader.py", line 13, in load_ext
ext = importlib.import_module('mmcv.' + name)
File "C:\dev\Python-3.10.5-x64\lib\importlib\__init__.py", line 126, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
ImportError: DLL load failed while importing _ext: The specified procedure could not be found
While trying to find another quick and dirty way to install additional packaged in webui venv, I copied those command after the venv activation commands in webui.bat
:activate_venv set PYTHON="%VENV_DIR%\Scripts\Python.exe" echo venv %PYTHON% pip install --upgrade -U openmim mim install --upgrade mmcv-full pip install --upgrade mmdet
but it failed miserably saying pip & mim commands are not found... do you know why is this not working?
You didn't activate the virtual env, you just set the python executable. You are therefore calling pip globally there.
I don't know for sure how to activate it in windows but there should be some sort of "activate.bat" or "activate.ps1" in the call .\venv\Scripts\activate.bat
before the commands.
Ok, I apologize for being a little distracted and noisy... but I've just realized that I didn't need to change these lines
if not is_installed("mmdet"):
python = sys.executable
run(f'"{python}" -m pip install -U openmim', desc="Installing openmim", errdesc="Couldn't install openmim")
run(f'"{python}" -m mim install mmcv-full', desc=f"Installing mmcv-full", errdesc=f"Couldn't install mmcv-full")
run(f'"{python}" -m pip install mmdet', desc=f"Installing mmdet", errdesc=f"Couldn't install mmdet")
as they are already implemented in my scripts/ddetailer.py
Nonetheless the above error ("DLL load failed while importing _ext: The specified procedure could not be found") is still getting issued.
I also tried disabling the extension > then closing webui > then deleting the extension dir > then relaunching webui > then reinstalling the extension > then closing and relaunching webui... but it fails again exactly with the same error...
When doing it my way, make sure to also temporarily comment out the below line with a #
before it (#if not is_installed("mmdet"):
). Otherwise it won't run because it is installed, it is just outdated.
@MegaScience ah yeah, you are right. I was in a hurry so I didn't read all the comments accurately, but now it's all clear. I will try it in a few mins, and I have a feeling it will work ;)
Hmm, no this is a bit more complicated apparently... Let me recap what I did. I commented out the "if not" (line 46) so that on next run all the pip and mim command were executed... but again this lead to the same DLL error problem. So following @tsound97 comment above I tried forcing the packages to be upgraded by adding -U on the three lines, immediately after each "install". I restarted and when it arrived to the three libraries it apparently took a bit more than usual to go ahead, so I could tell something different at least was happening... But then I got this:
Restarting UI...
Installing openmim
Installing mmcv-full
Installing mmdet
Error loading script: ddetailer.py
Traceback (most recent call last):
File "C:\Users\username\desktop\stable-diffusion-webui\modules\scripts.py", line 229, in load_scripts
script_module = script_loading.load_module(scriptfile.path)
File "C:\Users\username\desktop\stable-diffusion-webui\modules\script_loading.py", line 11, 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 "C:\Users\username\desktop\stable-diffusion-webui\extensions\ddetailer\scripts\ddetailer.py", line 459, in <module>
from mmdet.apis import (inference_detector,
File "C:\Users\username\desktop\stable-diffusion-webui\venv\lib\site-packages\mmdet\apis\__init__.py", line 2, in <module>
from .inference import (async_inference_detector, inference_detector,
File "C:\Users\username\desktop\stable-diffusion-webui\venv\lib\site-packages\mmdet\apis\inference.py", line 13, in <module>
from mmdet.datasets import replace_ImageToTensor
File "C:\Users\username\desktop\stable-diffusion-webui\venv\lib\site-packages\mmdet\datasets\__init__.py", line 15, in <module>
from .utils import (NumClassCheckHook, get_loading_pipeline,
File "C:\Users\username\desktop\stable-diffusion-webui\venv\lib\site-packages\mmdet\datasets\utils.py", line 11, in <module>
from mmdet.models.dense_heads import GARPNHead, RPNHead
File "C:\Users\username\desktop\stable-diffusion-webui\venv\lib\site-packages\mmdet\models\__init__.py", line 7, in <module>
from .dense_heads import * # noqa: F401,F403
File "C:\Users\username\desktop\stable-diffusion-webui\venv\lib\site-packages\mmdet\models\dense_heads\__init__.py", line 4, in <module>
from .ascend_anchor_head import AscendAnchorHead
File "C:\Users\username\desktop\stable-diffusion-webui\venv\lib\site-packages\mmdet\models\dense_heads\ascend_anchor_head.py", line 4, in <module>
from ...core.bbox.assigners import AscendMaxIoUAssigner
ImportError: cannot import name 'AscendMaxIoUAssigner' from 'mmdet.core.bbox.assigners' (C:\Users\username\desktop\stable-diffusion-webui\venv\lib\site-packages\mmdet\core\bbox\assigners\__init__.py)
SD-Webui API layer loaded
Installing pywin32
add tab
Running on local URL: http://127.0.0.1:7860
To create a public link, set `share=True` in `launch()`.
So has any of you encountered this error before? I looked at the other issues threads but couldn't find anything related to this... I will now try to find out more about the AscendMaxIoUAssigner error... If you know something just shoot away ;)
Ok, got it working... The error above was caused by me simply not re-enabling the "if not" line on the successive runs... 😬🐼🤪
I find altering code to be unappealing.
To anyone else who has the issue: delete these folders in \venv\Lib\site-packages
This will cause them to reinstall with correct versions.
您可以从终端外部运行命令,无需修改脚本。 激活你的 webui 的 python 虚拟环境并运行:
pip install --upgrade -U openmim mim install --upgrade mmcv-full pip install --upgrade mmdet
它会再次正常运行。确保您没有将第二步误认为是
pip install
,必须是mim install
。
is worked on me.3q
After AUTO1111 update the torch and xformers version. This script doesn't work anymore