AlexxIT / HassWP

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

Support Windows 7 for latest Hass releases #76

Closed veso266 closed 9 months ago

veso266 commented 1 year ago

Hello there, I am trying to buld HassWP myself

like this

python -m pip install homeassistant==2023.5.3
pip install https://github.com/AlexxIT/HassWP/archive/master.zip
mkdir config
python -m hass_win -c config -v

I installed latest WinPython from here: https://sourceforge.net/projects/winpython/files/WinPython_3.10/3.10.9.0/Winpython64-3.10.9.0.exe/download

It runs fine Everything installs fine,

when I run python -m pip install homeassistant==2023.5.3 (it does complain for some reason)

ERROR: pip's dependency resolver does not currently take into account all the pa
ckages that are installed. This behaviour is the source of the following depende
ncy conflicts.
great-expectations 0.14.11 requires cryptography<4.0.0,>=3.2, but you have crypt
ography 40.0.2 which is incompatible.

but after runing python -m pip install homeassistant==2023.5.3 again everything is fine

but when I try to run hss I get:

Traceback (most recent call last):
  File "L:\HomeAsistant Patch\WPy64-31090\python-3.10.9.amd64\lib\runpy.py", line 196, in _run_module_as_main
    return _run_code(code, main_globals, None,
  File "L:\HomeAsistant Patch\WPy64-31090\python-3.10.9.amd64\lib\runpy.py", line 86, in _run_code
    exec(code, run_globals)
  File "L:\HomeAsistant Patch\WPy64-31090\python-3.10.9.amd64\lib\site-packages\hass_win\__main__.py", line 10, in <module>
    from homeassistant import __main__, const, setup
  File "L:\HomeAsistant Patch\WPy64-31090\python-3.10.9.amd64\lib\site-packages\homeassistant\setup.py", line 13, in <module>
    from . import config as conf_util, core, loader, requirements
  File "L:\HomeAsistant Patch\WPy64-31090\python-3.10.9.amd64\lib\site-packages\homeassistant\config.py", line 56, in <module>
    from .helpers import (
  File "L:\HomeAsistant Patch\WPy64-31090\python-3.10.9.amd64\lib\site-packages\homeassistant\helpers\config_validation.py", line 101, in <module>
    from . import script_variables as script_variables_helper, template as template_helper
  File "L:\HomeAsistant Patch\WPy64-31090\python-3.10.9.amd64\lib\site-packages\homeassistant\helpers\script_variables.py", line 9, in <module>
    from . import template
  File "L:\HomeAsistant Patch\WPy64-31090\python-3.10.9.amd64\lib\site-packages\homeassistant\helpers\template.py", line 44, in <module>
    from lru import LRU  # pylint: disable=no-name-in-module
ImportError: cannot import name 'LRU' from 'lru' (L:\HomeAsistant Patch\WPy64-31090\python-3.10.9.amd64\lib\site-packages\lru\__init__.py)

Not sure what the problem might be

Thanks for Anwsering and Best Regards

AlexxIT commented 1 year ago

I don't know what exact problem in your case. And I don't remember if I had something similar. Maybe you have another python build. Maybe you don't have some developer environment in your system (Microsoft Visual Studio, etc.) You can try to compare lru library from HassWP archive vs your version.

veso266 commented 1 year ago

Well, the reason I wanted to build this myself is that I wanted to run hass on Windows 7 (since python310 usualy does not work there (if you are not creative))

I later discovered that if I just download your release, put the required dll inside portable python dir everything runs

So yea, if anyone wants to use this on windows 7, just download the release from here, add the missing dll and you are back in buisness :smile:

AlexxIT commented 1 year ago

Wow. Nice info. I'll check it myself.

Vitch612 commented 1 year ago

@veso266 thank you so much for sharing this. I just tested on windows 7x64 it and it works great. I will try to migrate my database and HA config from my current v2021.12.10 instance to this latest one. and comment back here if anything special is needed. Turns out that database migration is not needed. simply pointing to the old db (even though there are structural changes) just works but generates a lot of errors in logs

AlexxIT commented 9 months ago

Thanks, supported https://github.com/AlexxIT/HassWP/releases/tag/v2023.12.4

Vitch612 commented 5 months ago

v2023.12.4 - 2024-01-01 is the last release that can run on Windows 7. The reason is that the python hack to allow it to run on windows 7 only works until python 3.11, starting with 3.12 there is an additional requirement which prevents it from running. The error says: The procedure entry point PssQuerySnapshot could not be located the dynamic link library KERNEL32.dll Meaning unless a way is found to replace or patch KERNEL32.dll on windows 7 to contain the needed functions (might be more than one and not likely to happen as this seems to involve new functionality that is not present in older windows) or a way is found to run the latest HASS using python 3.11 (less unrealistic than patching kernel32 but also involves a substantial amount of work which is not likely to be undertaken to patch each new hass release and is ultimately pointless) there will be no more windows 7 support after version 2023.12.4

veso266 commented 5 months ago

Yea, after python 3.11 some people decided to get rid of windows 7 specific code: https://github.com/python/cpython/commit/938e36f824c5f834d6b77d47942ad81edd5491d0

that someone spent their hard and sould writing

Python 3.12 does work on windows 7 btw (good people are still fighting): https://github.com/adang1345/PythonWin7

Just need to find a way to make it (python) portable

Vitch612 commented 5 months ago

@veso266 many thanks for sharing this windows 7 python initiative. I have downloaded their 3.12.3 embedded version and replaced in the latest hass (2024.4.3) the python executables and dlls with those from that embedded version and everything seems to be working fine (I did not do extensive testing) but my hass log is all green after adding a sonoflan integration with some devices. automations not tested.