Python >=3.5.3 on Synology

synology
Tags: #<Tag:0x00007f1b93a46108>

#61

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


#62

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.


#63

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


#64

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.


#65

Because python3 > 3.5.3 is now provided, perhaps this should be discussed on a HomeAssistant-native-on-Synology discussion


#66

Python 3.5.6-8 is available from on of the Community repositories, e.g:

http://packages.synocommunity.com/

https://www.cphub.net