Python >=3.5.3 on Synology

Congratulations! I’d also upgraded to 0.82 and everything’s working fine. :slight_smile:

1 Like

From yesterday there is a new update for the python3 package from the synocommunity repo. The new version of supported python is 3.5.6-8 with added modules for sqlite3 and lxml. Later todat I’ll try to install Home-Assistant with it.

Is it possible to install the latest HomeAssistant (0.83.0 and later) with python 3.5.6.8?
Anyone has a detailed step by step instruction how to do this on an older Synology (DS212)?

HA only needs python3>3.5.2 I think

Did you manage to get python 3.5.6-8 to work on Synology and install latest HA?

I went to this thread because i’m having your same issue, can you explain what procedure i have to follow to install home assistant on synology ds215j?

yesterday i followed this guide https://www.home-assistant.io/docs/installation/synology/ without success, the process wont start.

after i’ve found this guide Home Assistant won't start on Synology DS115j NAS that tell’s to downgrade pip with sudo python3 -m pip install pip==9.0.1 process started but no web page access.

after tryed this modification https://www.home-assistant.io/docs/ecosystem/synology/ but still no web page access.

what i have to do now? i uninstall everything and use the package in this page?
http://spk.chickenandporn.com/?arch=armada375#
i have to mantain the user and the folder or start from zero?

thank you

Why not use docker on Synology?

ds215j cannot run docker

Ah ok, and virtual machines? Some Synology can do that, than you can install Ubuntu or raspian or something

the J series is an economical version that have marvell armada CPU, also virtual machines is not working

That’s maybe then the reason that you have that errors? Maybe the CPU just can’t handle it?

Hi @holly7787 – I think we need to revisit the home-assistant instructions.

Essentially, your install path should look like:

  1. choose to install Home Assistant
  2. I hope it demands python3 upgrade for you to approve
  3. connect to http://your.nas:8123/ to configure

… ie difficult to make it easier, so it’s consistent to any other native HA installation.

First things first: my test method for python3 updates looks something like:

  1. logged in as a non-root user that has sudo on your NAS via ssh
  2. either:
    1. sudo synopkg install /home/local/file/python3-3.6.8-9.spk (or similar filename); or
    2. install by adding “spk.chickenandporn.com” as a source and install via the DSM GUI
  3. /var/packages/python3/target/usr/local/bin/python3 -c ‘import _ctypes; import lxml; import sqlite3; print (“x”)’

The result of command in step 2 is a simple “x” printed; if instead you see import failures, I need to fix that.

Let’s test this much on your system using python3-3.5.6 or -3.6.8, whichever you prefer. The PR for python3-3.6.8-9 is still being improved so it may be most predictable to use python3-3.5.6-8 for now. If this succeeds, then we can progress to trying a native HA install.

If you prefer, my direct email is “allanc” at “chickenandporn” dot-com. (splitting for the simplest of parserbots). Let’s make this go! :slight_smile:

ok, i get it working :grin:

i think the procedure i followed yesterday was correct, i was missing something in the configuration.yaml.
i can give this update:

using the python3 from the https://synocommunity.com/ the installation folder will be different:

in the hass-daemon file:

not

PYTHON_DIR="/volume1/@appstore/py3k/usr/local/bin

but

PYTHON_DIR="/volume1/@appstore/python3/bin

in the ssh client, i used PuTTY

not

cd /volume1/@appstore/py3k/usr/local/bin

but

cd /volume1/@appstore/python3/bin

not

ln -s /volume1/@appstore/py3k/usr/local/bin/python3 python3

but

ln -s /volume1/@appstore/python3/bin/python3 python3

not

ln -s /volume1/@appstore/py3k/usr/local/lib/python3.5/site-packages/homeassistant homeassistant

but

ln -s /volume1/@appstore/python3/lib/python3.5/site-packages/homeassistant homeassistant

also i have followed the hint

alternatively you can also create a “Shared Folder” via Synology WebUI (e.g., via “File Station”) - this has the advantage that the folder is visible via “File Station”.

so i didn’t have to do the chmod and chown excpet for make the hass-daemon file executable

1 Like

last working version on my Synology DS215J NAS is the 75.3, after this i start getting the problem for

failed building wheel for cryptography

and

failed building wheel for aiohttp

obviously i have some tuya device and the fix for the login is in the 76.1 version :disappointed_relieved:

now i will try to understand your post for the cross compilation, after looking at it you were speaking about python3 and not about HA updated versione.

any idea on how to do it? @thy1225 i read that you are using version 0.82, how did you get this?

every help is appreciated

Hello, since I some trouble previously, I started writing a guide for myself and other how to install newer versions for Home Assistant for the upcoming future on Synology platform.
It will make use of the spkrc compilation framework to compile Python 3 and will detail in steps how to perform the setup.

Currently it is a pull request and its uncertain whether it should be approved to be part of the official guides since it involves compilation, but it should be in a pretty usable state for anyone who is interested.

