Repository: stable-diffusion-webui
Issue: [Bug]: ModuleNotFoundError: No module named 'timm'
Labels: bug-report

### Checklist

- [ ] The issue exists after disabling all extensions
- [X] The issue exists on a clean installation of webui
- [ ] The issue is caused by an extension, but I believe it is caused by a bug in the webui
- [ ] The issue exists in the current version of the webui
- [ ] The issue has not been reported before recently
- [ ] The issue has been reported before but has not been fixed yet

### What happened?

root@debian:/dockerx/stable-diffusion-webui# REQS_FILE='requirements.txt' python launch.py --precision full --no-half
Python 3.10.15 (main, Oct  3 2024, 07:27:34) [GCC 11.2.0]
Version: v1.10.1
Commit hash: 82a973c04367123ae98bd9abdf80d9eda9b910e2
Launching Web UI with arguments: --precision full --no-half
no module 'xformers'. Processing without...
no module 'xformers'. Processing without...
No module 'xformers'. Proceeding without it.
Traceback (most recent call last):
  File "/dockerx/stable-diffusion-webui/launch.py", line 48, in <module>
    main()
  File "/dockerx/stable-diffusion-webui/launch.py", line 44, in main
    start()
  File "/dockerx/stable-diffusion-webui/modules/launch_utils.py", line 465, in start
    import webui
  File "/dockerx/stable-diffusion-webui/webui.py", line 13, in <module>
    initialize.imports()
  File "/dockerx/stable-diffusion-webui/modules/initialize.py", line 39, in imports
    from modules import processing, gradio_extensons, ui  # noqa: F401
  File "/dockerx/stable-diffusion-webui/modules/processing.py", line 31, in <module>
    from ldm.data.util import AddMiDaS
  File "/dockerx/stable-diffusion-webui/repositories/stable-diffusion-stability-ai/ldm/data/util.py", line 3, in <module>
    from ldm.modules.midas.api import load_midas_transform
  File "/dockerx/stable-diffusion-webui/repositories/stable-diffusion-stability-ai/ldm/modules/midas/api.py", line 8, in <module>
    from ldm.modules.midas.midas.dpt_depth import DPTDepthModel
  File "/dockerx/stable-diffusion-webui/repositories/stable-diffusion-stability-ai/ldm/modules/midas/midas/dpt_depth.py", line 6, in <module>
    from .blocks import (
  File "/dockerx/stable-diffusion-webui/repositories/stable-diffusion-stability-ai/ldm/modules/midas/midas/blocks.py", line 4, in <module>
    from .vit import (
  File "/dockerx/stable-diffusion-webui/repositories/stable-diffusion-stability-ai/ldm/modules/midas/midas/vit.py", line 3, in <module>
    import timm
ModuleNotFoundError: No module named 'timm'


### Steps to reproduce the problem

1. Install the prooject using the docker method.
2. get to the steep where you have to run the following command
3. `root@debian:/dockerx/stable-diffusion-webui# REQS_FILE='requirements.txt' python launch.py --precision full --no-half`
4. You get this error:
```

root@debian:/dockerx/stable-diffusion-webui# REQS_FILE='requirements.txt' python launch.py --precision full --no-half
Python 3.10.15 (main, Oct  3 2024, 07:27:34) [GCC 11.2.0]
Version: v1.10.1
Commit hash: 82a973c04367123ae98bd9abdf80d9eda9b910e2
Launching Web UI with arguments: --precision full --no-half
no module 'xformers'. Processing without...
no module 'xformers'. Processing without...
No module 'xformers'. Proceeding without it.
Traceback (most recent call last):
  File "/dockerx/stable-diffusion-webui/launch.py", line 48, in <module>
    main()
  File "/dockerx/stable-diffusion-webui/launch.py", line 44, in main
    start()
  File "/dockerx/stable-diffusion-webui/modules/launch_utils.py", line 465, in start
    import webui
  File "/dockerx/stable-diffusion-webui/webui.py", line 13, in <module>
    initialize.imports()
  File "/dockerx/stable-diffusion-webui/modules/initialize.py", line 39, in imports
    from modules import processing, gradio_extensons, ui  # noqa: F401
  File "/dockerx/stable-diffusion-webui/modules/processing.py", line 31, in <module>
    from ldm.data.util import AddMiDaS
  File "/dockerx/stable-diffusion-webui/repositories/stable-diffusion-stability-ai/ldm/data/util.py", line 3, in <module>
    from ldm.modules.midas.api import load_midas_transform
  File "/dockerx/stable-diffusion-webui/repositories/stable-diffusion-stability-ai/ldm/modules/midas/api.py", line 8, in <module>
    from ldm.modules.midas.midas.dpt_depth import DPTDepthModel
  File "/dockerx/stable-diffusion-webui/repositories/stable-diffusion-stability-ai/ldm/modules/midas/midas/dpt_depth.py", line 6, in <module>
    from .blocks import (
  File "/dockerx/stable-diffusion-webui/repositories/stable-diffusion-stability-ai/ldm/modules/midas/midas/blocks.py", line 4, in <module>
    from .vit import (
  File "/dockerx/stable-diffusion-webui/repositories/stable-diffusion-stability-ai/ldm/modules/midas/midas/vit.py", line 3, in <module>
    import timm
ModuleNotFoundError: No module named 'timm'

```


### What should have happened?

The project should be installed correctly.

### What browsers do you use to access the UI ?

Google Chrome

### Sysinfo

Debian 12

### Console logs

```Shell
root@debian:/dockerx/stable-diffusion-webui# REQS_FILE='requirements.txt' python launch.py --precision full --no-half
Python 3.10.15 (main, Oct  3 2024, 07:27:34) [GCC 11.2.0]
Version: v1.10.1
Commit hash: 82a973c04367123ae98bd9abdf80d9eda9b910e2
Launching Web UI with arguments: --precision full --no-half
no module 'xformers'. Processing without...
no module 'xformers'. Processing without...
No module 'xformers'. Proceeding without it.
Traceback (most recent call last):
  File "/dockerx/stable-diffusion-webui/launch.py", line 48, in <module>
    main()
  File "/dockerx/stable-diffusion-webui/launch.py", line 44, in main
    start()
  File "/dockerx/stable-diffusion-webui/modules/launch_utils.py", line 465, in start
    import webui
  File "/dockerx/stable-diffusion-webui/webui.py", line 13, in <module>
    initialize.imports()
  File "/dockerx/stable-diffusion-webui/modules/initialize.py", line 39, in imports
    from modules import processing, gradio_extensons, ui  # noqa: F401
  File "/dockerx/stable-diffusion-webui/modules/processing.py", line 31, in <module>
    from ldm.data.util import AddMiDaS
  File "/dockerx/stable-diffusion-webui/repositories/stable-diffusion-stability-ai/ldm/data/util.py", line 3, in <module>
    from ldm.modules.midas.api import load_midas_transform
  File "/dockerx/stable-diffusion-webui/repositories/stable-diffusion-stability-ai/ldm/modules/midas/api.py", line 8, in <module>
    from ldm.modules.midas.midas.dpt_depth import DPTDepthModel
  File "/dockerx/stable-diffusion-webui/repositories/stable-diffusion-stability-ai/ldm/modules/midas/midas/dpt_depth.py", line 6, in <module>
    from .blocks import (
  File "/dockerx/stable-diffusion-webui/repositories/stable-diffusion-stability-ai/ldm/modules/midas/midas/blocks.py", line 4, in <module>
    from .vit import (
  File "/dockerx/stable-diffusion-webui/repositories/stable-diffusion-stability-ai/ldm/modules/midas/midas/vit.py", line 3, in <module>
    import timm
ModuleNotFoundError: No module named 'timm'
```


### Additional information

I installed timm manually and it fixed the problem.
```

root@debian:/dockerx/stable-diffusion-webui# pip install timm
Collecting timm
  Downloading timm-1.0.9-py3-none-any.whl.metadata (42 kB)
Requirement already satisfied: torch in /opt/conda/envs/py_3.10/lib/python3.10/site-packages (from timm) (2.3.0a0+gitd2f9472)
Requirement already satisfied: torchvision in /opt/conda/envs/py_3.10/lib/python3.10/site-packages/torchvision-0.18.0a0+68ba7ec-py3.10-linux-x86_64.egg (from timm) (0.18.0a0+68ba7ec)
Requirement already satisfied: pyyaml in /opt/conda/envs/py_3.10/lib/python3.10/site-packages (from timm) (6.0.1)
Requirement already satisfied: huggingface_hub in /opt/conda/envs/py_3.10/lib/python3.10/site-packages (from timm) (0.25.2)
Requirement already satisfied: safetensors in /opt/conda/envs/py_3.10/lib/python3.10/site-packages (from timm) (0.4.5)
Requirement already satisfied: filelock in /opt/conda/envs/py_3.10/lib/python3.10/site-packages (from huggingface_hub->timm) (3.16.1)
Requirement already satisfied: fsspec>=2023.5.0 in /opt/conda/envs/py_3.10/lib/python3.10/site-packages/fsspec-2024.9.0-py3.10.egg (from huggingface_hub->timm) (2024.9.0)
Requirement already satisfied: packaging>=20.9 in /opt/conda/envs/py_3.10/lib/python3.10/site-packages (from huggingface_hub->timm) (24.1)
Requirement already satisfied: requests in /opt/conda/envs/py_3.10/lib/python3.10/site-packages (from huggingface_hub->timm) (2.32.3)
Requirement already satisfied: tqdm>=4.42.1 in /opt/conda/envs/py_3.10/lib/python3.10/site-packages (from huggingface_hub->timm) (4.66.5)
Requirement already satisfied: typing-extensions>=3.7.4.3 in /opt/conda/envs/py_3.10/lib/python3.10/site-packages (from huggingface_hub->timm) (4.12.2)
Requirement already satisfied: sympy<=1.12.1 in /opt/conda/envs/py_3.10/lib/python3.10/site-packages (from torch->timm) (1.12.1)
Requirement already satisfied: networkx in /opt/conda/envs/py_3.10/lib/python3.10/site-packages (from torch->timm) (2.8.8)
Requirement already satisfied: jinja2 in /opt/conda/envs/py_3.10/lib/python3.10/site-packages (from torch->timm) (3.1.3)
Requirement already satisfied: numpy<2 in /opt/conda/envs/py_3.10/lib/python3.10/site-packages (from torchvision->timm) (1.26.4)
Requirement already satisfied: pillow!=8.3.*,>=5.3.0 in /opt/conda/envs/py_3.10/lib/python3.10/site-packages (from torchvision->timm) (10.2.0)
Requirement already satisfied: mpmath<1.4.0,>=1.1.0 in /opt/conda/envs/py_3.10/lib/python3.10/site-packages (from sympy<=1.12.1->torch->timm) (1.3.0)
Requirement already satisfied: MarkupSafe>=2.0 in /opt/conda/envs/py_3.10/lib/python3.10/site-packages (from jinja2->torch->timm) (2.1.5)
Requirement already satisfied: charset-normalizer<4,>=2 in /opt/conda/envs/py_3.10/lib/python3.10/site-packages (from requests->huggingface_hub->timm) (3.4.0)
Requirement already satisfied: idna<4,>=2.5 in /opt/conda/envs/py_3.10/lib/python3.10/site-packages (from requests->huggingface_hub->timm) (3.10)
Requirement already satisfied: urllib3<3,>=1.21.1 in /opt/conda/envs/py_3.10/lib/python3.10/site-packages (from requests->huggingface_hub->timm) (1.26.20)
Requirement already satisfied: certifi>=2017.4.17 in /opt/conda/envs/py_3.10/lib/python3.10/site-packages (from requests->huggingface_hub->timm) (2024.8.30)
Downloading timm-1.0.9-py3-none-any.whl (2.3 MB)
   ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 2.3/2.3 MB 15.9 MB/s eta 0:00:00
Installing collected packages: timm
Successfully installed timm-1.0.9
WARNING: Running pip as the 'root' user can result in broken permissions and conflicting behaviour with the system package manager, possibly rendering your system unusable.It is recommended to use a virtual environment instead: https://pip.pypa.io/warnings/venv. Use the --root-user-action option if you know what you are doing and want to suppress this warning.

```

Then i get this error:

```

root@debian:/dockerx/stable-diffusion-webui# REQS_FILE='requirements.txt' python launch.py --precision full --no-half
Python 3.10.15 (main, Oct  3 2024, 07:27:34) [GCC 11.2.0]
Version: v1.10.1
Commit hash: 82a973c04367123ae98bd9abdf80d9eda9b910e2
Launching Web UI with arguments: --precision full --no-half
no module 'xformers'. Processing without...
no module 'xformers'. Processing without...
No module 'xformers'. Proceeding without it.
Pytorch_lightning.distributed not found, attempting pytorch_lightning.rank_zero
Downloading: "https://huggingface.co/runwayml/stable-diffusion-v1-5/resolve/main/v1-5-pruned-emaonly.safetensors" to /dockerx/stable-diffusion-webui/models/Stable-diffusion/v1-5-pruned-emaonly.safetensors

100%|██████████████████████████████████████████████████████████████| 3.97G/3.97G [02:48<00:00, 25.4MB/s]
*** Error creating UI for None: 
    Traceback (most recent call last):
      File "/dockerx/stable-diffusion-webui/modules/scripts.py", line 640, in create_script_ui
        self.create_script_ui_inner(script)
      File "/dockerx/stable-diffusion-webui/modules/scripts.py", line 645, in create_script_ui_inner
        import modules.api.models as api_models
      File "/dockerx/stable-diffusion-webui/modules/api/models.py", line 113, in <module>
        ).generate_model()
      File "/dockerx/stable-diffusion-webui/modules/api/models.py", line 96, in generate_model
        DynamicModel.__config__.allow_population_by_field_name = True
      File "/opt/conda/envs/py_3.10/lib/python3.10/site-packages/pydantic/_internal/_model_construction.py", line 262, in __getattr__
        raise AttributeError(item)
    AttributeError: __config__

---
*** Error creating UI for None: 
    Traceback (most recent call last):
      File "/dockerx/stable-diffusion-webui/modules/scripts.py", line 640, in create_script_ui
        self.create_script_ui_inner(script)
      File "/dockerx/stable-diffusion-webui/modules/scripts.py", line 645, in create_script_ui_inner
        import modules.api.models as api_models
      File "/dockerx/stable-diffusion-webui/modules/api/models.py", line 113, in <module>
        ).generate_model()
      File "/dockerx/stable-diffusion-webui/modules/api/models.py", line 96, in generate_model
        DynamicModel.__config__.allow_population_by_field_name = True
      File "/opt/conda/envs/py_3.10/lib/python3.10/site-packages/pydantic/_internal/_model_construction.py", line 262, in __getattr__
        raise AttributeError(item)
    AttributeError: __config__

---
*** Error creating UI for None: 
    Traceback (most recent call last):
      File "/dockerx/stable-diffusion-webui/modules/scripts.py", line 640, in create_script_ui
        self.create_script_ui_inner(script)
      File "/dockerx/stable-diffusion-webui/modules/scripts.py", line 645, in create_script_ui_inner
        import modules.api.models as api_models
      File "/dockerx/stable-diffusion-webui/modules/api/models.py", line 113, in <module>
        ).generate_model()
      File "/dockerx/stable-diffusion-webui/modules/api/models.py", line 96, in generate_model
        DynamicModel.__config__.allow_population_by_field_name = True
      File "/opt/conda/envs/py_3.10/lib/python3.10/site-packages/pydantic/_internal/_model_construction.py", line 262, in __getattr__
        raise AttributeError(item)
    AttributeError: __config__

---
*** Error creating UI for None: 
    Traceback (most recent call last):
      File "/dockerx/stable-diffusion-webui/modules/scripts.py", line 640, in create_script_ui
        self.create_script_ui_inner(script)
      File "/dockerx/stable-diffusion-webui/modules/scripts.py", line 645, in create_script_ui_inner
        import modules.api.models as api_models
      File "/dockerx/stable-diffusion-webui/modules/api/models.py", line 113, in <module>
        ).generate_model()
      File "/dockerx/stable-diffusion-webui/modules/api/models.py", line 96, in generate_model
        DynamicModel.__config__.allow_population_by_field_name = True
      File "/opt/conda/envs/py_3.10/lib/python3.10/site-packages/pydantic/_internal/_model_construction.py", line 262, in __getattr__
        raise AttributeError(item)
    AttributeError: __config__

---
*** Error creating UI for Hypertile: 
    Traceback (most recent call last):
      File "/dockerx/stable-diffusion-webui/modules/scripts.py", line 640, in create_script_ui
        self.create_script_ui_inner(script)
      File "/dockerx/stable-diffusion-webui/modules/scripts.py", line 645, in create_script_ui_inner
        import modules.api.models as api_models
      File "/dockerx/stable-diffusion-webui/modules/api/models.py", line 113, in <module>
        ).generate_model()
      File "/dockerx/stable-diffusion-webui/modules/api/models.py", line 96, in generate_model
        DynamicModel.__config__.allow_population_by_field_name = True
      File "/opt/conda/envs/py_3.10/lib/python3.10/site-packages/pydantic/_internal/_model_construction.py", line 262, in __getattr__
        raise AttributeError(item)
    AttributeError: __config__

---
*** Error creating UI for None: 
    Traceback (most recent call last):
      File "/dockerx/stable-diffusion-webui/modules/scripts.py", line 640, in create_script_ui
        self.create_script_ui_inner(script)
      File "/dockerx/stable-diffusion-webui/modules/scripts.py", line 645, in create_script_ui_inner
        import modules.api.models as api_models
      File "/dockerx/stable-diffusion-webui/modules/api/models.py", line 113, in <module>
        ).generate_model()
      File "/dockerx/stable-diffusion-webui/modules/api/models.py", line 96, in generate_model
        DynamicModel.__config__.allow_population_by_field_name = True
      File "/opt/conda/envs/py_3.10/lib/python3.10/site-packages/pydantic/_internal/_model_construction.py", line 262, in __getattr__
        raise AttributeError(item)
    AttributeError: __config__

---
*** Error creating UI for None: 
    Traceback (most recent call last):
      File "/dockerx/stable-diffusion-webui/modules/scripts.py", line 640, in create_script_ui
        self.create_script_ui_inner(script)
      File "/dockerx/stable-diffusion-webui/modules/scripts.py", line 645, in create_script_ui_inner
        import modules.api.models as api_models
      File "/dockerx/stable-diffusion-webui/modules/api/models.py", line 113, in <module>
        ).generate_model()
      File "/dockerx/stable-diffusion-webui/modules/api/models.py", line 96, in generate_model
        DynamicModel.__config__.allow_population_by_field_name = True
      File "/opt/conda/envs/py_3.10/lib/python3.10/site-packages/pydantic/_internal/_model_construction.py", line 262, in __getattr__
        raise AttributeError(item)
    AttributeError: __config__

---
*** Error creating UI for None: 
    Traceback (most recent call last):
      File "/dockerx/stable-diffusion-webui/modules/scripts.py", line 640, in create_script_ui
        self.create_script_ui_inner(script)
      File "/dockerx/stable-diffusion-webui/modules/scripts.py", line 645, in create_script_ui_inner
        import modules.api.models as api_models
      File "/dockerx/stable-diffusion-webui/modules/api/models.py", line 113, in <module>
        ).generate_model()
      File "/dockerx/stable-diffusion-webui/modules/api/models.py", line 96, in generate_model
        DynamicModel.__config__.allow_population_by_field_name = True
      File "/opt/conda/envs/py_3.10/lib/python3.10/site-packages/pydantic/_internal/_model_construction.py", line 262, in __getattr__
        raise AttributeError(item)
    AttributeError: __config__

---
*** Error creating UI for None: 
    Traceback (most recent call last):
      File "/dockerx/stable-diffusion-webui/modules/scripts.py", line 640, in create_script_ui
        self.create_script_ui_inner(script)
      File "/dockerx/stable-diffusion-webui/modules/scripts.py", line 645, in create_script_ui_inner
        import modules.api.models as api_models
      File "/dockerx/stable-diffusion-webui/modules/api/models.py", line 113, in <module>
        ).generate_model()
      File "/dockerx/stable-diffusion-webui/modules/api/models.py", line 96, in generate_model
        DynamicModel.__config__.allow_population_by_field_name = True
      File "/opt/conda/envs/py_3.10/lib/python3.10/site-packages/pydantic/_internal/_model_construction.py", line 262, in __getattr__
        raise AttributeError(item)
    AttributeError: __config__

---
Calculating sha256 for /dockerx/stable-diffusion-webui/models/Stable-diffusion/v1-5-pruned-emaonly.safetensors: Traceback (most recent call last):
  File "/dockerx/stable-diffusion-webui/launch.py", line 48, in <module>
    main()
  File "/dockerx/stable-diffusion-webui/launch.py", line 44, in main
    start()
  File "/dockerx/stable-diffusion-webui/modules/launch_utils.py", line 469, in start
    webui.webui()
  File "/dockerx/stable-diffusion-webui/webui.py", line 64, in webui
    shared.demo = ui.create_ui()
  File "/dockerx/stable-diffusion-webui/modules/ui.py", line 489, in create_ui
    toprow.ui_styles.dropdown.change(fn=wrap_queued_call(update_token_counter), inputs=[toprow.prompt, steps, toprow.ui_styles.dropdown], outputs=[toprow.token_counter])
  File "/opt/conda/envs/py_3.10/lib/python3.10/site-packages/gradio/events.py", line 140, in __call__
    dep, dep_index = self.trigger.set_event_trigger(
  File "/opt/conda/envs/py_3.10/lib/python3.10/site-packages/gradio/blocks.py", line 286, in set_event_trigger
    "inputs": [block._id for block in inputs],
  File "/opt/conda/envs/py_3.10/lib/python3.10/site-packages/gradio/blocks.py", line 286, in <listcomp>
    "inputs": [block._id for block in inputs],
AttributeError: 'NoneType' object has no attribute '_id'
6ce0161689b3853acaa03779ec93eafe75a02f4ced659bee03f50797806fa2fa
Loading weights [6ce0161689] from /dockerx/stable-diffusion-webui/models/Stable-diffusion/v1-5-pruned-emaonly.safetensors
Creating model from config: /dockerx/stable-diffusion-webui/configs/v1-inference.yaml
/opt/conda/envs/py_3.10/lib/python3.10/site-packages/huggingface_hub/file_download.py:1142: FutureWarning: `resume_download` is deprecated and will be removed in version 1.0.0. Downloads always resume when possible. If you want to force a new download, use `force_download=True`.
  warnings.warn(
vocab.json: 100%|████████████████████████████████████████████████████| 961k/961k [00:00<00:00, 3.86MB/s]
merges.txt: 100%|████████████████████████████████████████████████████| 525k/525k [00:00<00:00, 5.36MB/s]
special_tokens_map.json: 100%|█████████████████████████████████████████| 389/389 [00:00<00:00, 3.12MB/s]
tokenizer_config.json: 100%|███████████████████████████████████████████| 905/905 [00:00<00:00, 10.8MB/s]
config.json: 100%|█████████████████████████████████████████████████| 4.52k/4.52k [00:00<00:00, 33.4MB/s]


```