No module named '_tkinter'


#1

I noticed that the service started to use ufoym/deepo docker images.
The first time I started my environment I got this error:

/usr/local/lib/python3.6/dist-packages/h5py/__init__.py:36: FutureWarning: Conversion of the second argument of issubdtype from `float` to `np.floating` is deprecated. In future, it will be treated as `np.float64 == np.dtype(float).type`.
  from ._conv import register_converters as _register_converters
Traceback (most recent call last):
  File "/usr/lib/python3.6/tkinter/__init__.py", line 37, in <module>
    import _tkinter
ModuleNotFoundError: No module named '_tkinter'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/content/clouderizer/creativegan-portrait/code/main.py", line 11, in <module>
    from utils import *
  File "/content/clouderizer/creativegan-portrait/code/utils.py", line 6, in <module>
    import matplotlib.pyplot as plt
  File "/usr/local/lib/python3.6/dist-packages/matplotlib/pyplot.py", line 115, in <module>
    _backend_mod, new_figure_manager, draw_if_interactive, _show = pylab_setup()
  File "/usr/local/lib/python3.6/dist-packages/matplotlib/backends/__init__.py", line 62, in pylab_setup
    [backend_name], 0)
  File "/usr/local/lib/python3.6/dist-packages/matplotlib/backends/backend_tkagg.py", line 4, in <module>
    from . import tkagg  # Paint image to Tk photo blitter extension.
  File "/usr/local/lib/python3.6/dist-packages/matplotlib/backends/tkagg.py", line 5, in <module>
    from six.moves import tkinter as Tk
  File "/usr/local/lib/python3.6/dist-packages/six.py", line 92, in __get__
    result = self._resolve()
  File "/usr/local/lib/python3.6/dist-packages/six.py", line 115, in _resolve
    return _import_module(self.mod)
  File "/usr/local/lib/python3.6/dist-packages/six.py", line 82, in _import_module
    __import__(name)
  File "/usr/lib/python3.6/tkinter/__init__.py", line 39, in <module>
    raise ImportError(str(msg) + ', please install the python3-tk package')
ImportError: No module named '_tkinter', please install the python3-tk package

I solved it by following the hint given by the last line of the error, installing python3-tk. Here is the solution I used:
https://stackoverflow.com/questions/6084416/tkinter-module-not-found-on-ubuntu


#2

Yes. We released docker based setup yesterday. Thanks a lot for reporting this. We have not tested it on Ubuntu 18 yet.

I see that this error originates from your project python code. In case you code is dependent on python3-tk, you can easily add this package dependency in Clouderizer project settings -> Setup -> APT packages list. Now every time you run this project, this dependency will automatically be installed (if not already present).

Hope this helps.


#3

Thanks to pointing that out. I remove the “Report Issue” tag to the post.
I will try to add the dependency to the project setup.