YunoHost-Apps / calibreweb_ynh

Calibre-web package for YunoHost
GNU General Public License v3.0
18 stars 8 forks source link

'safe_str_cmp' removed from 'werkzeug.security' - Service can not be started #99

Closed rincewind0803 closed 2 years ago

rincewind0803 commented 2 years ago

So i got this error after updating calibreweb :

Info: [###################.] > Reload nginx and start calibreweb... Warnung: (this may take some time) Warnung: The service calibreweb didn't fully executed the action start before the timeout. Warnung: Please find here an extract of the end of the log of the service calibreweb: Warnung: Apr 07 07:39:32 sh[23699]: ImportError: cannot import name 'safe_str_cmp' from 'werkzeug.security' (/var/www/calibreweb/vendor/werkzeug/security.py) Warnung: Apr 07 07:39:32 systemd[1]: calibreweb.service: Main process exited, code=exited, status=1/FAILURE Warnung: Apr 07 07:39:32 systemd[1]: calibreweb.service: Failed with result 'exit-code'. Warnung: Apr 07 07:44:02 systemd[1]: Started calibreweb. Warnung: Apr 07 07:44:02 sh[31111]: Traceback (most recent call last): Warnung: Apr 07 07:44:02 sh[31111]: File "/var/www/calibreweb/cps.py", line 34, in <module> Warnung: Apr 07 07:44:02 sh[31111]: from cps import create_app Warnung: Apr 07 07:44:02 sh[31111]: File "/var/www/calibreweb/cps/__init__.py", line 32, in <module> Warnung: Apr 07 07:44:02 sh[31111]: from .MyLoginManager import MyLoginManager Warnung: Apr 07 07:44:02 sh[31111]: File "/var/www/calibreweb/cps/MyLoginManager.py", line 24, in <module> Warnung: Apr 07 07:44:02 sh[31111]: from flask_login import LoginManager Warnung: Apr 07 07:44:02 sh[31111]: File "/var/www/calibreweb/vendor/flask_login/__init__.py", line 16, in <module> Warnung: Apr 07 07:44:02 sh[31111]: from .login_manager import LoginManager Warnung: Apr 07 07:44:02 sh[31111]: File "/var/www/calibreweb/vendor/flask_login/login_manager.py", line 24, in <module> Warnung: Apr 07 07:44:02 sh[31111]: from .utils import (login_url as make_login_url, _create_identifier, Warnung: Apr 07 07:44:02 sh[31111]: File "/var/www/calibreweb/vendor/flask_login/utils.py", line 13, in <module> Warnung: Apr 07 07:44:02 sh[31111]: from werkzeug.security import safe_str_cmp Warnung: Apr 07 07:44:02 sh[31111]: ImportError: cannot import name 'safe_str_cmp' from 'werkzeug.security' (/var/www/calibreweb/vendor/werkzeug/security.py) Warnung: Apr 07 07:44:02 systemd[1]: calibreweb.service: Main process exited, code=exited, status=1/FAILURE Warnung: Apr 07 07:44:02 systemd[1]: calibreweb.service: Failed with result 'exit-code'.

From googling this error i know that 'safe_str_cmp' was removed from Werkzeug 2.1.0 a few days ago. But i dont know how to fix this, simply downgrading by: pip install Werkzeug==2.0.0 did not help.

dmogle commented 2 years ago

I ran into this same problem. I only sort of know why, but I was able to get it working again with the following steps:

  1. Add Werkzeug>=2.0.0,<2.1.0 at the end of /var/www/calibreweb/requirements.txt
  2. From /var/www/calibreweb run sudo pip install -r requirements.txt

Maybe it will work for you?

rincewind0803 commented 2 years ago

Thank You ! It works !

Krakinou commented 2 years ago

Hello Sorry for the late answer : the fix is provided in 0.6.18. (https://github.com/janeczku/calibre-web/commit/7861f8a89a6657b209dae2fde6a31d4d4330b141)

I will publish it as soon as testing is ok.

side note: you should use sudo pip install --target /var/www/calibreweb/vendor -r /var/www/calibreweb/requirements.txt instead of just sudo pip install -r /var/www/calibreweb/requirements.txt, this will install the requirement only for calibreweb.