thygate / stable-diffusion-webui-depthmap-script

High Resolution Depth Maps for Stable Diffusion WebUI
MIT License
1.72k stars 159 forks source link

Numba needs NumPy 1.24 or less #262

Closed kengher closed 1 year ago

kengher commented 1 year ago

Getting this error each time I start webui:

raise ImportError("Numba needs NumPy 1.24 or less") ImportError: Numba needs NumPy 1.24 or less

Full error stack:

Traceback (most recent call last):
  File "Z:\Stable Diffusion\stable-diffusion-webui\modules\scripts.py", line 263, in load_scripts
    script_module = script_loading.load_module(scriptfile.path)
                    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "Z:\Stable Diffusion\stable-diffusion-webui\modules\script_loading.py", line 10, in load_module
    module_spec.loader.exec_module(module)
  File "<frozen importlib._bootstrap_external>", line 940, in exec_module
  File "<frozen importlib._bootstrap>", line 241, in _call_with_frames_removed
  File "Z:\Stable Diffusion\stable-diffusion-webui\extensions\stable-diffusion-webui-depthmap-script\scripts\depthmap.py", line 14, in <module>
    from numba import njit, prange
  File "Z:\Stable Diffusion\stable-diffusion-webui\venv\Lib\site-packages\numba\__init__.py", line 55, in <module>
    _ensure_critical_deps()
  File "Z:\Stable Diffusion\stable-diffusion-webui\venv\Lib\site-packages\numba\__init__.py", line 42, in _ensure_critical_deps
    raise ImportError("Numba needs NumPy 1.24 or less")
ImportError: Numba needs NumPy 1.24 or less

Error loading script: stereoimage_generation.py
Traceback (most recent call last):
  File "Z:\Stable Diffusion\stable-diffusion-webui\modules\scripts.py", line 263, in load_scripts
    script_module = script_loading.load_module(scriptfile.path)
                    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "Z:\Stable Diffusion\stable-diffusion-webui\modules\script_loading.py", line 10, in load_module
    module_spec.loader.exec_module(module)
  File "<frozen importlib._bootstrap_external>", line 940, in exec_module
  File "<frozen importlib._bootstrap>", line 241, in _call_with_frames_removed
  File "Z:\Stable Diffusion\stable-diffusion-webui\extensions\stable-diffusion-webui-depthmap-script\scripts\stereoimage_generation.py", line 1, in <module>
    from numba import njit, prange
  File "Z:\Stable Diffusion\stable-diffusion-webui\venv\Lib\site-packages\numba\__init__.py", line 55, in <module>
    _ensure_critical_deps()
  File "Z:\Stable Diffusion\stable-diffusion-webui\venv\Lib\site-packages\numba\__init__.py", line 42, in _ensure_critical_deps
    raise ImportError("Numba needs NumPy 1.24 or less")
ImportError: Numba needs NumPy 1.24 or less

I tried to manually downgrade Numpy in site-packages but it doesn't work. I tried pip install numpy==1.24 but it doesn't affect the site-packages folder. Conda didn't work either. I'm Running stable diffusion in Windows 10, cuda 11.8, gtx 3090ti.

semjon00 commented 1 year ago

Well, this is quite unfortunate. There is a dependency hell problem coming along with many large python repositories (especially the ones extendable by plugins). I think that some plugin always installs the absolute latest numpy version. Please try to find out which plugin does it, then temporarily disable it and restore numpy 1.23.5 (or 1.24.4). Please let me know of the result and what is the plugin to blame (maybe an issue could be submitted).

semjon00 commented 1 year ago

Are you sure you are installing numpy=1.24 into the venv/conda and not as a system package?

kengher commented 1 year ago

Well, this is quite unfortunate. There is a dependency hell problem coming along with many large python repositories (especially the ones extendable by plugins). I think that some plugin always installs the absolute latest numpy version. Please try to find out which plugin does it, then temporarily disable it and restore numpy 1.23.5 (or 1.24.4). Please let me know of the result and what is the plugin to blame (maybe an issue could be submitted).

Great suggestion. I didn't think of this. I'll look into this and post what I find out.

kengher commented 1 year ago

Well, this is quite unfortunate. There is a dependency hell problem coming along with many large python repositories (especially the ones extendable by plugins). I think that some plugin always installs the absolute latest numpy version. Please try to find out which plugin does it, then temporarily disable it and restore numpy 1.23.5 (or 1.24.4). Please let me know of the result and what is the plugin to blame (maybe an issue could be submitted).

So instead of troubleshooting each plugin, I deleted Stable Diffusion's venv folder to force a fresh install of dependencies. It turned out SD installs numpy v1.25.0 by default. I'm not sure how to downgrade it. I even changed the requirements.txt and set numpy==1.24.0 but the install doesn't pull from that.

kengher commented 1 year ago

Ok. I downgraded Python 3.11 to SD webui's 3.10.6 recommended version and it fixed the numpy error, even though numpy 1.25.0 is still installed. It's working great now so i'm going to close it with this.

semjon00 commented 1 year ago

Glad it works now! But it is quite strange, because it technically should not. The most recent Numba does not claim to provide support for the most recent NumPy. Are you sure you have 1.25 installed? Could you please check out the output of pip list (from the venv) again?

kengher commented 1 year ago

Glad it works now! But it is quite strange, because it technically should not. The most recent Numba does not claim to provide support for the most recent NumPy. Are you sure you have 1.25 installed? Could you please check out the output of pip list (from the venv) again?

Sorry. I double checked the venv folder and it's 1.23.5, not 1.25. I was in my backup venv folder when I wrote my previous comment face palm

semjon00 commented 1 year ago

Ehh, happens with everyone 🙂