Flask App deployment fails because of ImportError libtk8.6.so

Andreas Bleyel 1 Reputation point
2022-05-07T19:58:34.11+00:00

Hello,

My Flask app runs locally without problems. After deploying to Azure via VSC, I get the error

2022-05-07T19:41:23.911104569Z ImportError: libtk8.6.so: cannot open shared object file: No such file or directory

Any idea how to fix this? Guess this is somehow related to the tkinter package which usually, should be available per default.

Here is the full log:

2022-05-07T19:41:16.058659068Z A P P   S E R V I C E   O N   L I N U X

2022-05-07T19:41:16.058664869Z 

2022-05-07T19:41:16.058670369Z Documentation: http://aka.ms/webapp-linux

2022-05-07T19:41:16.058676169Z Python 3.9.7

2022-05-07T19:41:16.058681669Z Note: Any data outside '/home' is not persisted

2022-05-07T19:41:16.388196662Z Starting OpenBSD Secure Shell server: sshd.

2022-05-07T19:41:16.416847300Z App Command Line not configured, will attempt auto-detect

2022-05-07T19:41:16.417031002Z Launching oryx with: create-script -appPath /home/site/wwwroot -output /opt/startup/startup.sh -virtualEnvName antenv -defaultApp /opt/defaultsite

2022-05-07T19:41:16.649846453Z Found build manifest file at '/home/site/wwwroot/oryx-manifest.toml'. Deserializing it...

2022-05-07T19:41:16.673778036Z Build Operation ID: |O2MDmx596ic=.deab4bfb_

2022-05-07T19:41:16.677873884Z Oryx Version: 0.2.20211207.1, Commit: 46633df49cc8fbe9718772a3c894df221273b2af, ReleaseTagName: 20211207.1

2022-05-07T19:41:16.677907184Z Output is compressed. Extracting it...

2022-05-07T19:41:16.681016621Z Extracting '/home/site/wwwroot/output.tar.gz' to directory '/tmp/8da3060ad1f6c95'...

2022-05-07T19:41:19.057866470Z App path is set to '/tmp/8da3060ad1f6c95'

2022-05-07T19:41:20.034924613Z Detected an app based on Flask

2022-05-07T19:41:20.037284142Z Generating `gunicorn` command for 'app:app'

2022-05-07T19:41:20.652593588Z Writing output script to '/opt/startup/startup.sh'

2022-05-07T19:41:21.166108169Z Using packages from virtual environment antenv located at /tmp/8da3060ad1f6c95/antenv.

2022-05-07T19:41:21.166150269Z Updated PYTHONPATH to ':/opt/startup/code_profiler:/tmp/8da3060ad1f6c95/antenv/lib/python3.9/site-packages'

2022-05-07T19:41:22.036246480Z [2022-05-07 19:41:22 +0000] [37] [INFO] Starting gunicorn 20.1.0

2022-05-07T19:41:22.050826661Z [2022-05-07 19:41:22 +0000] [37] [INFO] Listening at: http://0.0.0.0:8000 (37)

2022-05-07T19:41:22.051913774Z [2022-05-07 19:41:22 +0000] [37] [INFO] Using worker: sync

2022-05-07T19:41:22.056430530Z [2022-05-07 19:41:22 +0000] [38] [INFO] Booting worker with pid: 38

2022-05-07T19:41:23.855292476Z /tmp/8da3060ad1f6c95/antenv/lib/python3.9/site-packages/flask_sqlalchemy/__init__.py:872: FSADeprecationWarning: SQLALCHEMY_TRACK_MODIFICATIONS adds significant overhead and will be disabled by default in the future.  Set it to True or False to suppress this warning.

