Upgrade Python to 3.7+ to support Apprise in LL

I switched my LazyLibrarian install to the LSIO container, and I noticed that my postprocessing was failing. The reason is that I had setup the apprise notifications earlier, and these were failing in Python versions lower than 3.7. I upgraded Python manually to 3.7 in the container, installed apprise, and it fixed the issue.

Obviously, that’s not a long term solution, so it would be nice if the image was updated as well

We’ll look into it. In the meantime, you can make your changes permanent via a custom script: https://blog.linuxserver.io/2019/09/14/customizing-our-containers/

Some updates on this. I am working with the dev, and they said it worked perfectly using Python 3.6.12 outside of Docker. The image has Python 3.6.9, so it may still be a version issue, but I did do a fresh install of Python3.7, so it could also be an issue with the overall Python install.

Seems there are potentially other bugs related to the Python install in this image as well.


I think I know the issue. When we remove the python3-pip package as part of cleanup at the end, it also removes some python modules (like six) that are dependencies of apprise.

I’ll have to add them back.

Oh interesting, that might be significantly simpler than my workaround of installing a fresh version of Python and all the required packages again.

I might swap to that approach unless you’re planning on fixing it soon anyways.

Actually, that wasn’t the issue. All the necessary dependencies seem to be there. I have no idea why apprise isn’t working for you

As in, the Apprise notifications are working for you within the container, and there’s something specific in my setup that is breaking them? Or that the root cause of the notification failure is still unknown? I couldn’t figure out anything specific to my setup from the below logs, and it does seem to work fine on native installs or even with the fresh Python 3.7 in the container

28-Sep-2020 00:27:44 - INFO    :: POSTPROCESS : postprocess.py:processDir:1206 : Successfully processed: Honeysuckle Season - Mary Ellen Taylor
28-Sep-2020 00:27:44 - WARNING :: POSTPROCESS : __init__.py:notify_download:88 : Notify download failed: There is no current event loop in thread 'POSTPROCESS'.
28-Sep-2020 00:27:44 - ERROR   :: POSTPROCESS : __init__.py:notify_download:89 : Unhandled exception: Traceback (most recent call last):
  File "/app/lazylibrarian/lazylibrarian/notifiers/__init__.py", line 86, in notify_download
    n.notify_download(title)
  File "/app/lazylibrarian/lazylibrarian/notifiers/apprise_notify.py", line 100, in notify_download
    self._notify(event=notifyStrings[NOTIFY_DOWNLOAD], message=title, url=None)
  File "/app/lazylibrarian/lazylibrarian/notifiers/apprise_notify.py", line 82, in _notify
    return self._sendApprise(event, message, url)
  File "/app/lazylibrarian/lazylibrarian/notifiers/apprise_notify.py", line 74, in _sendApprise
    return apobj.notify(title=title, body="%s\n%s" % (event, message), notify_type=notifytype)
  File "/usr/local/lib/python3.6/dist-packages/apprise/Apprise.py", line 434, in notify
    if not py3compat.asyncio.notify(coroutines, debug=self.debug):
  File "/usr/local/lib/python3.6/dist-packages/apprise/py3compat/asyncio.py", line 77, in notify
    loop = asyncio.get_event_loop()
  File "/usr/lib/python3.6/asyncio/events.py", line 694, in get_event_loop
    return get_event_loop_policy().get_event_loop()
  File "/usr/lib/python3.6/asyncio/events.py", line 602, in get_event_loop
    % threading.current_thread().name)
RuntimeError: There is no current event loop in thread 'POSTPROCESS'.
2020-09-28 13:08:46,429 - DEBUG - lazylibrarian.logger - TESTPROVIDER : providers.py:test_provider:155 : Testing notifier Discord
2020-09-28 13:08:46,431 - DEBUG - lazylibrarian.logger - TESTPROVIDER : apprise_notify.py:_sendApprise:62 : Apprise: event: Test
2020-09-28 13:08:46,433 - DEBUG - lazylibrarian.logger - TESTPROVIDER : apprise_notify.py:_sendApprise:63 : Apprise: message: Testing Apprise settings from LazyLibrarian
2020-09-28 13:08:46,434 - DEBUG - lazylibrarian.logger - TESTPROVIDER : apprise_notify.py:_sendApprise:64 : Apprise: url: discord://<redacted>?avatar=No&image=No
2020-09-28 13:08:46,436 - DEBUG - lazylibrarian.logger - TESTPROVIDER : apprise_notify.py:_sendApprise:65 : Using 1 notification service
2020-09-28 13:08:46,437 - DEBUG - lazylibrarian.logger - TESTPROVIDER : apprise_notify.py:_sendApprise:66 : {'app_id': 'LazyLibrarian', 'app_desc': 'LazyLibrarian Announcement', 'default_extension': '.png', 'theme': 'default', 'image_path_mask': '/opt/LazyLibrarian/data/images/{TYPE}-{XY}{EXTENSION}', 'image_url_mask': 'https://lazylibrarian.gitlab.io/assets/{TYPE}-{XY}{EXTENSION}', 'image_url_logo': 'https://lazylibrarian.gitlab.io/assets/logo.png'}
2020-09-28 13:08:46,438 - INFO - apprise - Notifying 1 service(s) asynchronous.
2020-09-28 13:08:46,438 - ERROR - cherrypy.error.139703685148912 - [28/Sep/2020:13:08:46] HTTP Traceback (most recent call last):
File "/app/lazylibrarian/cherrypy/_cprequest.py", line 670, in respond
response.body = self.handler()
File "/app/lazylibrarian/cherrypy/lib/encoding.py", line 217, in __call__
self.body = self.oldhandler(*args, **kwargs)
File "/app/lazylibrarian/cherrypy/_cpdispatch.py", line 61, in __call__
return self.callable(*self.args, **self.kwargs)
File "/app/lazylibrarian/lazylibrarian/webServe.py", line 5651, in testprovider
result, name = test_provider(kwargs['name'], host=host, api=api)
File "/app/lazylibrarian/lazylibrarian/providers.py", line 158, in test_provider
return noti.test_notify(host), name
File "/app/lazylibrarian/lazylibrarian/notifiers/apprise_notify.py", line 105, in test_notify
return self._notify(event="Test", message="Testing Apprise settings from LazyLibrarian", url=url)
File "/app/lazylibrarian/lazylibrarian/notifiers/apprise_notify.py", line 82, in _notify
return self._sendApprise(event, message, url)
File "/app/lazylibrarian/lazylibrarian/notifiers/apprise_notify.py", line 74, in _sendApprise
return apobj.notify(title=title, body="%s\n%s" % (event, message), notify_type=notifytype)
File "/usr/local/lib/python3.6/dist-packages/apprise/Apprise.py", line 434, in notify
if not py3compat.asyncio.notify(coroutines, debug=self.debug):
File "/usr/local/lib/python3.6/dist-packages/apprise/py3compat/asyncio.py", line 77, in notify
loop = asyncio.get_event_loop()
File "/usr/lib/python3.6/asyncio/events.py", line 694, in get_event_loop
return get_event_loop_policy().get_event_loop()
File "/usr/lib/python3.6/asyncio/events.py", line 602, in get_event_loop
% threading.current_thread().name)
RuntimeError: There is no current event loop in thread 'TESTPROVIDER'.

EDIT: Adding LL system info below

Startup cmd: ['/usr/bin/python3', '/app/lazylibrarian/LazyLibrarian.py', '--datadir', '/config', '--nolaunch']
Interface: bookstrap
Loglevel: 1
Sys_Encoding: UTF-8
git_repo: lazylibrarian
git_user: LazyLibrarian
git_branch: master
latest_version: 63b212b54e444b91459ec2bc7732005f7e23868b
git_updated: Mon Sep 28 10:59:35 2020
current_version: 63b212b5
git_host: gitlab.com
commits_behind: 0
install_type: source
auto_update: 1
db version: 67
Python version: ['3.6.9 (default, Jul 17 2020, 12:50:27) ', '[GCC 8.4.0]']
uname: uname_result(system='Linux', node='5136382539a9', release='4.19.128-microsoft-standard', version='#1 SMP Tue Jun 23 12:58:10 UTC 2020', machine='x86_64', processor='x86_64')
Platform: Linux-4.19.128-microsoft-standard-x86_64-with-Ubuntu-18.04-bionic
urllib3: 1.25.10
requests: 2.24.0
tls: TLS 1.3
cherrypy: 3.6.0
sqlite3: 3.22.0
apprise: library version 0.8.8
unrar2: library version 0.99.7
openssl: OpenSSL 1.1.1  11 Sep 2018
pyOpenSSL: 17.5.0
cryptography: 2.1.4
fuzzywuzzy: 0.14.0
Levenshtein: None
magic: libmagic.so.1