はじめに
昔買ったデスクトップPCにNVidiaが搭載していたし有効活用したいな。という思いと、自分でもAIで画像生成してみたいな。
という気持ちから、「Stable Diffusion WebUI」を使ってみたい!という気持ちになりました。
Stable Diffusion WebUIとは?
いわゆるプロンプトで画像を生成できるものです。
実施したインストール方法
※ デスクトップPCが古すぎて、Windows11にアップデートできないのでWindows10環境になります。
ダウンロードして、バッチを叩くだけで良い!という手順があったので、こちらで。
※ Pythsonを入れていない環境なので大変助かる。
ハマったこと
ワクワクしながら手順の通り、ダウンロード → update.bat.を実行 → run.bat を実行
すると、なんかエラーが出る。
※ 「D:\app」配下に「sd.webui.zip」を展開しています。
Installing clip
Traceback (most recent call last):
File "D:\app\sd.webui\webui\launch.py", line 48, in <module>
main()
File "D:\app\sd.webui\webui\launch.py", line 39, in main
prepare_environment()
File "D:\app\sd.webui\webui\modules\launch_utils.py", line 394, in prepare_environment
run_pip(f"install {clip_package}", "clip")
File "D:\app\sd.webui\webui\modules\launch_utils.py", line 144, in run_pip
return run(f'"{python}" -m pip {command} --prefer-binary{index_url_line}', desc=f"Installing {desc}", errdesc=f"Couldn't install {desc}", live=live)
File "D:\app\sd.webui\webui\modules\launch_utils.py", line 116, in run
raise RuntimeError("\n".join(error_bits))
RuntimeError: Couldn't install clip.
Command: "D:\app\sd.webui\system\python\python.exe" -m pip install https://github.com/openai/CLIP/archive/d50d76daa670286dd6cacf3bcd80b5e4823fc8e1.zip --prefer-binary
Error code: 2
stdout: Collecting https://github.com/openai/CLIP/archive/d50d76daa670286dd6cacf3bcd80b5e4823fc8e1.zip
Using cached https://github.com/openai/CLIP/archive/d50d76daa670286dd6cacf3bcd80b5e4823fc8e1.zip (4.3 MB)
Installing build dependencies: started
Installing build dependencies: finished with status 'done'
Getting requirements to build wheel: started
Getting requirements to build wheel: finished with status 'done'
stderr: ERROR: Exception:
Traceback (most recent call last):
File "D:\app\sd.webui\system\python\lib\site-packages\pip\_internal\cli\base_command.py", line 107, in _run_wrapper
status = _inner_run()
File "D:\app\sd.webui\system\python\lib\site-packages\pip\_internal\cli\base_command.py", line 98, in _inner_run
return self.run(options, args)
File "D:\app\sd.webui\system\python\lib\site-packages\pip\_internal\cli\req_command.py", line 96, in wrapper
return func(self, options, args)
File "D:\app\sd.webui\system\python\lib\site-packages\pip\_internal\commands\install.py", line 392, in run
requirement_set = resolver.resolve(
File "D:\app\sd.webui\system\python\lib\site-packages\pip\_internal\resolution\resolvelib\resolver.py", line 79, in resolve
collected = self.factory.collect_root_requirements(root_reqs)
File "D:\app\sd.webui\system\python\lib\site-packages\pip\_internal\resolution\resolvelib\factory.py", line 538, in collect_root_requirements
reqs = list(
File "D:\app\sd.webui\system\python\lib\site-packages\pip\_internal\resolution\resolvelib\factory.py", line 494, in _make_requirements_from_install_req
cand = self._make_base_candidate_from_link(
File "D:\app\sd.webui\system\python\lib\site-packages\pip\_internal\resolution\resolvelib\factory.py", line 226, in _make_base_candidate_from_link
self._link_candidate_cache[link] = LinkCandidate(
File "D:\app\sd.webui\system\python\lib\site-packages\pip\_internal\resolution\resolvelib\candidates.py", line 318, in __init__
super().__init__(
File "D:\app\sd.webui\system\python\lib\site-packages\pip\_internal\resolution\resolvelib\candidates.py", line 161, in __init__
self.dist = self._prepare()
File "D:\app\sd.webui\system\python\lib\site-packages\pip\_internal\resolution\resolvelib\candidates.py", line 238, in _prepare
dist = self._prepare_distribution()
File "D:\app\sd.webui\system\python\lib\site-packages\pip\_internal\resolution\resolvelib\candidates.py", line 329, in _prepare_distribution
return preparer.prepare_linked_requirement(self._ireq, parallel_builds=True)
File "D:\app\sd.webui\system\python\lib\site-packages\pip\_internal\operations\prepare.py", line 542, in prepare_linked_requirement
return self._prepare_linked_requirement(req, parallel_builds)
File "D:\app\sd.webui\system\python\lib\site-packages\pip\_internal\operations\prepare.py", line 657, in _prepare_linked_requirement
dist = _get_prepared_distribution(
File "D:\app\sd.webui\system\python\lib\site-packages\pip\_internal\operations\prepare.py", line 77, in _get_prepared_distribution
abstract_dist.prepare_distribution_metadata(
File "D:\app\sd.webui\system\python\lib\site-packages\pip\_internal\distributions\sdist.py", line 55, in prepare_distribution_metadata
self._install_build_reqs(build_env_installer)
File "D:\app\sd.webui\system\python\lib\site-packages\pip\_internal\distributions\sdist.py", line 132, in _install_build_reqs
build_reqs = self._get_build_requires_wheel()
File "D:\app\sd.webui\system\python\lib\site-packages\pip\_internal\distributions\sdist.py", line 107, in _get_build_requires_wheel
return backend.get_requires_for_build_wheel()
File "D:\app\sd.webui\system\python\lib\site-packages\pip\_internal\utils\misc.py", line 700, in get_requires_for_build_wheel
return super().get_requires_for_build_wheel(config_settings=cs)
File "D:\app\sd.webui\system\python\lib\site-packages\pip\_vendor\pyproject_hooks\_impl.py", line 196, in get_requires_for_build_wheel
return self._call_hook(
File "D:\app\sd.webui\system\python\lib\site-packages\pip\_vendor\pyproject_hooks\_impl.py", line 402, in _call_hook
raise BackendUnavailable(
pip._vendor.pyproject_hooks._impl.BackendUnavailable: Cannot import 'setuptools.build_meta'
続行するには何かキーを押してください . . .
Geminiに丸投げしても、よくわからず。
pip._vendor.pyproject_hooks._impl.BackendUnavailable: Cannot import 'setuptools.build_meta'
というキーワードで、検索すると以下の「issues」に遭遇
上の方に記載されていた以下を実施すれば解決した。という人を真似て、脳死で実行。
python.exe -m pip install clip-anytorch
python.exe -m pip install open-clip-torch
お!と思ったが、別のエラーに遭遇。
Geminiに丸投げしたけど、やっぱりよく分からず。
真面目に、「issues」を追っていくと、更に別の方を発見!
さっき実行したコマンドに加えて、以下も実行するとのこと。
Run .\python.exe -m pip install --no-build-isolation -r "C:\sd.webui\webui\requirements_versions.txt"
脳死で、実行したら。解決!
振り返り
世の中の方に助けられて生きているな。と思った今日のこの頃。
とりあえず、各コメントにお礼のスタンプを押下して、自分も何か気づいたら、issuesを上げて、解決したらコメントしてみようと思った今日のこの頃。


