This probably means that Tcl wasn't installed properly. Tried all the solutions that I found in the internet. Just tryna do my homework. Please help

code:

import matplotlib.pyplot as plt


x = [1, 2, 3, 4, 5]
y = [2, 4, 6, 8, 10]


plt.plot(x, y)

plt.title('Simple Line Plot')
plt.xlabel('X-axis')
plt.ylabel('Y-axis')


plt.show()

Output:

C:\Users\USER\PycharmProjects\Hello\venv\Scripts\python.exe C:\Users\USER\PycharmProjects\Hello\matplot.py 
Traceback (most recent call last):
  File "C:\Users\USER\PycharmProjects\Hello\matplot.py", line 8, in <module>
    plt.plot(x, y)
    ~~~~~~~~^^^^^^
  File "C:\Users\USER\PycharmProjects\Hello\venv\Lib\site-packages\matplotlib\pyplot.py", line 3794, in plot
    return gca().plot(
           ~~~^^
  File "C:\Users\USER\PycharmProjects\Hello\venv\Lib\site-packages\matplotlib\pyplot.py", line 2742, in gca
    return gcf().gca()
           ~~~^^
  File "C:\Users\USER\PycharmProjects\Hello\venv\Lib\site-packages\matplotlib\pyplot.py", line 1093, in gcf
    return figure()
  File "C:\Users\USER\PycharmProjects\Hello\venv\Lib\site-packages\matplotlib\pyplot.py", line 1027, in figure
    manager = new_figure_manager(
        num, figsize=figsize, dpi=dpi,
        facecolor=facecolor, edgecolor=edgecolor, frameon=frameon,
        FigureClass=FigureClass, **kwargs)
  File "C:\Users\USER\PycharmProjects\Hello\venv\Lib\site-packages\matplotlib\pyplot.py", line 550, in new_figure_manager
    return _get_backend_mod().new_figure_manager(*args, **kwargs)
           ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^
  File "C:\Users\USER\PycharmProjects\Hello\venv\Lib\site-packages\matplotlib\backend_bases.py", line 3507, in new_figure_manager
    return cls.new_figure_manager_given_figure(num, fig)
           ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^
  File "C:\Users\USER\PycharmProjects\Hello\venv\Lib\site-packages\matplotlib\backend_bases.py", line 3512, in new_figure_manager_given_figure
    return cls.FigureCanvas.new_manager(figure, num)
           ~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "C:\Users\USER\PycharmProjects\Hello\venv\Lib\site-packages\matplotlib\backend_bases.py", line 1797, in new_manager
    return cls.manager_class.create_with_canvas(cls, figure, num)
           ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^
  File "C:\Users\USER\PycharmProjects\Hello\venv\Lib\site-packages\matplotlib\backends\_backend_tk.py", line 483, in create_with_canvas
    window = tk.Tk(className="matplotlib")
  File "C:\Program Files\Python313\Lib\tkinter\__init__.py", line 2459, in __init__
    self.tk = _tkinter.create(screenName, baseName, className, interactive, wantobjects, useTk, sync, use)
              ~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
_tkinter.TclError: Can't find a usable init.tcl in the following directories: 
    {C:/Program Files/Python313/lib/tcl8.6} C:/Users/USER/PycharmProjects/Hello/venv/lib/tcl8.6 C:/Users/USER/PycharmProjects/Hello/lib/tcl8.6 C:/Users/USER/PycharmProjects/Hello/venv/library C:/Users/USER/PycharmProjects/Hello/library C:/Users/USER/PycharmProjects/Hello/tcl8.6.14/library C:/Users/USER/PycharmProjects/tcl8.6.14/library



This probably means that Tcl wasn't installed properly.


Process finished with exit code 1

Tried copying the Tcl in the lib folder
Tried installing and reinstalling.

plz help

In order to preserve formatting, please select any code or traceback that you post and then click the </> button.

I’m so sorry, I am very new to this. What does that supposed to mean?

What you pasted is hard to read because, for example, Python uses # for comments but this forum uses it to mark headlines, so your code is displayed incorrectly.

If you paste code or a traceback (error messages) in the forum, you should select the code or traceback and then click the </> button to preserve its appearance and keep it readable.

Thanks, changed it.

1 Like

There is a bug in python 3.13.0 on windows when it runs in a venv see win 10 Python-3.13.0 tkinter fails in venv · Issue #125235 · python/cpython · GitHub

Perhaps pycharm is causing the same problem or running in a venv

1 Like