2022-05-07T19:41:23.855371877Z   warnings.warn(FSADeprecationWarning(

2022-05-07T19:41:23.908520737Z [2022-05-07 19:41:23 +0000] [38] [ERROR] Exception in worker process

2022-05-07T19:41:23.908602738Z Traceback (most recent call last):

2022-05-07T19:41:23.908614838Z   File "/opt/python/3.9.7/lib/python3.9/site-packages/gunicorn/arbiter.py", line 589, in spawn_worker

2022-05-07T19:41:23.908622738Z     worker.init_process()

2022-05-07T19:41:23.908629238Z   File "/opt/python/3.9.7/lib/python3.9/site-packages/gunicorn/workers/base.py", line 134, in init_process

2022-05-07T19:41:23.908706839Z     self.load_wsgi()

2022-05-07T19:41:23.908717739Z   File "/opt/python/3.9.7/lib/python3.9/site-packages/gunicorn/workers/base.py", line 146, in load_wsgi

2022-05-07T19:41:23.908758040Z     self.wsgi = self.app.wsgi()

2022-05-07T19:41:23.908765240Z   File "/opt/python/3.9.7/lib/python3.9/site-packages/gunicorn/app/base.py", line 67, in wsgi

2022-05-07T19:41:23.908771840Z     self.callable = self.load()

2022-05-07T19:41:23.908777940Z   File "/opt/python/3.9.7/lib/python3.9/site-packages/gunicorn/app/wsgiapp.py", line 58, in load

2022-05-07T19:41:23.908784440Z     return self.load_wsgiapp()

2022-05-07T19:41:23.908790140Z   File "/opt/python/3.9.7/lib/python3.9/site-packages/gunicorn/app/wsgiapp.py", line 48, in load_wsgiapp

2022-05-07T19:41:23.908796440Z     return util.import_app(self.app_uri)

2022-05-07T19:41:23.908802341Z   File "/opt/python/3.9.7/lib/python3.9/site-packages/gunicorn/util.py", line 359, in import_app

2022-05-07T19:41:23.908808641Z     mod = importlib.import_module(module)

2022-05-07T19:41:23.908815141Z   File "/opt/python/3.9.7/lib/python3.9/importlib/__init__.py", line 127, in import_module

2022-05-07T19:41:23.908821641Z     return _bootstrap._gcd_import(name[level:], package, level)

2022-05-07T19:41:23.908827341Z   File "<frozen importlib._bootstrap>", line 1030, in _gcd_import

2022-05-07T19:41:23.908833841Z   File "<frozen importlib._bootstrap>", line 1007, in _find_and_load

2022-05-07T19:41:23.908840241Z   File "<frozen importlib._bootstrap>", line 986, in _find_and_load_unlocked

2022-05-07T19:41:23.908847041Z   File "<frozen importlib._bootstrap>", line 680, in _load_unlocked

2022-05-07T19:41:23.908853841Z   File "<frozen importlib._bootstrap_external>", line 850, in exec_module

2022-05-07T19:41:23.908860641Z   File "<frozen importlib._bootstrap>", line 228, in _call_with_frames_removed

2022-05-07T19:41:23.908866941Z   File "/tmp/8da3060ad1f6c95/app.py", line 5, in <module>

2022-05-07T19:41:23.908873641Z     init_app()

2022-05-07T19:41:23.908879642Z   File "/tmp/8da3060ad1f6c95/ppart/__init__.py", line 27, in init_app

2022-05-07T19:41:23.910973268Z     from .auth import auth as auth_blueprint

2022-05-07T19:41:23.911003968Z   File "/tmp/8da3060ad1f6c95/ppart/auth.py", line 13, in <module>

2022-05-07T19:41:23.911063869Z     from ppart.forms import ForgotForm, LoginForm, PasswordResetForm, RegistrationForm

2022-05-07T19:41:23.911072169Z   File "/tmp/8da3060ad1f6c95/ppart/forms.py", line 1, in <module>

2022-05-07T19:41:23.911082369Z     from tkinter.tix import Form

2022-05-07T19:41:23.911089769Z   File "/opt/python/3.9.7/lib/python3.9/tkinter/__init__.py", line 37, in <module>

2022-05-07T19:41:23.911097369Z     import _tkinter # If this fails your Python may not be configured for Tk

2022-05-07T19:41:23.911104569Z ImportError: libtk8.6.so: cannot open shared object file: No such file or directory

2022-05-07T19:41:23.911111869Z [2022-05-07 19:41:23 +0000] [38] [INFO] Worker exiting (pid: 38)

2022-05-07T19:41:24.020200224Z [2022-05-07 19:41:24 +0000] [37] [INFO] Shutting down: Master

2022-05-07T19:41:24.020524228Z [2022-05-07 19:41:24 +0000] [37] [INFO] Reason: Worker failed to boot.



2022-05-07T19:41:25.030Z ERROR - Container padelpartner_0_a8cc2102 for site padelpartner has exited, failing site start

2022-05-07T19:41:25.046Z ERROR - Container padelpartner_0_a8cc2102 didn't respond to HTTP pings on port: 8000, failing site start. See container logs for debugging.

2022-05-07T19:41:25.062Z INFO  - Stopping site padelpartner because it failed during startup.
Azure App Service
Azure App Service
Azure App Service is a service used to create and deploy scalable, mission-critical web apps.
8,965 questions
{count} votes

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.