Python >=3.5.3 on Synology

I did try and install a later version than 3.5.x on my synology also, gave up, used a Raspberry Pi and Hassio in the end, never looked back.

Use MariaDB on the synology to host the HA database to save wearing out the SD card.

Same issue here. Any solutions yet?

Use Docker :slight_smile:

It’s not possible on the DS218j.

1 Like

so using docker avoids the issues?

according to this https://www.home-assistant.io/docs/installation/synology/ it says at the top the issues with older python but has docker installation as the option.

Not sure if it’s any different on the new 1019+

The Docker image uses the required python version for HA and is not dependent on the synology system python

1 Like

perfect. so that article is a bit mis leading for new users. thanks for clarifying :slight_smile:

i’m excited to move over to this nas!

When PIP tries to install the (necessary) cryptography package, it needs to compile some C sources. This fails if there is no gcc on the NAS.

Anyone has a dummy guide how to make it happen? I have a DS215 and I can’t even install the v0.64 … I have HA on raspberry but the SD card keeps dying…

Hail to the king who makes a HA package for 215j and the likes, including the python with all its crypto packages etc compiled within it. I got no compiling ability and 0.73.1 isnt cutting it for my tado setup!

On my installation there was folder permission issue - files that should generate on script start were missing and webpage did not work. Solution was changing folder owner back to root
HA-folder

This is the latest step I’ve gotten to. It looks like I cannot install docker as Docker doesn’t have ARM support yet.

I’ve installed GCC using the approach taken here (because I run arm)

That still didn’t help so I manually installed cffi
./python3 -m pip install cffi
this works, however homeassistant still fails.

Trying cffi==1.13.2 shows a new error:
unable to execute ‘/spksrc/toolchains/syno-armada38x-5.2/work/arm-unknown-linux-gnueabi/bin/arm-unknown-linux-gnueabi-gcc’: No such file or directory

Which looks like python using the wrong folder to compile my code.
cc=gcc didn’t solve this.

So I used ipkg to install python3 (3.7.*) ipkg install python3
this can compile cffi however installing home assistant now failed with

Collecting aiohttp==3.6.1
  Using cached https://files.pythonhosted.org/packages/10/28/ab9decdf95f0b2babe509f264ca531fd6c910615e0b4be5f240dba500832/aiohttp-3.6.1.tar.gz
  Installing build dependencies ... done
  Getting requirements to build wheel ... error
  ERROR: Command errored out with exit status 1:
   command: /opt/bin/python3 /opt/local/lib/python3.7/site-packages/pip/_vendor/pep517/_in_process.py get_requires_for_build_wheel /tmp/tmpxm1sote0
       cwd: /tmp/pip-install-b3y5zf58/aiohttp
  Complete output (10 lines):
  Traceback (most recent call last):
    File "/opt/local/lib/python3.7/site-packages/pip/_vendor/pep517/_in_process.py", line 257, in <module>
      main()
    File "/opt/local/lib/python3.7/site-packages/pip/_vendor/pep517/_in_process.py", line 240, in main
      json_out['return_val'] = hook(**hook_input['kwargs'])
    File "/opt/local/lib/python3.7/site-packages/pip/_vendor/pep517/_in_process.py", line 85, in get_requires_for_build_wheel
      backend = _build_backend()
    File "/opt/local/lib/python3.7/site-packages/pip/_vendor/pep517/_in_process.py", line 76, in _build_backend
      obj = getattr(obj, path_part)
  AttributeError: module 'setuptools.build_meta' has no attribute '__legacy__'
  ----------------------------------------
ERROR: Command errored out with exit status 1: /opt/bin/python3 /opt/local/lib/python3.7/site-packages/pip/_vendor/pep517/_in_process.py get_requires_for_build_wheel /tmp/tmpxm1sote0 Check the logs for full command output.

EDIT: I believe I’m currently encountering this bug: https://github.com/pypa/pip/issues/6264
However I need to go to bed so I cannot investigate.

Looks like aiothttp is now not compiling.
This problem isn’t true of aiohttp==3.6.2
I can get past this using constraints as defined by https://stackoverflow.com/questions/23969793/setup-py-pip-override-one-of-the-dependencys-sub-dependency-from-requirement

The new error is a GCC compile error.
python3 -m pip install cryptography

gcc -pthread -Wno-unused-result -Wsign-compare -DNDEBUG -g -fwrapv -O3 -Wall -fPIC -I/opt/include/python3.7m -c build/temp.linux-armv7l-3.7/_openssl.c -o build/temp.linux-armv7l-3.7/build/temp.linux-armv7l-3.7/_openssl.o -Wconversion -Wno-error=sign-conversion
build/temp.linux-armv7l-3.7/_openssl.c:498:10: fatal error: openssl/opensslv.h: No such file or directory
#include <openssl/opensslv.h>
^~~~~~~~~~~~~~~~~~~~
compilation terminated.
error: command ‘gcc’ failed with exit status 1

ERROR: Failed building wheel for cryptography
Running setup.py clean for cryptography
Failed to build cryptography
ERROR: Could not build wheels for cryptography which use PEP 517 and cannot be installed directly

It’s at this point I’ve realized: ipkg is out of support and I need opkg instead: github Entware/Entware/wiki/Install-on-Synology-NAS

Looks like I might be missing some install dependencies not managed by pip currently. so I’ll need to resolve those.

EDIT:
Installing OPKG means I’m scratch. Might as well record the commands I’m running now:

  1. opkg install python3
  2. opkg install python3-pip
  3. pip install --upgrade pip
  4. pip3 install homeassistant

At this point I’m getting errors again.
Grabbing the logs of the errors I see:
unable to execute 'arm-openwrt-linux-gnueabi-gcc': No such file or directory
Whoops. I forgot to reinstall GCC
opkg install gcc
At this point I am now reading through:
github Entware/Entware/wiki/Using-GCC-for-native-compilation
and installing the headers.

Running:

  1. pip3 install homeassistant -c constraints
    Now works (constraints are a file with aiohttp==3.6.2 see above)

At this point my installation has succeeded and the setup wiki’s instructions covered my use case.

And staring the daemon yeilds:

Starting Home Assistant ...
/bin/sh: /volume1/homeassistant/home-assistant.log: Permission denied

That’s unfortunate.

EDIT 2:
I couldn’t get the permissions right on that folder (weird).
So I’ve now moved the install directory to the home directory of the user.
This works and I’m hitting an error

Still trying to determine how to fix this in my case.

After openssl-1.1.1 worked, HA wanted clib-1.25 and segfaulted.

My solution was to use [https://get.docker.com/] (get-docker.sh) and everything worked out of the box (on Raspbian). Only had to configure autostart of the container.

If you can use docker I’m all for it. Unfortunately last I checked I couldn’t use it on an arm device

im a newb and dont have git but while installing i got a dependency error
Install Docker:

# sudo apt-get install docker-ce

fixed it by

Install Docker:
```bash
# sudo apt-get install docker-ce -cli
# sudo apt-get install docker-ce

Seems there is a mismatch in de latest 18.09 version of docker-ce /cli

IF using UBUNTU VM 16.04.xx
Pip is not installed for me/ or not working
So i had to do
# sudo apt pip install python3-pip --reinstall

Some help please stucks with the following error whike making the make arch

“please check the messages above” is an important part of your error message. We’d need to see more text above where you clipped.

Are you building in a docker image?

I’m unsure exactly the process you’re doing, but I did some work to make builds a one-line-command therefore less prone to error. Essentially make spk-(PACKAGE)-(ARCH)-(DSM_VER) such as:

git clone https://github.com/SynoCommunity/spksrc.git && \
    cd spksrc && \
    docker run -it --rm \
      -v $(pwd):/spksrc -w /spksrc  \
      synocommunity/spksrc:latest \
      /bin/bash -c 'make clean && make spk-python3-88f6281-6.1'

(This just ran to completion, but takes 47 minutes on my DS1515)

2 Likes

Just woke up and couldnt leave it alone. I Have the DS213 and the arch code for that is synology_88f6282_213. So i tried relentlessly to build make arch-88f6282.

Solution:
Turn out 88f6282 does not exist in the Kernel folder (fook my live)
I had to take 88f6281 instead and its building now

THanks for the reply !!! i love the name lol. And also for the comment i was wondering already how to do a fresh run if i fooked up.

#fook2 it was running smootly now i ran out of diskpace. Be sure to allocate enough in de virtualbox

Open Synology Package Center and press the “Manual Install” button.
Click “Browse” and select the Python package we created, then press “Next”.
You will get a unverified package popup, press yes and next screen press Apply.

Line 199 Any idea which package we are talking about ? i only created the 4 whl files atm