stable-diffusion-webui
stable-diffusion-webui copied to clipboard
[Bug]: ModuleNotFoundError font_roboto
Is there an existing issue for this?
- [X] I have searched the existing issues and checked the recent builds/commits
What happened?
I tried to install automatic1111 webui with git clone. So i can update it automatically. Then when it tries to launch the web ui . Then it spit back this error. ModuleNotFoundError: No module named 'font_roboto'.
Steps to reproduce the problem
Install using git clone
What should have happened?
To launch the web ui
Commit where the problem happens
Commit hash: 804d9fb83d0c63ca3acd36378707ce47b8f12599
What platforms do you use to access UI ?
Windows
What browsers do you use to access the UI ?
Mozilla Firefox
Command Line Arguments
set COMMANDLINE_ARGS=
git pull
Additional information, context and logs
Traceback (most recent call last):
File "C:\Users*\Downloads\test\stable-diffusion-webui\launch.py", line 252, in
I get the same issue, after trying every possible solution I've seen on this repo and through Discord:
- Deleting the venv folder and re-running webui-user.bat --> Same error
- Renaming font-roboto to font_roboto in both requirements text files and installing them manually via pip install --> Same error even though the program seems to be pointing "correctly" to my python folder --> see image
- Replacing any [] or strange characters from the SD folder path --> Same error, see my image
@AUTOMATIC1111 seems to have anticipated this issue and fixed it under https://github.com/AUTOMATIC1111/stable-diffusion-webui/pull/197, but the error persists.
Is there a way of simply... using another font entirely? Like something native to Windows, instead of roboto?
Not sure if this will work for your specific issue here, but I suspect that it possibly will:
You can modify your
run_webui_mac.sh
to add a line that tries to install the required dependencies withpip install -r requirements.txt
each time it starts, after it pulls the latest code. This would probably make a sensible default, and is fairly quick to run, so it might be worth someone telling the original author to include it in their setup script to avoid this sort of error for end users in future:Here is what mine looks like:
#!/usr/bin/env bash -l pyenv local anaconda3-2022.05 # This should not be needed since it's configured during installation, but might as well have it here. conda env config vars set PYTORCH_ENABLE_MPS_FALLBACK=1 # Activate conda environment conda activate web-ui # Pull the latest changes from the repo git pull --rebase + # Update the dependencies if needed + pip install -r requirements.txt # Run the web ui python webui.py --deepdanbooru --precision full --no-half --use-cpu Interrogate GFPGAN CodeFormer $@ # Deactivate conda environment conda deactivate
Originally posted by @0xdevalias in https://github.com/AUTOMATIC1111/stable-diffusion-webui/issues/4109#issuecomment-1304747007
For the others who said that
pip install -r requirements.txt
didn't work for them, or finding that despitepip install
ing the individual requirements they still don't seem to 'be there', it might be an issue with yourconda
environment, and whichpip
is being used. Sometimes the version you're calling doesn't actually install the packages to the correct place, and so they can't be found later.I have a new theory for you, based on this StackOverflow:
- https://stackoverflow.com/questions/41060382/using-pip-to-install-packages-to-anaconda-environment
What do you see when you activate your conda environment, then run
which -a pip
?If it's only something like:
/opt/conda/bin/pip
And not something like:
/opt/conda/envs/web-ui/bin/pip /opt/conda/bin/pip
Then you can likely fix it by either doing a
conda install pip
then usingpip
as normal, or usingpython -m pip install FOO
instead of usingpip
directly.Originally posted by @0xdevalias in https://github.com/AUTOMATIC1111/stable-diffusion-webui/issues/4109#issuecomment-1308357941
I did a
conda install pip
and then usedpython -m
, it looked like it wasn't going to work but then I changed my run script a tiny bit,Curious, what made you think it wasn't going to work? And what was the specific change to the run script that made it work for you? Was it using
requirements_versions.txt
rather thanrequirements.txt
?python -m pip install -r requirements_versions.txt
Originally posted by @0xdevalias in https://github.com/AUTOMATIC1111/stable-diffusion-webui/issues/4109#issuecomment-1309356932
Hopefully the above helps people who are still running into this issue 🖤
Originally posted by @0xdevalias in https://github.com/AUTOMATIC1111/stable-diffusion-webui/issues/4061#issuecomment-1314398808
Ok wow... So many questions. This is likely me not being adept at this at all, but I don't have any conda environment... I thought SD installed a virtual environment every time it ran? As a result I can't try any of the solutions above as they all require me to activate a conda environment first.
I don't have miniconda/Anaconda installed. Should I use them instead or stick with the plain old cmd? For the better part of the last 2 months, I've been using Miniconda and I had to uninstall it because its python version was 3.9, whereas my system's python is 3.10. What's the best solution?
Every other troubleshooting attemps I've tried so far has been through cmd directly. This is also where I tried python -m pip install requirements_versions.txt like mentioned above, but with no success.
So the exact specifics of those above solutions were written with macOS users in mind. It looks like you're running on windows, which I don't have any direct experience with; but I suspect that where conda
is mentioned you can probably substitute it for the equivalent virtual environment commands.
This is also where I tried
python -m pip install requirements_versions.txt
like mentioned above, but with no success.
Did you try that after doing whatever was needed to activate the virtual environment?
Ok, I think I understand what you mean:
This is just telling me that the package already exists in my files... which I already knew:
Error still there... Am I missing something?
Did you try that after doing whatever was needed to activate the virtual environment?
Looking at webui.sh
, this is how it seems to activate the venv:
- https://github.com/AUTOMATIC1111/stable-diffusion-webui/blob/master/webui.sh#L126-L135
source "${venv_dir}"/bin/activate
I fix it doing that:
Go to the venv/Lib/site-packages
, and delete all folders with roboto
or font-roboto
or font_roboto
in the name, after run this command in the stable-diffusion-webui folder (the folder that you clone) to enter in the python venv:
OBS: You need to run these commands on the directory folder in the terminal.
(Windows)
$ venv\Scripts\activate
After doing that, run this command:
$ pip install font-roboto
And fix-it, you can run:
$ python launch.py
My friend, you are a LIFESAVER! That did it! I kept trying to install font-roboto without activating the virtual environment... Thank you!!!
I'm having this problem too. Complicating matters, I have very little Windows experience and even less Linux so Jaovito's solution is very hard for me to recreate. I found 1 "font-roboto" folder in Windows which I hand deleted. When he says to run these commands in the directory folder, I'm not sure if this is the Windows terminal or the Python terminal.
I tried "cd C:\Users\mynamehere\Documents\SDlocal\venv\lib\site-packages\pkg_resources" in the python terminal to get to where I think this package is supposed to live, but any command I issue in Python results in an error. I'm not sure when / how I get to the point I'm ready to issue the next commands he suggests-
$ venv\Scripts\activate $ pip install font-roboto $ python launch.py
thanks for any instructions you can offer.
For anyone still having this issue, Make sure you upgrade pip inside the venv. For some reason the existing version doesn't install font_roboto correctly
So this doesn't work for me. it's still the same error
Ok So I fixed it (if you're still having problems):
- Open a administrator PS anywhere, and execute:
Set-ExecutionPolicy Unrestricted
and close it. - Open a PS terminal in stable-diffusion-webui root (the folder that you cloned).
- Goto
venv/Lib/site-packages
and remove every folder namedroboto
,font-roboto
andfonts
. - Execute:
venv\Scripts\activate
. - Execute
pip install pip --upgrade
to update the pip. - Goto
%appdata%\local\pip
and remove thecache
folder. - Go back to PS terminal that you ran
venv\Scripts\activate
in. - Execute
pip install font-roboto
orpip install font-roboto --upgrade
. - You should be done, Go back to the root directory and run WebUi-user.bat and Enjoy!
(Special thanks to @jaovito for helping in the comments)
Ok So I fixed it (if you're still having problems):
- Open a administrator PS anywhere, and execute:
Set-ExecutionPolicy Unrestricted
and close it.- Open a PS terminal in stable-diffusion-webui root (the folder that you cloned).
- Goto
venv/Lib/site-packages
and remove every folder namedroboto
,font-roboto
andfonts
.- Execute:
venv\Scripts\activate
.- Execute
pip install pip --upgrade
to update the pip.- Goto
%appdata%\local\pip
and remove thecache
folder.- Go back to PS terminal that you ran
venv\Scripts\activate
in.- Execute
pip install font-roboto
orpip install font-roboto --upgrade
.- You should be done, Go back to the root directory and run WebUi-user.bat and Enjoy!
(Special thanks to @jaovito for helping in the comments)
Where would I find %appdata%\local\pip
Ok So I fixed it (if you're still having problems):
- Open a administrator PS anywhere, and execute:
Set-ExecutionPolicy Unrestricted
and close it.- Open a PS terminal in stable-diffusion-webui root (the folder that you cloned).
- Goto
venv/Lib/site-packages
and remove every folder namedroboto
,font-roboto
andfonts
.- Execute:
venv\Scripts\activate
.- Execute
pip install pip --upgrade
to update the pip.- Goto
%appdata%\local\pip
and remove thecache
folder.- Go back to PS terminal that you ran
venv\Scripts\activate
in.- Execute
pip install font-roboto
orpip install font-roboto --upgrade
.- You should be done, Go back to the root directory and run WebUi-user.bat and Enjoy!
(Special thanks to @jaovito for helping in the comments)
how do i go to venv/Lib/site-packages
Where would I find %appdata%\local\pip
Just put that text in your Windows Explorer path bar
how do i go to venv/Lib/site-packages
Goto where you cloned the repo, and run it once, after that, there should be a folder, called "venv" enter it and continue with my tutorial
Ok So I fixed it (if you're still having problems):
- Open a administrator PS anywhere, and execute:
Set-ExecutionPolicy Unrestricted
and close it.- Open a PS terminal in stable-diffusion-webui root (the folder that you cloned).
- Goto
venv/Lib/site-packages
and remove every folder namedroboto
,font-roboto
andfonts
.- Execute:
venv\Scripts\activate
.- Execute
pip install pip --upgrade
to update the pip.- Goto
%appdata%\local\pip
and remove thecache
folder.- Go back to PS terminal that you ran
venv\Scripts\activate
in.- Execute
pip install font-roboto
orpip install font-roboto --upgrade
.- You should be done, Go back to the root directory and run WebUi-user.bat and Enjoy!
(Special thanks to @jaovito for helping in the comments)
executing will open up my pc to malicious scripts , can i turn it back on when im done? also how do i open a terminal in the root folder , to me when i copy the address it says C:\Users\mange\stable-diffusion-webui : The term 'C:\Users\mange\stable-diffusion-webui' is not recognized as the name of a cmdlet, function, script file, or operable program. Check the spelling of the name, or if a path was included, verify that the path is correct and try again.
Yes
Ok So I fixed it (if you're still having problems):
- Open a administrator PS anywhere, and execute:
Set-ExecutionPolicy Unrestricted
and close it.- Open a PS terminal in stable-diffusion-webui root (the folder that you cloned).
- Goto
venv/Lib/site-packages
and remove every folder namedroboto
,font-roboto
andfonts
.- Execute:
venv\Scripts\activate
.- Execute
pip install pip --upgrade
to update the pip.- Goto
%appdata%\local\pip
and remove thecache
folder.- Go back to PS terminal that you ran
venv\Scripts\activate
in.- Execute
pip install font-roboto
orpip install font-roboto --upgrade
.- You should be done, Go back to the root directory and run WebUi-user.bat and Enjoy!
(Special thanks to @jaovito for helping in the comments)
executing will open up my pc to malicious scripts , can i turn it back on when im done? also how do i open a terminal in the root folder , to me when i copy the address it says C:\Users\mange\stable-diffusion-webui : The term 'C:\Users\mange\stable-diffusion-webui' is not recognized as the name of a cmdlet, function, script file, or operable program. Check the spelling of the name, or if a path was included, verify that the path is correct and try again.
Yes you can turn execution policy back on when you're done.
Open root folder, copy it's path. Open powershell, write cd "your path"
(include those quotes)