ModuleNotFoundError: No module named ‘tqdm.auto’ 原因与解决方法

今天一位朋友在用Python开发的AI绘画程序“Stable Diffusion”的时候,结果报错如下:

Python 3.10.11 (tags/v3.10.11:7d4cc5a, Apr  5 2023, 00:38:17) [MSC v.1929 64 bit (AMD64)]
Version: v1.6.1
Commit hash: 4afaaf8a020c1df457bcf7250cb1c7f609699fa7
current transparent-background 1.2.9
Installing requirements 1 for Infinite-Zoom
is_installed check for tensorflow-cpu failed as 'spec is None'
Installing requirements for easyphoto-webui
Installing requirements for tensorflow
Installing requirements for easyphoto-webui
Installing requirements for imageio
Installing requirements for easyphoto-webui
Installing requirements for invisible-watermark
Launching Web UI with arguments: --theme dark --xformers --api --autolaunch
Traceback (most recent call last):
  File "D:\sd-webui-aki-v4.4\launch.py", line 48, in <module>
    main()
  File "D:\sd-webui-aki-v4.4\launch.py", line 44, in main
    start()
  File "D:\sd-webui-aki-v4.4\modules\launch_utils.py", line 432, in start
    import webui
  File "D:\sd-webui-aki-v4.4\webui.py", line 13, in <module>
    initialize.imports()
  File "D:\sd-webui-aki-v4.4\modules\initialize.py", line 16, in imports
    import pytorch_lightning  # noqa: F401
  File "D:\sd-webui-aki-v4.4\python\lib\site-packages\pytorch_lightning\__init__.py", line 35, in <module>
    from pytorch_lightning.callbacks import Callback  # noqa: E402
  File "D:\sd-webui-aki-v4.4\python\lib\site-packages\pytorch_lightning\callbacks\__init__.py", line 14, in <module>
    from pytorch_lightning.callbacks.batch_size_finder import BatchSizeFinder
  File "D:\sd-webui-aki-v4.4\python\lib\site-packages\pytorch_lightning\callbacks\batch_size_finder.py", line 24, in <module>
    from pytorch_lightning.callbacks.callback import Callback
  File "D:\sd-webui-aki-v4.4\python\lib\site-packages\pytorch_lightning\callbacks\callback.py", line 25, in <module>
    from pytorch_lightning.utilities.types import STEP_OUTPUT
  File "D:\sd-webui-aki-v4.4\python\lib\site-packages\pytorch_lightning\utilities\types.py", line 27, in <module>
    from torchmetrics import Metric
  File "D:\sd-webui-aki-v4.4\python\lib\site-packages\torchmetrics\__init__.py", line 14, in <module>
    from torchmetrics import functional  # noqa: E402
  File "D:\sd-webui-aki-v4.4\python\lib\site-packages\torchmetrics\functional\__init__.py", line 82, in <module>
    from torchmetrics.functional.text.bleu import bleu_score
  File "D:\sd-webui-aki-v4.4\python\lib\site-packages\torchmetrics\functional\text\__init__.py", line 30, in <module>
    from torchmetrics.functional.text.bert import bert_score  # noqa: F401
  File "D:\sd-webui-aki-v4.4\python\lib\site-packages\torchmetrics\functional\text\bert.py", line 24, in <module>
    from torchmetrics.functional.text.helper_embedding_metric import (
  File "D:\sd-webui-aki-v4.4\python\lib\site-packages\torchmetrics\functional\text\helper_embedding_metric.py", line 26, in <module>
 from transformers import AutoModelForMaskedLM, AutoTokenizer, PreTrainedModel, PreTrainedTokenizerBase
  File "D:\sd-webui-aki-v4.4\python\lib\site-packages\transformers\__init__.py", line 26, in <module>
    from . import dependency_versions_check
  File "D:\sd-webui-aki-v4.4\python\lib\site-packages\transformers\dependency_versions_check.py", line 17, in <module>
    from .utils.versions import require_version, require_version_core
  File "D:\sd-webui-aki-v4.4\python\lib\site-packages\transformers\utils\__init__.py", line 30, in <module>
    from .generic import (
  File "D:\sd-webui-aki-v4.4\python\lib\site-packages\transformers\utils\generic.py", line 29, in <module>
    from .import_utils import is_flax_available, is_tf_available, is_torch_available, is_torch_fx_proxy
  File "D:\sd-webui-aki-v4.4\python\lib\site-packages\transformers\utils\import_utils.py", line 33, in <module>
    from . import logging
  File "D:\sd-webui-aki-v4.4\python\lib\site-packages\transformers\utils\logging.py", line 35, in <module>
    import huggingface_hub.utils as hf_hub_utils
  File "D:\sd-webui-aki-v4.4\python\lib\site-packages\huggingface_hub\utils\__init__.py", line 18, in <module>
    from . import tqdm as _tqdm  # _tqdm is the module
  File "D:\sd-webui-aki-v4.4\python\lib\site-packages\huggingface_hub\utils\tqdm.py", line 63, in <module>
    from tqdm.auto import tqdm as old_tqdm
ModuleNotFoundError: No module named 'tqdm.auto'
提示:Python 运行时抛出了一个异常。请检查疑难解答页面。

--------
[程序异常退出,退出代码为 1 (0x00000001)]

ModuleNotFoundError: No module named 'tqdm.auto'

 

原因:

这是由于Python环境中缺少了tqdm包,需要使用conda或者pip命令进行安装即可解决。

 

tqdm模块功能就是一个“智能进度条或自动进度条”一样,例如:

from tqdm import tqdm
for i in tqdm(range(10000)):
    ...
76%|████████████████████████        | 7568/10000 [00:33<00:10, 229.00it/s]

 

解决方法

Python安装tqdm模块命令如下:

pip install tqdm

或者

conda install tqdm

 

谈谈我在AI绘画程序Stable Diffusion是如何解决的?

由于是Stable Diffusion,因此,我们必须要考虑兼容性。仔细问了我的朋友才知道:

 

操作:

1、他在extension文件夹中,新安装了一个TemporalKit插件,结果就这样了。

2、他又将新安装的TemporalKit文件夹删除,还是不行,还是报上面那个错误。

 

原因:

如果你的sd版本是最新的话,只要用了TemporalKit就会一直报错,这是因为最新的sd版本会出现和TemporalKit版本不兼容的问题,把sd版本降一下就好了。

 

解决:

1、打开“A启动器”。

2、点击“疑难解答”图标,可以清楚的看到:

异常名 描述
Python 模块缺失 Python 无法找到模块“tqdm.auto”。这可能是由于安装过程中止、使用快速启动流程或文件损坏导致。请手动删除模块残余文件以便自动下载恢复。
依赖版本异常 TemporalKit 依赖的 moviepy 安装了过时的 tqdm 版本,与其他组件不兼容。请尝试卸载该插件并重新安装依赖。

TemporalKit 依赖的 moviepy 安装了过时的 tqdm 版本,与其他组件不兼容。请尝试卸载该插件并重新安装依赖。

3、点击“修复”,再次启动就恢复正常了。

由于他不是学编程的,只会使用简单的软件,为了怕Stable Diffusion出大问题,用“修复”能解决就可以了,先不搞SD和TemporalKit兼容了,毕竟对他来说太过于复杂。

付杰
  • ¥ 999.0元
  • 市场价:1599.0元
  • ¥ 59.8元
  • 市场价:99.8元
  • ¥ 98.0元
  • 市场价:398.0元
  • ¥ 198.0元
  • 市场价:498.0元

发表评论

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen: