Python >=3.5.3 on Synology

Just finished installing the python3 package and than i ran :slight_smile:

/volume1/@appstore/python3/bin/python3 -m venv /volume1/homeassistant/venv-hass

I get the following errors. Help please
Ps i only need to install this python3 version right i uninstalled the DSM store one

/volume1/@appstore/python3/bin/python3 -m venv /volume1/homeassistant/venv-hass
Failed to import the site module
Traceback (most recent call last):
 File "/volume1/@appstore/python3/lib/python3.6/", line 553, in <module>
 File "/volume1/@appstore/python3/lib/python3.6/", line 539, in main
   known_paths = addusersitepackages(known_paths)
 File "/volume1/@appstore/python3/lib/python3.6/", line 282, in addusersitepackages
   user_site = getusersitepackages()
 File "/volume1/@appstore/python3/lib/python3.6/", line 258, in getusersitepackages
   user_base = getuserbase() # this will also set USER_BASE
 File "/volume1/@appstore/python3/lib/python3.6/", line 248, in getuserbase
   USER_BASE = get_config_var('userbase')
 File "/volume1/@appstore/python3/lib/python3.6/", line 601, in get_config_var
   return get_config_vars().get(name)
 File "/volume1/@appstore/python3/lib/python3.6/", line 550, in get_config_vars
 File "/volume1/@appstore/python3/lib/python3.6/", line 421, in _init_posix
   _temp = __import__(name, globals(), locals(), ['build_time_vars'], 0)
ModuleNotFoundError: No module named '_sysconfigdata_m_linux_arm-linux-gnueabi'

Rebuild the py package and noticeed some fails

Stripping bin/busybox... ok
Stripping bin/bzip2... ok
Stripping bin/bzip2recover... ok
Stripping bin/captoinfo... ok
Stripping bin/clear... ok
Stripping bin/curl... ok
Stripping bin/dumpsexp... ok
Stripping bin/easy_install*... failed!
Stripping bin/gpg-error... ok
Stripping bin/hmac256... ok
Stripping bin/idle3.6... failed!
Stripping bin/infocmp... ok
Stripping bin/infotocap... ok
Stripping bin/lzmadec... ok
Stripping bin/lzmainfo... ok
Stripping bin/mpicalc... ok
Stripping bin/openssl... ok
Stripping bin/pip*... failed!
Stripping bin/pydoc3.6... failed!
Stripping bin/python3.6... ok
Stripping bin/python3.6m... ok
Stripping bin/pyvenv-3.6... failed!
Stripping bin/reset... ok
Stripping bin/speexdec... ok
Stripping bin/speexenc... ok
Stripping bin/sqlite3... ok
Stripping bin/tabs... ok
Stripping bin/tic... ok
Stripping bin/toe... ok
Stripping bin/tput... ok
Stripping bin/tset... ok
Stripping bin/wheel... failed!

Any help would be much appreciated

Update to help people from going nuts. I got the above fixed by using the below spksprc to install on my nass. Be sure to :

  • choose the right spk accoording to your NAS model
  • Still have to make the Wheel files so follow chickenporn guide for that
  • For some reason the whl files created for me were named xxx.36 instead of xxx.35 i had to change the script abit for this (7zp command and installing on the NAS)
    Hope it helps

Below file is a python package you can install on your nas

didnt work either

wel didnt succeed anywhere. I noticed while buidling the docker we are useing the command arch=amd64 should this be change too arch=arm64.

I tried arm-64 but docker-ce wont install lol. Im just looking for a stable version to run anyone ?

– Part1 –

I just succeeded to install the latest version of HA on my DS216J (with the help of this topic) and it runs without any errors. This is what I did:

Install Python module and Perl packages.

increase temp space: mount -o remount,size=5G /tmp/ (512 Mb of temp space is to little to run HA, it needs more for building the interface)

sudo -i

Install entware using more or less this tutorial: However point 3 I have replaced by:

wget (take the correct version, to get info about your kernel do uname -r)
chmod 744 ./

Now install the packages needed:

opkg install python3-dev
opkg install python3-pip
opkg install gcc
opkg install make
opkg install libopenssl
opkg install libopenssl-conf
opkg install openssl-util
opkg install python3-pyopenssl
pip install --upgrade pip
pip3 install --upgrade PyNaCl==1.3.0
export CFLAGS=-pthread

1 Like

– Part2 –

next is needed for ffi.h:

cd /opt/lib
tar -xvf libffi-3.2.1.tar.gz
cd libffi-3.2.1
source /opt/bin/
./configure --prefix=/opt
make install

next is needed for opensslv.h

tar -xvf openssl-1.1.1d.tar.gz
cd openssl-1.1.1d
source /opt/bin/
./config --prefix=/opt
make install

next is needed for references in the installation of HA:

mkdir /usr/include
cd /usr/include
ln -s /opt/lib/libffi-3.2.1/include/ffi.h ffi.h
ln -s /opt/lib/libffi-3.2.1/include/ffitarget.h ffitarget.h
ln -s /opt/include/openssl openssl

1 Like

– Part3 –

Start installation of HA:

pip3 install -I --no-cache-dir homeassistant

rm /opt/lib/libffi-3.2.1.tar.gz
rm /opt/lib/openssl-1.1.1d.tar.gz

Start HA by the script from this page:

A tip if you expose HA to the outside using the reverse proxy of synology, add these two variables to the header:

Name - Value
Upgrade - $http_upgrade
Connection - $connection_upgrade

1 Like

Python 3.6.8 is available for Synology from the SynoCommunity. This version is not available from the Synology Package Center which still offers 3.5.6. Instead the .spk file needs to be downloaded from

First verify your processor in the Control Panel Info Center. Mine is an Armadaxp for example. So I downloaded a file for armadaxp. Use the Manual Install button in the Package Center to install that file you downloaded.

The Python executables will end up in /usr/local/python3/bin Note that all current versions of homeassistant will run on 3.6, but ‘soon’ homeassistant will require 3.7

@spokin : You are my hero !!!

Everything installed and running perfectly with the last HA version on my DS115J !!!

Finally I can stop consuming more electricity running HA on a one more separate device.

Thanks for your job man.

If anyone could make a Synology package with this and explain how to use Zigbee2MQTT runing HA directly on Synology, it would be perfect


Thanks for the addition. I have updated my post.

opkg will install Python 3.8 and this is running well.

Have you tried pip3 upgrade aiohttp?

I managed to make everything work and fluant on a DS115J !!!

Just had to wait a little for HA to start.

@spokin : Can you just edit your post to make it clearer for everyone:

– Part1 –

From your Synology Package Center, install

  • Python Module (Not Python 3)
  • Perl

next is needed for opensslv.h
(Complilation may take some time)

– Part2 –

pip3 install sqlalchemy

– Part3 –
Start HA by the script from this page:

cd /volume1/homeassistant

Create hass-daemon file using the following code (edit the variables in uppercase if necessary)


# Package
DNAME="Home Assistant"

# Others
FLAGS="-v --config $INSTALL_DIR --pid-file $PID_FILE --daemon"
REDIRECT="> $INSTALL_DIR/home-assistant.log 2>&1"

start_daemon ()
    sudo -u ${USER} /bin/sh -c "$PYTHON $HASS $FLAGS $REDIRECT;"

stop_daemon ()
    kill `cat ${PID_FILE}`
    wait_for_status 1 20 || kill -9 `cat ${PID_FILE}`
    rm -f ${PID_FILE}

daemon_status ()
    if [ -f ${PID_FILE} ] && kill -0 `cat ${PID_FILE}` > /dev/null 2>&1; then
    rm -f ${PID_FILE}
    return 1

wait_for_status ()
    while [ ${counter} -gt 0 ]; do
        [ $? -eq $1 ] && return
        let counter=counter-1
        sleep 1
    return 1

case $1 in
        if daemon_status; then
            echo ${DNAME} is already running
            exit 0
            echo Starting ${DNAME} ...
            exit $?
        if daemon_status; then
            echo Stopping ${DNAME} ...
            exit $?
            echo ${DNAME} is not running
            exit 0
        if daemon_status; then
            echo Stopping ${DNAME} ...
            echo Starting ${DNAME} ...
            exit $?
            echo ${DNAME} is not running
            echo Starting ${DNAME} ...
            exit $?
        if daemon_status; then
            echo ${DNAME} is running
            exit 0
            echo ${DNAME} is not running
            exit 1
        echo ${LOG_FILE}
        exit 0
        exit 1

Make the daemon file executable:

chmod 755 /volume1/homeassistant/hass-daemon

Start Home Assistant:

sudo /volume1/homeassistant/hass-daemon start
1 Like

For now I am not installing packages from Entware because it affects support from Synology. Some years ago I had Optware installed on a Synology. I had to open a ticket with Synology to fix an issue and they refused to work with me until I removed the /opt directory and any trace of the Optware. They have no problem with programs installed via Package Center. Since I only need Python, I will try to stay with installs of .spk packages.

I withdraw my suggestion to use the 3.6.8 Python .spkr package. I have discovered it was withdrawn because it had issues with Home Assistant building openzwave dependencies in the venv environment. Now that current versions of HA need Python 3.7, the community packages are not useful.

I just can’t seem to get this to work. @spokin tried to follow your modified directions since I do want homeassistant in a shared folder where I can easily see the files/configs. I am running synology diskstation 216play. Any help would be greatly appreciated. I am rather new to linux and command prompt / terminal.

I am getting this error:

WARNING: You are using pip version 19.2.3, however version 20.0.2 is available.
You should consider upgrading via the 'pip install --upgrade pip' command.

When I try to upgrade pip, I get this:

Traceback (most recent call last):
  File "/bin/pip", line 5, in <module>
    from pkg_resources import load_entry_point
ImportError: No module named pkg_resources

When I try to
sudo pip3 install -I --no-cache-dir homeassistant

I get to installing build dependencies… and the:

 Installing build dependencies ... error
  ERROR: Command errored out with exit status 1:
   command: /opt/bin/python3 /opt/lib/python3.8/site-packages/pip install --ignore-installed --no-user --prefix /tmp/pip-build-env-c9xgq6ai/overlay --no-warn-script-location --no-binary :none: --only-binary :none: -i -- 'setuptools>=40.6.0' wheel 'cffi>=1.8,!=1.11.3; platform_python_implementation != '"'"'PyPy'"'"''
       cwd: None
  Complete output (55 lines):

I can confirm this works on a DS215j with Armada 375 , 2x 800mhz.
I dont run a heavy setup, but it works all without hickups.

1 Like

do this as well
pip3 install --upgrade pip

not the “3” !