Addons not working due to Fatal Python error

Hey there,

since a few days ago - I think with the current update, some of my addons do not work anymore (especially the standard file editor, or samba share). It will create these error logs:

s6-rc: info: service s6rc-oneshot-runner: starting
s6-rc: info: service s6rc-oneshot-runner successfully started
s6-rc: info: service fix-attrs: starting
s6-rc: info: service fix-attrs successfully started
s6-rc: info: service legacy-cont-init: starting
s6-rc: info: service legacy-cont-init successfully started
s6-rc: info: service configurator: starting
s6-rc: info: service configurator successfully started
s6-rc: info: service legacy-services: starting
Error relocating /lib/libcrypto.so.3: unsupported relocation type 15
s6-rc: info: service legacy-services successfully started
[14:51:34] ERROR: Something went wrong contacting the API
jq: error (at <stdin>:1): Cannot iterate over null (null)
Python path configuration:
  PYTHONHOME = (not set)
  PYTHONPATH = (not set)
  program name = '/usr/bin/python3'
  isolated = 0
  environment = 1
  user site = 1
  import site = 1
  sys._base_executable = '/usr/bin/python3'
  sys.base_prefix = '/usr'
  sys.base_exec_prefix = '/usr'
  sys.platlibdir = 'lib'
  sys.executable = '/usr/bin/python3'
  sys.prefix = '/usr'
  sys.exec_prefix = '/usr'
  sys.path = [
    '/usr/lib/python310.zip',
    '/usr/lib/python3.10',
    '/usr/lib/python3.10/lib-dynload',
  ]
Fatal Python error: init_fs_encoding: failed to get the Python codec of the filesystem encoding
Python runtime state: core initialized
Traceback (most recent call last):
  File "/usr/lib/python3.10/encodings/__init__.py", line 31, in <module>
ValueError: source code string cannot contain null bytes
[14:51:34] INFO: Service exited with code 1 (by signal 0)
s6-rc: info: service legacy-services: stopping
s6-rc: info: service legacy-services successfully stopped
s6-rc: info: service configurator: stopping
s6-rc: info: service configurator successfully stopped
s6-rc: info: service legacy-cont-init: stopping
s6-rc: info: service legacy-cont-init successfully stopped
s6-rc: info: service fix-attrs: stopping
s6-rc: info: service fix-attrs successfully stopped
s6-rc: info: service s6rc-oneshot-runner: stopping
s6-rc: info: service s6rc-oneshot-runner successfully stopped

I didn’t change anything - I don’t understand why it has not set the python variables anymore.
I’m running Home Assistant OS on a Raspberry Pi 4:
Home Assistant 2023.10.5
Supervisor 2023.10.0
Operating System 11.0
Frontend 20231005.0 - latest

Any advice here?

Thanks!

Python 3.10 is no longer supported since Home Assistant 2023.8.0
Something went wrong when you updated, Python 3.11 should be used instead

Armin

How do I get Python 3.11?

Depends on your type of installation

you wrote that the errors come from AddOn’s? Are all the AddOn’s up to date?
You restarted the whole system after the update to OS 11.0?

Home Assistant OS on a Raspberry Pi 4 via SD Card
System was restarted several times (real restarts, not only restart of Home Assistant)
With OS I actually have no clue on how to update to/ get Python 3.11

All addons are updated and on the latest version

Sorry, no idea then… it should automatically update with the OS I guess, but I’m using a different type of installation ( Core installation on a standard debian bookworm)

Armin

i would go to your console, or Terminal, and run “os update” , then “core update”

as Armin mentioned, there is something not right in the error your get “python path configuration”

Run above commands in a terminal and see whether this will fix you problem

Edited: the files/paths still exist, i just checked (in right container :slight_smile: )

However this

ValueError: source code string cannot contain null bytes

is an “import codecs” ( line 31 ) so maybe this “import” went wrong, or you have issues with your SD card

no - it is not working. Even with the current update of OS and Home Asssistant it was fixed.
Re-installed the addon itself again, still no luck.

What are my options besides going the nuclear way (complete reinstall)?

Install on SSD (Not SD), after install you could try with a restore, from a “working” backup ( then you still have your “half-working-SD-card-installation” to return back to )

PS: Backup files is basically .tar files, you can open them in most unzip/untar programs, and copy/paste, relevant parts/configs/files

I have the same issue on HASS OS since about 2 month now. Python packages from dependencies cannot be installed anymore.

Here an example for the waste_collection_schedule add on:

Unable to install package icalevents: Traceback (most recent call last): File "<frozen runpy>", line 198, in _run_module_as_main File "<frozen runpy>", line 88, in _run_code File "/usr/local/lib/python3.12/site-packages/pip/__main__.py", line 22, in <module> from pip._internal.cli.main import main as _main File "/usr/local/lib/python3.12/site-packages/pip/_internal/cli/main.py", line 10, in <module> from pip._internal.cli.autocompletion import autocomplete File "/usr/local/lib/python3.12/site-packages/pip/_internal/cli/autocompletion.py", line 10, in <module> from pip._internal.cli.main_parser import create_main_parser File "/usr/local/lib/python3.12/site-packages/pip/_internal/cli/main_parser.py", line 9, in <module> from pip._internal.build_env import get_runnable_pip File "/usr/local/lib/python3.12/site-packages/pip/_internal/build_env.py", line 15, in <module> from pip._vendor.packaging.requirements import Requirement SyntaxError: source code string cannot contain null bytes

This is plain HASS OS. It’s said to be the most stable but seems to have issues so far.