krita-ai-diffusion icon indicating copy to clipboard operation
krita-ai-diffusion copied to clipboard

No non-ASCII characters in the path but still UnicodeDecodeError: 'utf-8' codec can't decode byte Oxb0 in position 37: invalid start byte

Open hyuri opened this issue 1 year ago • 5 comments

Hey, it seems I'm getting the same error as here: #370 but I have no non-ASCII characters in my path. The path points to a folder in a shared network volume.

Any idea what might be happening?

image

Error: Error during installation: Fatal Python error: init_import_site: Failed to import the site module Python runtime state: initialized Traceback (most recent call last): File " Library/Developer/CommandLineTools/Library/Frameworks/Python3.framework/Versions/ 3.9/lib/python3.9/site.py", line 621, in main() File "/Library/Developer/ CommandLineTools/Library/Frameworks/Python3.framework/Versions/3.9/lib/python3.9/ site.py", line 604, in main known_paths = venv (known_paths) File "/Library/Developer/ CommandLineTools/Library/Frameworks/Python3.framework/Versions/3.9/lib/python3.9/ site.py", line 536, in venv addsitepackages(known_paths, [sys.prefix]) File "/Library/ Developer/CommandLineTools/Library/Frameworks/Python3.framework/Versions/3.9/lib/ python3.9/site.py", line 391, in addsitepackages addsitedir (sitedir, known_paths) File "/ Library/Developer/CommandLineTools/Library/Frameworks/Python3.framework/Versions/ 3.9/lib/python3.9/site.py", line 208, in addsitedir addpackage(sitedir, name, known_paths) File "/Library/Developer/CommandLineTools/Library/Frameworks/ Python3.framework/Versions/3.9/lib/python3.9/site.py", line 164, in addpackage for n, line in enumerate (f): File "/Library/Developer/CommandLineTools/Library/Frameworks/ Python3.framework/Versions/3.9/lib/python3.9/codecs.py", line 322, in decode (result, consumed) = self. _buffer_decode (data, self.errors, final) UnicodeDecodeError: 'utf-8' codec can't decode byte Oxb0 in position 37: invalid start byte

I had deleted the client.log file and when running the Install again it didn't generate another client.log, but next time I opened Krita, client.log did re-generate and I noticed the following in it:

2024-09-05 17:36:08,174 WARNING Not a valid language file: /Users/user/Library/Application Support/krita/pykrita/ai_diffusion/language/tr.json: 'ascii' codec can't decode byte 0xc3 in position 30: ordinal not in range(128)
2024-09-05 17:36:08,174 WARNING Not a valid language file: /Users/user/Library/Application Support/krita/pykrita/ai_diffusion/language/ja.json: 'ascii' codec can't decode byte 0xe6 in position 29: ordinal not in range(128)
2024-09-05 17:36:08,174 WARNING Not a valid language file: /Users/user/Library/Application Support/krita/pykrita/ai_diffusion/language/ru.json: 'ascii' codec can't decode byte 0xd0 in position 29: ordinal not in range(128)
2024-09-05 17:36:08,175 WARNING Not a valid language file: /Users/user/Library/Application Support/krita/pykrita/ai_diffusion/language/zh-cn.json: 'ascii' codec can't decode byte 0xe7 in position 32: ordinal not in range(128)
2024-09-05 17:36:08,175 WARNING Not a valid language file: /Users/user/Library/Application Support/krita/pykrita/ai_diffusion/language/fr.json: 'ascii' codec can't decode byte 0xc3 in position 33: ordinal not in range(128)
2024-09-05 17:36:08,175 WARNING Not a valid language file: /Users/user/Library/Application Support/krita/pykrita/ai_diffusion/language/pt-br.json: 'ascii' codec can't decode byte 0xc3 in position 39: ordinal not in range(128)
2024-09-05 17:36:08,175 WARNING Not a valid language file: /Users/user/Library/Application Support/krita/pykrita/ai_diffusion/language/ko.json: 'ascii' codec can't decode byte 0xed in position 29: ordinal not in range(128)
2024-09-05 17:36:08,175 WARNING Not a valid language file: /Users/user/Library/Application Support/krita/pykrita/ai_diffusion/language/zh-tw.json: 'ascii' codec can't decode byte 0xe6 in position 32: ordinal not in range(128)
2024-09-05 17:36:08,175 WARNING Not a valid language file: /Users/user/Library/Application Support/krita/pykrita/ai_diffusion/language/th.json: 'ascii' codec can't decode byte 0xe0 in position 29: ordinal not in range(128)
2024-09-05 17:36:08,175 WARNING Not a valid language file: /Users/user/Library/Application Support/krita/pykrita/ai_diffusion/language/es.json: 'ascii' codec can't decode byte 0xc3 in position 33: ordinal not in range(128)
2024-09-05 17:36:08,258 ERROR Error setting SSL_CERT_FILE on MacOS: No module named 'certifi'
2024-09-05 17:36:08,263 INFO Loaded 11 sampler presets from /Users/user/Library/Application Support/krita/pykrita/ai_diffusion/presets/samplers.json
2024-09-05 17:36:08,275 INFO Extension initialized, Version: 1.23.0, Python: 3.10.7 (main, Apr 17 2024, 20:18:29) [Clang 15.0.0 (clang-1500.3.9.4)]
2024-09-05 17:36:08,275 INFO Loading settings from /Users/user/Library/Application Support/krita/ai_diffusion/settings.json

System

  • Krita AI Diffusion version: 1.23
  • Krita version: 5.2.3
  • macOS version: 13.6.9

hyuri avatar Sep 05 '24 18:09 hyuri

I'm not sure about the initial error, it looks like Python doesn't even manage to start, so no code from the plugin gets to run. Maybe something is wrong with the system Python install.

The "WARNING Not a valid language file" I can probably fix, although I'm also not quite sure why they are there in the first place, utf-8 should be the default...

Acly avatar Sep 07 '24 12:09 Acly

I'm not sure about the initial error, it looks like Python doesn't even manage to start, so no code from the plugin gets to run. Maybe something is wrong with the system Python install.

Hmm... I have 3 versions of Python installed: 3.9, 3.11 and 3.12. If I run python3 --version, it shows 3.12, but Krita AI Diffusion seems to be using Python 3.9.

Is there a way to force Krita AI Diffusion to use Python 3.11? Maybe that could help...

hyuri avatar Sep 07 '24 16:09 hyuri

The plugin prefers python3.11 if it can find it. No idea how to make this visible on Mac though, it seems like it's different for terminal and other apps?

Acly avatar Sep 07 '24 18:09 Acly

The plugin prefers python3.11 if it can find it. No idea how to make this visible on Mac though, it seems like it's different for terminal and other apps?

Are you targeting /usr/bin/python3, by any chance? That path points to Python 3.9 on my system.

3.12 lives in /opt/homebrew/bin/python3 3.11 lives in /opt/homebrew/bin/python3.11

hyuri avatar Sep 07 '24 19:09 hyuri

It just searches for the python3.11 command, not any particular path. If it is available (eg by being in the PATH environment variable) it will be used, otherwise it falls back to python3.10, python3, python...

Acly avatar Sep 07 '24 21:09 Acly