Skip to content

NumPy issue when running Automatic1111 #29337

@sanfordandsonrc

Description

@sanfordandsonrc

Steps to reproduce:

  1. Launch A1111 (webui-user.bat)
  2. Receive the following error:

A module that was compiled using NumPy 1.x cannot be run in
NumPy 2.2.6 as it may crash. To support both 1.x and 2.x
versions of NumPy, modules must be compiled with NumPy 2.0.
Some module may need to rebuild instead e.g. with 'pybind11>=2.12'.

If you are a user of the module, the easiest solution will be to
downgrade to 'numpy<2' or try to upgrade the affected module.
We expect that some modules will need time to support NumPy 2.

  1. uninstall and downgrade NumPy by using:

pip uninstall numpy

then:

pip install "numpy<2.0"

A "pip list" in the /venv/Scripts folder shows that the NumPy version is now 1.26.4.

  1. Launch A1111 again (webui-user.bat)
  2. Get the same error as above in Deprecation docs #2.
  3. pip list command reveals that the NumPy version is AGAIN set to 2.2.6, which is causing the error above in Deprecation docs #2.

Error message:

Traceback (most recent call last):  File "D:\AUTOMATIC1111\stable-diffusion-webui\launch.py", line 48, in <module>
    main()
  File "D:\AUTOMATIC1111\stable-diffusion-webui\launch.py", line 44, in main
    start()
  File "D:\AUTOMATIC1111\stable-diffusion-webui\modules\launch_utils.py", line 465, in start
    import webui
  File "D:\AUTOMATIC1111\stable-diffusion-webui\webui.py", line 13, in <module>
    initialize.imports()
  File "D:\AUTOMATIC1111\stable-diffusion-webui\modules\initialize.py", line 15, in imports
    import torch  # noqa: F401
  File "D:\AUTOMATIC1111\stable-diffusion-webui\venv\lib\site-packages\torch\__init__.py", line 1382, in <module>
    from .functional import *  # noqa: F403
  File "D:\AUTOMATIC1111\stable-diffusion-webui\venv\lib\site-packages\torch\functional.py", line 7, in <module>
    import torch.nn.functional as F
  File "D:\AUTOMATIC1111\stable-diffusion-webui\venv\lib\site-packages\torch\nn\__init__.py", line 1, in <module>
    from .modules import *  # noqa: F403
  File "D:\AUTOMATIC1111\stable-diffusion-webui\venv\lib\site-packages\torch\nn\modules\__init__.py", line 35, in <module>
    from .transformer import TransformerEncoder, TransformerDecoder, \
  File "D:\AUTOMATIC1111\stable-diffusion-webui\venv\lib\site-packages\torch\nn\modules\transformer.py", line 20, in <module>
    device: torch.device = torch.device(torch._C._get_default_device()),  # torch.device('cpu'),
D:\AUTOMATIC1111\stable-diffusion-webui\venv\lib\site-packages\torch\nn\modules\transformer.py:20: UserWarning: Failed to initialize NumPy: _ARRAY_API not found (Triggered internally at ..\torch\csrc\utils\tensor_numpy.cpp:84.)
  device: torch.device = torch.device(torch._C._get_default_device()),  # torch.device('cpu'),
Traceback (most recent call last):
  File "D:\AUTOMATIC1111\stable-diffusion-webui\launch.py", line 48, in <module>
    main()
  File "D:\AUTOMATIC1111\stable-diffusion-webui\launch.py", line 44, in main
    start()
  File "D:\AUTOMATIC1111\stable-diffusion-webui\modules\launch_utils.py", line 465, in start
    import webui
  File "D:\AUTOMATIC1111\stable-diffusion-webui\webui.py", line 13, in <module>
    initialize.imports()
  File "D:\AUTOMATIC1111\stable-diffusion-webui\modules\initialize.py", line 39, in imports
    from modules import processing, gradio_extensons, ui  # noqa: F401
  File "D:\AUTOMATIC1111\stable-diffusion-webui\modules\processing.py", line 15, in <module>
    from skimage import exposure
  File "D:\AUTOMATIC1111\stable-diffusion-webui\venv\lib\site-packages\skimage\__init__.py", line 122, in <module>
    from ._shared import geometry
  File "geometry.pyx", line 1, in init skimage._shared.geometry
ValueError: numpy.dtype size changed, may indicate binary incompatibility. Expected 96 from C header, got 88 from PyObject
Press any key to continue . . .

Additional information:

I checked the webui-user.bat file and the webui.bat (called by webui-user.bat), and I see nothing that would be updating the version of NumPy.

What am I missing here?

Thank you for any help you can provide.

Metadata

Metadata

Assignees

No one assigned

    Labels

    32 - InstallationProblems installing or compiling NumPy

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions