Software⏱️ 3 min read📅 2026-06-03

How to Fix: matplotlib error - no module named tkinter

Matplotlib error on Python 3.5.1 with Tkinter not found.

Quick Answer: Try installing the tk package separately, as it is required for matplotlib to work on Windows.

The error 'ImportError: No module named 'tkinter'' occurs when trying to use the matplotlib package in Python 3.x on Windows 10. This issue affects users who have recently installed Python 3.5.1 and are using PyCharm IDE.

This error can be frustrating, especially for developers who rely heavily on matplotlib for data visualization tasks. In this troubleshooting guide, we will walk you through the steps to resolve this issue.

💡 Why You Are Getting This Error

  • The primary reason for this error is that Python 3.x does not include the Tkinter library by default. Tkinter was included in Python 2.x, but it has been removed from Python 3.x.
  • Another possible cause could be a corrupted or outdated installation of matplotlib or PyCharm IDE.

✅ Best Solutions to Fix It

Installing Tkinter using Python's package manager

  1. Step 1: Open the Command Prompt or Terminal as an administrator on your Windows 10 system.
  2. Step 2: Type the command `python -m pip install tk` and press Enter to install Tkinter.

Installing a third-party library that provides a similar GUI interface

  1. Step 1: Install the 'wxPython' or 'PyQt5' library using pip by typing `pip install wxpython` or `pip install pyqt5` in the Command Prompt or Terminal.
  2. Step 2: Import the library in your Python script and use its GUI functions instead of matplotlib's.

✨ Wrapping Up

To resolve the 'matplotlib error - no module named tkinter' issue, you can try installing Tkinter using Python's package manager or install a third-party library that provides a similar GUI interface. By following these steps, you should be able to fix this error and continue working with matplotlib in your PyCharm IDE.

Did this fix your problem?

If not, try searching for specific error codes.

🔍 Search Error Database

❓ Frequently Asked Questions