Heroku Python3.5 Import Error: No module named = '_ tkinter'

When deploying to Heroku and adding custom buildpacks such as libspatialindex, another error occurred when Python 3.5 now searches for Tkinter.

Locally, installing with sudo apt-get tk-dev, this will be solved and try out the proposal for this similar problem: import matplotlib crash on Heroku , the error still persists.

Here are my buildpacks:

https://github.com/heroku/heroku-buildpack-apt 
heroku/python
https://github.com/julienfr112/libspatialindex-buildpack.git

And my aptfile containing only:

python3-tk
libpq-dev
build-essential
libncursesw5-dev
libreadline5-dev
libssl-dev
libgdbm-dev
libc6-dev
libsqlite3-dev tk-dev
libbz2-dev

On Heroku, click here the tail of the magazine:

2017-09-05T08:25:58.903075+00:00 app[web.1]:   File "/app/.heroku
/python/lib/python3.5/site-packages/six.py", line 82, in _import_module
2017-09-05T08:25:58.903076+00:00 app[web.1]:     __import__(name)
2017-09-05T08:25:58.903076+00:00 app[web.1]:   File "/app/.heroku
/python/lib/python3.5/tkinter/__init__.py", line 35, in <module>
2017-09-05T08:25:58.903076+00:00 app[web.1]:     import _tkinter 
# If this fails your Python may not be configured for Tk
2017-09-05T08:25:58.903077+00:00 app[web.1]: ImportError: No module
named '_tkinter'

Any ideas?

+1
source share
1 answer

matplotlib tkinter - . :

import matplotlib
matplotlib.use('Agg')

, , ( "Agg", "SVG" .. ..)

matplotlibrc : https://matplotlib.org/users/customizing.html#the-matplotlibrc-file

+1

Source: https://habr.com/ru/post/1016885/


All Articles