AlexxIT / HassWP

Portable version of Home Assistant for Windows (no need to install)
https://github.com/AlexxIT/Blog
632 stars 76 forks source link

Cannot start HassWP: ZipImportError: can't find module 'encodings'` #65

Open pedjas opened 1 year ago

pedjas commented 1 year ago

I went to the procedure, downloaded zip file, unpacked and run it. This is what I got:

` D:\HASS\HassWP_2022.8.6>hass.cmd Python path configuration: PYTHONHOME = 'C:\PMService_python' PYTHONPATH = 'C:\PMService_python;C:\PMService_python\python38.zip' program name = 'python.exe' isolated = 0 environment = 1 user site = 1 import site = 1 sys._base_executable = 'D:\HASS\HassWP_2022.8.6\python-3.9.10.amd64\python.exe' sys.base_prefix = 'C:\PMService\_python' sys.base_exec_prefix = 'C:\PMService\_python\' sys.platlibdir = 'lib' sys.executable = 'D:\HASS\HassWP_2022.8.6\python-3.9.10.amd64\python.exe' sys.prefix = 'C:\PMService\_python' sys.exec_prefix = 'C:\PMService\_python' sys.path = [ 'C:\PMService\_python', 'C:\PMService\_python\python38.zip', 'D:\HASS\HassWP_2022.8.6\python-3.9.10.amd64\python39.zip', 'C:\PMService\_python\DLLs', 'C:\PMService\_python\lib', 'D:\HASS\HassWP_2022.8.6\python-3.9.10.amd64', ] 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 "", line 241, in load_module File "", line 721, in _get_module_code zipimport.ZipImportError: can't find module 'encodings'

`

I run this on Windows 10.

My guess is that, as I have other application on the same PC that uses it's own instance of Python, which is set in environment (PYTHONHOME and PYTHONPATH), there is conflict and HassWP, tries to load libraries form the wrong place.

When I remove PYTHONHOME and PYTHONPATH, HassWP runs properly. But I cannot leave them removed as other application requires them.

I guess it is possible to configure HassWP to be independent of other Python installations that exist on the same PC. I am not familiar with Python platform so I cannot find how to resolve this.