Search code examples
pythonencodingpython-3.10stable-diffusion

Error Initalizing Stable diffusion with python 3.10.6. 'str' object has no attribute 'isascii'


I'm trying to set Up Stable Diffusion 1.5 from GIT https://github.com/AUTOMATIC1111/stable-diffusion-webui. I've followed a tutorial https://www.youtube.com/watch?v=ycQJDJ-qNI8&t=0s.

To avoid problems with multiple python versions I've removed older Python version and installed only Python 3.10.6, then only 3.10.9, but I receive the same error with both versions.

When I call the web-user.bat to Initialize. The bat calls webui.bat and I receive this error:

Python 3.10.9
venv "D:\Stable Diffusion\stable-diffusion-webui\venv\Scripts\Python.exe"
Fatal Python error: Py_Initialize: unable to load the file system codec
Traceback (most recent call last):
  File "C:\Users\XX\AppData\Local\Programs\Python\Python310\lib\encodings\__init__.py", line 85, in search_function
  File "C:\Users\XX\AppData\Local\Programs\Python\Python310\lib\encodings\__init__.py", line 64, in normalize_encoding
AttributeError: 'str' object has no attribute 'isascii'
Premere un tasto per continuare . . .

I've seen this error is due to using an old python version, but I'm using the 3.10.

Thanks


Solution

  • The problem was I had a old version of Python when using web-user.bat for the first time. When You run the web-user.bat the first time it creates a venv folder.

    The solution was to remove manually the venv folder from my Stable Diffusion folder and use again the web-user.bat.