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

Failure to import _fblas due to SciPy version

Open Jellybit opened this issue 3 years ago • 6 comments

Describe the bug A fresh install of WebUI cannot run, as it fails to import _fblas. Overwriting a previous install works. Strangely, the DLL it tries to load is only in the newer fresh install, and doesn't exist when the older install is overwritten.

To Reproduce Steps to reproduce the behavior:

  1. Get current 10/13 version of WebUI, at commit a10b0e1 (UPDATE: version doesn't matter).
  2. Install over older version of WebUI that was installed over a week ago.
  3. Run the updated older version.
  4. Install in new empty folder.
  5. Run new version.

The new version errors out with the following:

venv "D:\Projects\AI\StableDiffusionNovelAI\venv\Scripts\Python.exe"
Python 3.8.13 (default, Mar 28 2022, 06:59:08) [MSC v.1916 64 bit (AMD64)]
Commit hash: <none>
Installing requirements for Web UI
Launching Web UI with arguments:
Traceback (most recent call last):
  File "launch.py", line 169, in <module>
    start_webui()
  File "launch.py", line 163, in start_webui
    import webui
  File "D:\Projects\AI\StableDiffusionNovelAI\webui.py", line 12, in <module>
    from modules import devices, sd_samplers
  File "D:\Projects\AI\StableDiffusionNovelAI\modules\sd_samplers.py", line 7, in <module>
    import k_diffusion.sampling
  File "D:\Projects\AI\StableDiffusionNovelAI\repositories\k-diffusion\k_diffusion\__init__.py", line 1, in <module>
    from . import augmentation, config, evaluation, external, gns, layers, models, sampling, utils
  File "D:\Projects\AI\StableDiffusionNovelAI\repositories\k-diffusion\k_diffusion\augmentation.py", line 6, in <module>
    from skimage import transform
  File "D:\Projects\AI\StableDiffusionNovelAI\venv\lib\site-packages\skimage\__init__.py", line 157, in <module>
    from .util.dtype import (img_as_float32,
  File "D:\Projects\AI\StableDiffusionNovelAI\venv\lib\site-packages\skimage\util\__init__.py", line 16, in <module>
    from ._montage import montage
  File "D:\Projects\AI\StableDiffusionNovelAI\venv\lib\site-packages\skimage\util\_montage.py", line 4, in <module>
    from .. import exposure
  File "D:\Projects\AI\StableDiffusionNovelAI\venv\lib\site-packages\skimage\_shared\lazy.py", line 62, in __getattr__
    return importlib.import_module(f'{package_name}.{name}')
  File "C:\Users\user\anaconda3\pkgs\python-3.8.13-h6244533_0\lib\importlib\__init__.py", line 127, in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
  File "D:\Projects\AI\StableDiffusionNovelAI\venv\lib\site-packages\skimage\exposure\__init__.py", line 6, in <module>
    from ._adapthist import equalize_adapthist
  File "D:\Projects\AI\StableDiffusionNovelAI\venv\lib\site-packages\skimage\exposure\_adapthist.py", line 21, in <module>
    from ..color.adapt_rgb import adapt_rgb, hsv_value
  File "D:\Projects\AI\StableDiffusionNovelAI\venv\lib\site-packages\skimage\color\__init__.py", line 1, in <module>
    from .colorconv import (convert_colorspace,
  File "D:\Projects\AI\StableDiffusionNovelAI\venv\lib\site-packages\skimage\color\colorconv.py", line 55, in <module>
    from scipy import linalg
  File "D:\Projects\AI\StableDiffusionNovelAI\venv\lib\site-packages\scipy\__init__.py", line 233, in __getattr__
    return _importlib.import_module(f'scipy.{name}')
  File "C:\Users\user\anaconda3\pkgs\python-3.8.13-h6244533_0\lib\importlib\__init__.py", line 127, in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
  File "D:\Projects\AI\StableDiffusionNovelAI\venv\lib\site-packages\scipy\linalg\__init__.py", line 197, in <module>
    from ._misc import *
  File "D:\Projects\AI\StableDiffusionNovelAI\venv\lib\site-packages\scipy\linalg\_misc.py", line 3, in <module>
    from .blas import get_blas_funcs
  File "D:\Projects\AI\StableDiffusionNovelAI\venv\lib\site-packages\scipy\linalg\blas.py", line 213, in <module>
    from scipy.linalg import _fblas
ImportError: DLL load failed while importing _fblas: The specified module could not be found.
Press any key to continue . . .

The old install however, works fine, even though it's updated to the same version. This is a DLL load failure, so I searched for this file in both the old and new versions. The file is named "_fblas.cp38-win_amd64.dll.a", and it exists in the fresh install, which fails. However, it's missing from the older install, which runs fine.

Expected behavior It should run on the new install.

Desktop (please complete the following information):

  • OS: Windows 10
  • Browser: Chrome
  • Commit revision a10b0e11fc22cc67b6a3664f2ddd17425d8433a8

Additional context The initial install seemed to go very slowly during the taming-transformers cloning phase. This might be normal, but I haven't installed fresh in a while, so it's hard for me to judge. I tried installing this around 5 times today. This isn't my first rodeo either, as I've installed WebUI at least 30 times before, including other fresh installs in different folders.

Jellybit avatar Oct 14 '22 02:10 Jellybit

Okay, I overwrote the fresh install's ".\venv\Lib\site-packages\scipy" folder with the previous install's folder of the same name, and now it runs. I tried overwriting fewer things at first, but that's where it got to. I do want to run with a fresh install though, for something. I tried uninstalling and reinstalling Anaconda, but that didn't do the trick.

Jellybit avatar Oct 14 '22 03:10 Jellybit

I did more digging. This has nothing to do with the version of WebUI. I tried a version of WebUI from a month ago, and got the same result. However, I have narrowed it down to SciPy. It looks like SciPy 1.9.2 was released a week ago, and that makes sense because I didn't update for a little over week, and the old working version does in fact use 1.9.1.

Would 1.9.1 cause a problem? I suspect it won't, but that's the only way to get it to run for me. If it doesn't cause an issue, I'd suggest forcing a 1.9.1 install. However, it seems that you let Scikit install SciPy, and I don't know how you'd have control over that.

Jellybit avatar Oct 16 '22 16:10 Jellybit

Alright. I was able to get a working fresh install by replacing your requirements files in the project root with the ones attached. I added "scipy==1.9.1" to both. I don't know if it was required in both, or just one, but it fixed the issue, and I'm able to install fresh and run. But I would like a confirmation that scipy 1.9.2 isn't required for some reason.

Here they are in case anyone needs them: requirements_versions.txt requirements.txt

Jellybit avatar Oct 16 '22 17:10 Jellybit

Okay, last update. Anaconda comes with python 3.9. Apparently scipy and xformers both require Python 3.10.6. I had to create a virtual environment and install 3.10.6 there. Then I had to reinstall WebUI from scratch using that virtual environment. Finally, I modified the user batch file to load that virtual environment when loading WebUI. Everything installs perfectly, and runs great. No need for those requirements.txt files above.

Also, it appears that this check-in might solve the issue, though this check should probably happen before the scipy install in addition to xformers:

b748b58

Please close issue.

Jellybit avatar Oct 17 '22 19:10 Jellybit

FWIW I'm having this exact same issue and I haven't the slightest idea of how to follow what you said to do. What I do know is that I just had to restart AUTOMATIC1111 and it won't start. I tried doing a git clone into another directory and doing a fresh install over there as well. Out of the box I'm getting this error.

The check-in you mentioned seems to be in the code I have and the issue persists.

hiro24 avatar Nov 01 '22 21:11 hiro24

same issue but solved, just active the venv and run pip uninstall scipy, then restart the webui, it will reinstall it and the issue fixed.

WuSiYu avatar Nov 07 '22 11:11 WuSiYu

Alright. I was able to get a working fresh install by replacing your requirements files in the project root with the ones attached. I added "scipy==1.9.1" to both. I don't know if it was required in both, or just one, but it fixed the issue, and I'm able to install fresh and run. But I would like a confirmation that scipy 1.9.2 isn't required for some reason.

Here they are in case anyone needs them: requirements_versions.txt requirements.txt

Same issue. Working replacing the requirements_versions.txt and the requirements.txt.

Thanks!!

suitux avatar Nov 19 '22 23:11 suitux