stable-diffusion-webui
stable-diffusion-webui copied to clipboard
[Bug]: pip._vendor.pyproject_hooks._impl.BackendUnavailable: Cannot import 'setuptools.build_meta'
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
- [x] 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?
run.bat fails while installing Clip with message pip._vendor.pyproject_hooks._impl.BackendUnavailable: Cannot import 'setuptools.build_meta'. Fresh install of webui.
Steps to reproduce the problem
Download webui, run update.bat, then run.bat
What should have happened?
It should run
What browsers do you use to access the UI ?
No response
Sysinfo
Python 3.10.6 (tags/v3.10.6:9c7b4bd, Aug 1 2022, 21:53:49) [MSC v.1932 64 bit (AMD64)] Version: v1.10.1 Commit hash: 82a973c04367123ae98bd9abdf80d9eda9b910e2
Console logs
Installing clip
Traceback (most recent call last):
File "C:\Users\josep\Downloads\sd.webui\webui\launch.py", line 48, in <module>
main()
File "C:\Users\josep\Downloads\sd.webui\webui\launch.py", line 39, in main
prepare_environment()
File "C:\Users\josep\Downloads\sd.webui\webui\modules\launch_utils.py", line 394, in prepare_environment
run_pip(f"install {clip_package}", "clip")
File "C:\Users\josep\Downloads\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 "C:\Users\josep\Downloads\sd.webui\webui\modules\launch_utils.py", line 116, in run
raise RuntimeError("\n".join(error_bits))
RuntimeError: Couldn't install clip.
Command: "C:\Users\josep\Downloads\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 "C:\Users\josep\Downloads\sd.webui\system\python\lib\site-packages\pip\_internal\cli\base_command.py", line 107, in _run_wrapper
status = _inner_run()
File "C:\Users\josep\Downloads\sd.webui\system\python\lib\site-packages\pip\_internal\cli\base_command.py", line 98, in _inner_run
return self.run(options, args)
File "C:\Users\josep\Downloads\sd.webui\system\python\lib\site-packages\pip\_internal\cli\req_command.py", line 85, in wrapper
return func(self, options, args)
File "C:\Users\josep\Downloads\sd.webui\system\python\lib\site-packages\pip\_internal\commands\install.py", line 388, in run
requirement_set = resolver.resolve(
File "C:\Users\josep\Downloads\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 "C:\Users\josep\Downloads\sd.webui\system\python\lib\site-packages\pip\_internal\resolution\resolvelib\factory.py", line 538, in collect_root_requirements
reqs = list(
File "C:\Users\josep\Downloads\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 "C:\Users\josep\Downloads\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 "C:\Users\josep\Downloads\sd.webui\system\python\lib\site-packages\pip\_internal\resolution\resolvelib\candidates.py", line 318, in __init__
super().__init__(
File "C:\Users\josep\Downloads\sd.webui\system\python\lib\site-packages\pip\_internal\resolution\resolvelib\candidates.py", line 161, in __init__
self.dist = self._prepare()
File "C:\Users\josep\Downloads\sd.webui\system\python\lib\site-packages\pip\_internal\resolution\resolvelib\candidates.py", line 238, in _prepare
dist = self._prepare_distribution()
File "C:\Users\josep\Downloads\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 "C:\Users\josep\Downloads\sd.webui\system\python\lib\site-packages\pip\_internal\operations\prepare.py", line 543, in prepare_linked_requirement
return self._prepare_linked_requirement(req, parallel_builds)
File "C:\Users\josep\Downloads\sd.webui\system\python\lib\site-packages\pip\_internal\operations\prepare.py", line 658, in _prepare_linked_requirement
dist = _get_prepared_distribution(
File "C:\Users\josep\Downloads\sd.webui\system\python\lib\site-packages\pip\_internal\operations\prepare.py", line 77, in _get_prepared_distribution
abstract_dist.prepare_distribution_metadata(
File "C:\Users\josep\Downloads\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 "C:\Users\josep\Downloads\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 "C:\Users\josep\Downloads\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 "C:\Users\josep\Downloads\sd.webui\system\python\lib\site-packages\pip\_internal\utils\misc.py", line 694, in get_requires_for_build_wheel
return super().get_requires_for_build_wheel(config_settings=cs)
File "C:\Users\josep\Downloads\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 "C:\Users\josep\Downloads\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'
Additional information
No response
EDIT: These steps work fine for me on a clean installation:
-
Run
switch-branch-toole.bat(it also updates automatically) and choose3. dev. -
Run
run.batuntil it throws the error. -
After that, go to the folder
sd.webui\system\pythonand run these commands:
python.exe -m pip install clip-anytorch
python.exe -m pip install open-clip-torch
- Finally, run
run.batagain.
After you get the error message, try going to
sd.webui\system\pythonand run these commands:python.exe -m pip install clip-anytorch python.exe -m pip install open-clip-torchThen try again.
Thank you, but even though I was able to instal both within the respective folder, it did not fix the issue on the rerun. I got the exact same error.
I am also facing the same issue
After you get the error message, try going to
sd.webui\system\pythonand run these commands:python.exe -m pip install clip-anytorch python.exe -m pip install open-clip-torchThen try again.
Thank you, but even though I was able to instal both within the respective folder, it did not fix the issue on the rerun. I got the exact same error.
Well, actually my installation has a few extra steps because of the GPU I used. Indeed, just running those commands alone didn't work for me either, so I'll edit my answer to include them as well.
Well, actually my installation has a few extra steps because of the GPU I used. Indeed, just running those commands alone didn't work for me either, so I'll edit my answer to include them as well.
Thanks for the attempted update, but the update didn't work for me either. From the looks of it, it looks like you're trying to pre-install CLiP. You, too, are also using xformers. The pre-installation of the CLiP library didn't help me. The installs in the python folder did complete, however, the application still tries to install that specific zip of the CLiP library.
I've not had time to dig into the code (I'm a dev, but not a python dev) but looking at the errors, it seems like the issue is that there's a hard-dependency on a version of CLiP that no longer exists., After some basic research, I think CLiP has has some major updates and they may have removed the old dependency files. I'm not sure, but I that is an educated guess.
Anyway, if you can think of anything else you might have changed (did you remove that forced dependency version in a config somewhere?) then I'd appreciate one more update. That said, I'm not expecting you to solve the problem, but thanks for trying and sharing.
Thanks for the attempted update, but the update didn't work for me either. From the looks of it, it looks like you're trying to pre-install CLiP. You, too, are also using xformers. The pre-installation of the CLiP library didn't help me. The installs in the python folder did complete, however, the application still tries to install that specific zip of the CLiP library.
I've not had time to dig into the code (I'm a dev, but not a python dev) but looking at the errors, it seems like the issue is that there's a hard-dependency on a version of CLiP that no longer exists., After some basic research, I think CLiP has has some major updates and they may have removed the old dependency files. I'm not sure, but I that is an educated guess.
Anyway, if you can think of anything else you might have changed (did you remove that forced dependency version in a config somewhere?) then I'd appreciate one more update. That said, I'm not expecting you to solve the problem, but thanks for trying and sharing.
I've got Windows 11 and RTX 5070. Outside of the WebUI Python, I have Python 3.10.6 installed manually (with the environment variable added to the PATH). I edited sd.webui\webui\webui-user.bat to have set COMMANDLINE_ARGS=--xformers. Also, when I first had the issue, I fixed it by editing sd.webui\webui\modules\launch_utils.py at lines 377-378:
clip_package = os.environ.get('CLIP_PACKAGE', "https://github.com/openai/CLIP/archive/d50d76daa670286dd6cacf3bcd80b5e4823fc8e1.zip")
openclip_package = os.environ.get('OPENCLIP_PACKAGE', "https://github.com/mlfoundations/open_clip/archive/bb6e834e9c70d9c27d0dc3ecedeebeaeb1ffad6b.zip")
to
clip_package = os.environ.get('CLIP_PACKAGE', "clip-anytorch")
openclip_package = os.environ.get('OPENCLIP_PACKAGE', "open-clip-torch")
But in later tests, I didn’t need to do this anymore.
And that's all I did. I hope it can be of some use to you.
I've got Windows 11 and RTX 5070. Outside of the WebUI Python, I have Python 3.10.6 installed manually (with the environment variable added to the PATH). I edited
sd.webui\webui\webui-user.batto haveset COMMANDLINE_ARGS=--xformers. Also, when I first had the issue, I fixed it by editingsd.webui\webui\modules\launch_utils.pyat lines 377-378:clip_package = os.environ.get('CLIP_PACKAGE', "https://github.com/openai/CLIP/archive/d50d76daa670286dd6cacf3bcd80b5e4823fc8e1.zip") openclip_package = os.environ.get('OPENCLIP_PACKAGE', "https://github.com/mlfoundations/open_clip/archive/bb6e834e9c70d9c27d0dc3ecedeebeaeb1ffad6b.zip")to
clip_package = os.environ.get('CLIP_PACKAGE', "clip-anytorch") openclip_package = os.environ.get('OPENCLIP_PACKAGE', "open-clip-torch")But in later tests, I didn’t need to do this anymore.
And that's all I did. I hope it can be of some use to you.
Excellent. I'll try to give this a change later and report back with my results.
Thanks for the attempted update, but the update didn't work for me either. From the looks of it, it looks like you're trying to pre-install CLiP. You, too, are also using xformers. The pre-installation of the CLiP library didn't help me. The installs in the python folder did complete, however, the application still tries to install that specific zip of the CLiP library. I've not had time to dig into the code (I'm a dev, but not a python dev) but looking at the errors, it seems like the issue is that there's a hard-dependency on a version of CLiP that no longer exists., After some basic research, I think CLiP has has some major updates and they may have removed the old dependency files. I'm not sure, but I that is an educated guess. Anyway, if you can think of anything else you might have changed (did you remove that forced dependency version in a config somewhere?) then I'd appreciate one more update. That said, I'm not expecting you to solve the problem, but thanks for trying and sharing.
I've got Windows 11 and RTX 5070. Outside of the WebUI Python, I have Python 3.10.6 installed manually (with the environment variable added to the PATH). I edited
sd.webui\webui\webui-user.batto haveset COMMANDLINE_ARGS=--xformers. Also, when I first had the issue, I fixed it by editingsd.webui\webui\modules\launch_utils.pyat lines 377-378:clip_package = os.environ.get('CLIP_PACKAGE', "https://github.com/openai/CLIP/archive/d50d76daa670286dd6cacf3bcd80b5e4823fc8e1.zip") openclip_package = os.environ.get('OPENCLIP_PACKAGE', "https://github.com/mlfoundations/open_clip/archive/bb6e834e9c70d9c27d0dc3ecedeebeaeb1ffad6b.zip")to
clip_package = os.environ.get('CLIP_PACKAGE', "clip-anytorch") openclip_package = os.environ.get('OPENCLIP_PACKAGE', "open-clip-torch")But in later tests, I didn’t need to do this anymore.
And that's all I did. I hope it can be of some use to you.
Unfortunately didn't work.
Try running this command:
"python.exe" -m pip install --no-build-isolation -r "[YOUR PATH HERE]\sd.webui\webui\requirements_versions.txt"
Worked for me.
Yeah, the second suggestion didn't work for me either, but I also don't have much time to troubleshoot this. Yes, the application tries to put stuff in the system\python folder but I think I might personally have some other dependency issues.
I've been quite busy and I've only been able to mess with this for 5-10 minutes here and there, but if I can get any serious time to look into this, I'll try to diagnose and fix a patch. Alternatively, someone might have a fork of this and they've updated the related code. It might be worth trying to look into that. I would but, again, that takes time I don't have at the moment.
I've got Windows 11 and RTX 5070. Outside of the WebUI Python, I have Python 3.10.6 installed manually (with the environment variable added to the PATH). I edited
sd.webui\webui\webui-user.batto haveset COMMANDLINE_ARGS=--xformers. Also, when I first had the issue, I fixed it by editingsd.webui\webui\modules\launch_utils.pyat lines 377-378:clip_package = os.environ.get('CLIP_PACKAGE', "https://github.com/openai/CLIP/archive/d50d76daa670286dd6cacf3bcd80b5e4823fc8e1.zip") openclip_package = os.environ.get('OPENCLIP_PACKAGE', "https://github.com/mlfoundations/open_clip/archive/bb6e834e9c70d9c27d0dc3ecedeebeaeb1ffad6b.zip")to
clip_package = os.environ.get('CLIP_PACKAGE', "clip-anytorch") openclip_package = os.environ.get('OPENCLIP_PACKAGE', "open-clip-torch")But in later tests, I didn’t need to do this anymore.
And that's all I did. I hope it can be of some use to you.
Thanks for the help, unfortunately it doesn't change the error, which is (at the end of the trace):
pip._vendor.pyproject_hooks._impl.BackendUnavailable: Cannot import 'setuptools.build_meta'
I also tried some pip commands to force upgrade and purge, but to no avail.
Try running this command:
"python.exe" -m pip install --no-build-isolation -r "[YOUR PATH HERE]\sd.webui\webui\requirements_versions.txt"Worked for me.
Yeah, the "--no-build-isolation" is the key. THX
Win11, NVIDIA 4060 LAPTOP GPU, the problem was that i had multiple versions of python installed on my pc and SD somehow picks the latest version.
I fixed it by following this steps.
update.bat switch-branch-toole.bat option 3, update.bat (just in case)
"run.bat", after it says "creating venv" press "ctrl+c" and go to "webui\venv" and edit "pyvenv.cfg" file (replace with your installed location)
if it still fails try:
if you have any vpn services disable it, disable any dns blockers or rewrites, disable any DPI-Bypassers, disable any proxies. After those check if its fixed
same issue
Try running this command:
"python.exe" -m pip install --no-build-isolation -r "[YOUR PATH HERE]\sd.webui\webui\requirements_versions.txt"Worked for me.
F:\sd.webui\system\python>"python.exe" -m pip install --no-build-isolation -r "F:\sd.webui\webui\requirements_versions.txt"
F:\sd.webui\system\python\python.exe: No module named pip
I first tried
"python.exe" -m pip install --no-build-isolation -r "[YOUR PATH HERE]\sd.webui\webui\requirements_versions.txt"
and it didn't work. But I then tried
python.exe -m pip install clip-anytorch
python.exe -m pip install open-clip-torch
and it got past the issue.
I first tried
"python.exe" -m pip install --no-build-isolation -r "[YOUR PATH HERE]\sd.webui\webui\requirements_versions.txt"and it didn't work. But I then tried
python.exe -m pip install clip-anytorch python.exe -m pip install open-clip-torchand it got past the issue.
I could never get variations of this to work for me. If you don't mind me asking, what's your set? Type of PC, version of python installed, etc?
I could never get variations of this to work for me. If you don't mind me asking, what's your set? Type of PC, version of python installed, etc?
It also did not solve it for me, despite the commands running and outputting (I guess it used system python, which is not what you need as far as I understand) but then I tried the following, which solved it for me:
Open an elevated CMD prompt (not powershell), cd into: [YOUR_PATH]/webui/system/python,
Then running the following command:
python.exe -m pip install --no-build-isolation -r "[YOUR PATH HERE]\sd.webui\webui\requirements_versions.txt"
After this, the run.bat finally started working. :)
It seems like the problem also affect CLIP
RuntimeError: Couldn't install clip.
So I ran your command @pushhyeah and then ran in "[YOUR PATH HERE]\sd.webui\system\python>"
python.exe -m pip install --no-build-isolation https://github.com/openai/CLIP/archive/d50d76daa670286dd6cacf3bcd80b5e4823fc8e1.zip --prefer-binary
It allowed the UI to launch but then I faced a failed download from the stable diffusion model. In addition I got a bit to brave and tried installing the DeOldify extension but had to install manually the missing dependency via your trick. On a second launch, downloading the stable diffusion model worked just fine. But I am actually stuck in an endless loop of conflicting dependency.
pip install open-clip-torch
This full code helped
& "C:\StableDiffusionInstall\stable-diffusion\system\python\python .exe" -m pip install clip-anytorch
& "C:\StableDiffusionInstall\stable-diffusion\system\python\python.exe" -m pip install open-clip-torch
Change the disk for yourself.
after I come to python in the sd.webui files, where do I go then, because there is just more files