https://github.com/home-assistant/home-assistant.io/pull/7861/files
To see the guide, open “Files changed” tab, then click “View file”.

It is my first guide, so certain spots may need more clarifications and improvements.

Btw, in case anyone is interested SynoCommunity is busy making a Home Assistant package, but needs to know which components are most wanted.

As you might know from reading this thread, Synology did not provide a compiler, so when using certain components such as “Cloud”, these will install Python packages such as “pycryptodome” that will compile to install, which obviously fails. The solution is to cross compile these Python packages.

That is why is asked which components are wanted, so the problematic Python packages will be cross compiled and included with the packages.

My guide still stays open though, in case you decide yourself when to stay up-to-date and make components work when you might not want to wait on SynoCommunity to decide when to update their Home Assistant packages or which cross compiled Python packages are included or not.

2 Likes

thanks to @CharlieDowns guide i’ve succesfully installed version 0.84.6 on my Synology DS215J and i can command my tuya device! :laughing: :wink:
next problem is that i didn’t see the energy monitoring for the plug, for this i will check another thread.
thank’s to all for your great work, it was almost simple for a non linux user!
p.s. used ubuntu 18.10 on a VM and succesfully compiled everything

Hello @holly7787,
Good to see the guide worked out for you, I hope it may help many more Synology users out there in need.

Latest no. Just to 0.75.3 version. Any version >0.75.3 breaks. For newer versions you need to compile some additional files. Below @CharlieDowns provided very nice guide how to do it.

Right now I’m trying all possible ways to install HA at old Synos to see which is more errorless and fluid for not so tech savy users. So I tried your 0,1(1), 2 steps and the result of the command is

Failed to import the site module
Traceback (most recent call last):
File “/usr/local/python3/lib/python3.6/site.py”, line 553, in
main()
File “/usr/local/python3/lib/python3.6/site.py”, line 539, in main
known_paths = addusersitepackages(known_paths)
File “/usr/local/python3/lib/python3.6/site.py”, line 282, in addusersitepackages
user_site = getusersitepackages()
File “/usr/local/python3/lib/python3.6/site.py”, line 258, in getusersitepackages
user_base = getuserbase() # this will also set USER_BASE
File “/usr/local/python3/lib/python3.6/site.py”, line 248, in getuserbase
USER_BASE = get_config_var(‘userbase’)
File “/usr/local/python3/lib/python3.6/sysconfig.py”, line 601, in get_config_var
return get_config_vars().get(name)
File “/usr/local/python3/lib/python3.6/sysconfig.py”, line 550, in get_config_vars
_init_posix(_CONFIG_VARS)
File “/usr/local/python3/lib/python3.6/sysconfig.py”, line 421, in _init_posix
_temp = import(name, globals(), locals(), [‘build_time_vars’], 0)
ModuleNotFoundError: No module named ‘_sysconfigdata_m_linux_arm-linux-gnueabihf’
-ash: import: command not found
-ash: import: command not found
-ash: print: command not found

My setup: Syno 215j latest DSM 6.2.1

Hello @clappingmonkey
Which exact step did you follow in the guide?
From the output of the command I read a installation of Python 3.6 on “/usr/local”, but Synology packages are installed in “/var/packages/”.
The other thing is the current Python version on Synocommunity you get from spksrc is Python 3.5.6, not 3.6.

On my NAS, the DS115j, when I install the compiled Python 3 package, any files in the included Python module packages that contain “x86_64-linux-gnu” should be renamed to “arm-linux-gnueabihf” on install.
In the Python 3 package for example the “cffi-1.11.5-cp35-none-any.whl” module package file contains _cffi_backend.cpython-35m-x86_64-linux-gnu.so.
When installed on my DS115j, the file is copied and renamed to /var/packages/python3/target/lib/python3.5/site-packages/_cffi_backend.cpython-35m-arm-linux-gnueabihf.so, which makes sense since my NAS is ARM based.

Could it be this output was not produced on a Synology NAS or was from Python in Docker?

In the case of which is easier between Docker or on the filesystem, the guide is for people who want to run Home Assistant on the filesystem of their Synology NAS, caused by the unavailability of Docker or a ‘special’ reason, thus for such people Docker is might not be suitable.

…NVM, I am blind, I see now you were replying to a message from @chickenandporn

I can say something helpful though, in the case you do not compile your own package, but use from someone else, that person will need to have specifically added some cross compiled python packages to his Python 3 package by editing requirements.txt, else if you config components such as Homekit, Cloud or even Home Assistant itself, these will fail because these need to compile modules on installation.

This is caused by your Synology not giving the ability for Python to compile these modules, thus why is required to have the Python modules cross compiled (think of it as pre-compiling binaries).

I mean to say, that it is not wrong to use a package made by someone else, but just you use certain components and these fail with errors like Failed building wheel for *Module_Name* you will have to ask the maintainer of the Python package to add that module to “requirements.txt” so you can use your component on his next update.

It is a whole lot easier and faster than compiling on your own though, so if done right, keeping the above in mind, I like it more.

1 Like