Python >=3.5.3 on Synology

Tags: #<Tag:0x00007f203f40fe00>


I’m not sure about DS214+, I’m on DS212j. But I happen to still keeping some of the package wheel files, so you can see if they work for you. the files are here (the file will be deleted after 30days by the site)


Thank you @thy1225

I successfully complied homeassistant and with the packages with spksrc. I have only one problem right now.

2018-11-20 08:51:30 ERROR (MainThread) [aiohttp.server] Error handling request
Traceback (most recent call last):
  File "/usr/local/homeassistant/env/lib/python3.5/site-packages/aiohttp/", line 390, in start
    resp = await self._request_handler(request)
  File "/usr/local/homeassistant/env/lib/python3.5/site-packages/aiohttp/", line 366, in _handle
    resp = await handler(request)
  File "/usr/local/homeassistant/env/lib/python3.5/site-packages/aiohttp/", line 106, in impl
    return await handler(request)
  File "/usr/local/homeassistant/share/homeassistant/homeassistant/components/http/", line 66, in staticresource_middleware
    return await handler(request)
  File "/usr/local/homeassistant/share/homeassistant/homeassistant/components/http/", line 34, in real_ip_middleware
    return await handler(request)
  File "/usr/local/homeassistant/share/homeassistant/homeassistant/components/http/", line 66, in ban_middleware
    return await handler(request)
  File "/usr/local/homeassistant/share/homeassistant/homeassistant/components/http/", line 97, in auth_middleware
    return await handler(request)
  File "/usr/local/homeassistant/share/homeassistant/homeassistant/components/http/", line 34, in real_ip_middleware
    return await handler(request)
  File "/usr/local/homeassistant/share/homeassistant/homeassistant/components/http/", line 66, in ban_middleware
    return await handler(request)
  File "/usr/local/homeassistant/share/homeassistant/homeassistant/components/http/", line 97, in auth_middleware
    return await handler(request)
  File "/usr/local/homeassistant/share/homeassistant/homeassistant/components/http/", line 113, in handle
    result = await result
  File "/usr/local/homeassistant/share/homeassistant/homeassistant/components/cloud/", line 81, in error_handler
    result = await handler(view, request, *args, **kwargs)
  File "/usr/local/homeassistant/share/homeassistant/homeassistant/components/http/", line 47, in wrapper
    result = await method(view, request, *args, **kwargs)
  File "/usr/local/homeassistant/share/homeassistant/homeassistant/components/cloud/", line 138, in post
  File "/usr/local/python3/lib/python3.5/asyncio/", line 381, in __iter__
    yield self  # This tells Task to wait for completion.
  File "/usr/local/python3/lib/python3.5/asyncio/", line 310, in _wakeup
  File "/usr/local/python3/lib/python3.5/asyncio/", line 294, in result
    raise self._exception
  File "/usr/local/python3/lib/python3.5/concurrent/futures/", line 55, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/usr/local/homeassistant/share/homeassistant/homeassistant/components/cloud/", line 91, in login
    cognito = _authenticate(cloud, email, password)
  File "/usr/local/homeassistant/share/homeassistant/homeassistant/components/cloud/", line 144, in _authenticate
  File "/usr/local/homeassistant/env/lib/python3.5/site-packages/warrant/", line 383, in authenticate
  File "/usr/local/homeassistant/env/lib/python3.5/site-packages/warrant/", line 206, in verify_token
  File "/usr/local/homeassistant/env/lib/python3.5/site-packages/jose/", line 132, in decode
    payload = jws.verify(token, key, algorithms, verify=verify_signature)
  File "/usr/local/homeassistant/env/lib/python3.5/site-packages/jose/", line 75, in verify
    _verify_signature(signing_input, header, signature, key, algorithms)
  File "/usr/local/homeassistant/env/lib/python3.5/site-packages/jose/", line 262, in _verify_signature
    if not _sig_matches_keys(keys, signing_input, signature, alg):
  File "/usr/local/homeassistant/env/lib/python3.5/site-packages/jose/", line 210, in _sig_matches_keys
    key = jwk.construct(key, alg)
  File "/usr/local/homeassistant/env/lib/python3.5/site-packages/jose/", line 61, in construct
    return key_class(key_data, algorithm)
  File "/usr/local/homeassistant/env/lib/python3.5/site-packages/jose/backends/", line 148, in __init__
    self.prepared_key = self._process_jwk(key)
  File "/usr/local/homeassistant/env/lib/python3.5/site-packages/jose/backends/", line 174, in _process_jwk
    verifying_key = rsa.RSAPublicNumbers(e, n).public_key(self.cryptography_backend())
  File "/usr/local/homeassistant/env/lib/python3.5/site-packages/cryptography/hazmat/backends/", line 15, in default_backend
    from cryptography.hazmat.backends.openssl.backend import backend
  File "/usr/local/homeassistant/env/lib/python3.5/site-packages/cryptography/hazmat/backends/openssl/", line 7, in <module>
    from cryptography.hazmat.backends.openssl.backend import backend
  File "/usr/local/homeassistant/env/lib/python3.5/site-packages/cryptography/hazmat/backends/openssl/", line 53, in <module>
    from cryptography.hazmat.bindings.openssl import binding
  File "/usr/local/homeassistant/env/lib/python3.5/site-packages/cryptography/hazmat/bindings/openssl/", line 13, in <module>
    from cryptography.hazmat.bindings._openssl import ffi, lib
ImportError: /usr/local/homeassistant/env/lib/python3.5/site-packages/cryptography/hazmat/bindings/ undefined symbol: pthread_atfork

Anyone get the same error when I try to login to cloud services?


I had problems with the cloud login too, but it was solved by following @hogi1200 's solution in his post.

I’m not sure if this the problem for you right now but if you compiled some of the whl files on your own, maybe you can see if those packages have the same naming problem.


Finally get it resolved. I complied the wrong python3 site-packages again with spksrc. The required enviroment variable is the following:

export CFLAGS=-pthread

Affected site-packages are: cffi==1.11.2 && cryptography==2.3.1

Now, I have fully working cloud :slight_smile: and Xiaomi Robot Vacuum with the latest Home Assistant 0.82 on DS214+


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


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
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 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 but still no web page access.

what i have to do now? i uninstall everything and use the package in this page?
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 “” 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:

Home Assistant won't start on Synology DS115j NAS

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 the installation folder will be different:

in the hass-daemon file:





in the ssh client, i used PuTTY


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


cd /volume1/@appstore/python3/bin


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


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


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


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


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


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.

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.


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