Opened 6 years ago

Closed 3 years ago

#569 closed defect (outdated)

No module named Tkinter when importing matplotlib

Reported by: chau Owned by: osgeo4w-dev@…
Priority: major Component: Package
Version: Keywords:
Cc:

Description

I am trying to make the following import in python 2.7.5 from OSGeo (x64):

import matplotlib.pyplot as plt

and I get the following error report:

Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "C:\OSGEO4~1\apps\Python27\lib\site-packages\matplotlib\pyplot.py", line 115, in <module>
    _backend_mod, new_figure_manager, draw_if_interactive, _show = pylab_setup()
  File "C:\OSGEO4~1\apps\Python27\lib\site-packages\matplotlib\backends\__init__.py", line 32, in pylab_setup
    globals(),locals(),[backend_name],0)
  File "C:\OSGEO4~1\apps\Python27\lib\site-packages\matplotlib\backends\backend_tkagg.py", line 6, in <module>
    from six.moves import tkinter as Tk
  File "C:\OSGEO4~1\apps\Python27\lib\site-packages\six.py", line 203, in load_module
    mod = mod._resolve()
  File "C:\OSGEO4~1\apps\Python27\lib\site-packages\six.py", line 115, in _resolve
    return _import_module(self.mod)
  File "C:\OSGEO4~1\apps\Python27\lib\site-packages\six.py", line 82, in _import_module
    __import__(name)
ImportError: No module named Tkinter

I cannot find any Tkinter package in the OSGeo setup package browser and normally OSGeo is really good at including dependencies.

My system is Windows 10.

Change History (2)

comment:1 by chau, 6 years ago

Okay, found out why it wouldn't work. I have to import python-tcltk: Python Tkinter and IDLE from Commandline_Utilities. Now I can make the import mentioned above.

Since matplotlib was already included in my OSGeo installation, shouldn't Tkinter also have been included, since it can be a dependency?

comment:2 by jef, 3 years ago

Resolution: outdated
Status: newclosed
Note: See TracTickets for help on using tickets.