Forums

New system image not working with app

Today I switched my running app from "fishnchips" image to "harris". But after the change my application is no longer running. Unfortunately I don't know what's wrong from error log file (see below). The mentioned wsgi-file is nothing I created, but looks more like from Pythonanywhere generated and maybe I have to build again the app?

I really hope that someone can help me, because otherwise my app won't work anymore in 30 days.

2024-10-30 07:32:54,681: Error running WSGI application<br> 
2024-10-30 07:32:54,686: ImportError: cannot import name 'get_current_traceback' from 'werkzeug.debug.tbtools' (/usr/local/lib/python3.8/dist-packages/werkzeug/debug/tbtools.py) <br> 
2024-10-30 07:32:54,686:   File "/var/www/www_defichain-analytics_com_wsgi.py", line 16, in <module><br> 
2024-10-30 07:32:54,686:     from main import app<br> 
2024-10-30 07:32:54,686: <br> 
2024-10-30 07:32:54,686:   File "/home/defianalytics/dashboard/main.py", line 1, in <module><br> 
2024-10-30 07:32:54,686:     from defichainAnalyticsController import defichainAnalyticsControllerClass<br> 
2024-10-30 07:32:54,686: <br> 
2024-10-30 07:32:54,687:   File "/home/defianalytics/dashboard/defichainAnalyticsController.py", line 2, in <module><br> 
2024-10-30 07:32:54,687:     from app import app<br> 
2024-10-30 07:32:54,687: <br> 
2024-10-30 07:32:54,687:   File "/home/defianalytics/dashboard/app.py", line 1, in <module><br> 
2024-10-30 07:32:54,687:     import dash<br> 
2024-10-30 07:32:54,687: <br> 
2024-10-30 07:32:54,687:   File "/home/defianalytics/.local/lib/python3.8/site-packages/dash/__init__.py", line 5, in <module><br> 
2024-10-30 07:32:54,687:     from .dash import Dash, no_update  # noqa: F401,E402<br> 
2024-10-30 07:32:54,687: <br> 
2024-10-30 07:32:54,687:   File "/home/defianalytics/.local/lib/python3.8/site-packages/dash/dash.py", line 22, in <module><br> 
2024-10-30 07:32:54,688:     from werkzeug.debug.tbtools import get_current_traceback<br> 
2024-10-30 07:32:54,688: * * * * <br> 
2024-10-30 07:32:54,688: If you're seeing an import error and don't know why,<br> 
2024-10-30 07:32:54,688: we have a dedicated help page to help you debug: <br> 
2024-10-30 07:32:54,688: https://help.pythonanywhere.com/pages/DebuggingImportError/<br> 
2024-10-30 07:32:54,688:  * * * * <br>

[edit by admin: formatting]

You probably need to reinstall packages you are using, at least dash that looks like it was installed into your home directory with --user flag.

Thanks for the hint. I tried to install the dash package again (looks like it was already available), but still not working :-(

09:51 ~ $ pip3.8 install --user dash
Looking in links: /usr/share/pip-wheels
Requirement already satisfied: dash in ./.local/lib/python3.8/site-packages (1.19.0)
Requirement already satisfied: dash-core-components==1.15.0 in ./.local/lib/python3.8/site-packages (from dash) (1.15.0)
Requirement already satisfied: future in /usr/local/lib/python3.8/dist-packages (from dash) (0.18.2)
Requirement already satisfied: dash-html-components==1.1.2 in ./.local/lib/python3.8/site-packages (from dash) (1.1.2)
Requirement already satisfied: plotly in ./.local/lib/python3.8/site-packages (from dash) (4.14.3)
Requirement already satisfied: dash-table==4.11.2 in ./.local/lib/python3.8/site-packages (from dash) (4.11.2)
Requirement already satisfied: flask-compress in ./.local/lib/python3.8/site-packages (from dash) (1.9.0)
Requirement already satisfied: Flask>=1.0.4 in /usr/local/lib/python3.8/dist-packages (from dash) (2.1.2)
Requirement already satisfied: dash-renderer==1.9.0 in ./.local/lib/python3.8/site-packages (from dash) (1.9.0)
Requirement already satisfied: importlib-metadata>=3.6.0 in /usr/local/lib/python3.8/dist-packages (from Flask>=1.0.4->dash) (4.12.0)
Requirement already satisfied: Jinja2>=3.0 in /usr/local/lib/python3.8/dist-packages (from Flask>=1.0.4->dash) (3.1.2)
Requirement already satisfied: Werkzeug>=2.0 in /usr/local/lib/python3.8/dist-packages (from Flask>=1.0.4->dash) (2.1.2)
Requirement already satisfied: itsdangerous>=2.0 in /usr/local/lib/python3.8/dist-packages (from Flask>=1.0.4->dash) (2.1.2)
Requirement already satisfied: click>=8.0 in /usr/local/lib/python3.8/dist-packages (from Flask>=1.0.4->dash) (8.0.3)
Requirement already satisfied: brotli in ./.local/lib/python3.8/site-packages (from flask-compress->dash) (1.0.9)
Requirement already satisfied: six in /usr/lib/python3/dist-packages (from plotly->dash) (1.14.0)
Requirement already satisfied: retrying>=1.3.3 in /usr/local/lib/python3.8/dist-packages (from plotly->dash) (1.3.3)
Requirement already satisfied: zipp>=0.5 in ./.local/lib/python3.8/site-packages (from importlib-metadata>=3.6.0->Flask>=1.0.4->dash) (3.17.0)
Requirement already satisfied: MarkupSafe>=2.0 in /usr/local/lib/python3.8/dist-packages (from Jinja2>=3.0->Flask>=1.0.4->dash) (2.1.1)

[edit by admin: formatting]

If you've just switched your system image, one thing you could try is deleting the directory /home/defianalytics/.local/lib/python3.8 and then re-installing again. That will make 100% that everything is reinstalled from scratch, which should make things better.

Installing everything new was a nice hint. Problem is not solved yet, but it looks like the error is coming from a newer dash and Flask version (especially this "Werkzeug" error, which is used by Flask). My app was created over 2 years ago and used older versions of all packages. With the new image there is also a kind of new base version for packages.

I will now check how to proceed (update package by package vs. downgrade to older ones) and let you know.

Cool, good luck!

Problem solved: Between 5-10 packages had a different version between the two images. My solution was now to downgrade all the needed packages of haggis image to the one of fishnchips (I know that using old versions is most probably not the best way, but for changing my code in many files I have currently no time)

OK -- glad to hear you worked out a solution! And yes, I'd definitely recommend upgrading the packages when you can.