Deep-Live-Cam icon indicating copy to clipboard operation
Deep-Live-Cam copied to clipboard

Python may not be configured for Tk

Open jordihm9 opened this issue 1 year ago • 2 comments

Hi, I already downloaded models and stored them on the models folder. I've also activated a virtual environment with python 3.10 using virtualenv (exactly, using v3.10.14). So I also installed dependencies as mentioned.

When running python run.py I got the following error.

Traceback (most recent call last):
  File "/Users/johernandez/workspace/Deep-Live-Cam/run.py", line 3, in <module>
    from modules import core
  File "/Users/johernandez/workspace/Deep-Live-Cam/modules/core.py", line 20, in <module>
    import modules.ui as ui
  File "/Users/johernandez/workspace/Deep-Live-Cam/modules/ui.py", line 3, in <module>
    import customtkinter as ctk
  File "/Users/johernandez/workspace/Deep-Live-Cam/venv/lib/python3.10/site-packages/customtkinter/__init__.py", line 5, in <module>
    from tkinter import Variable, StringVar, IntVar, DoubleVar, BooleanVar
  File "/opt/homebrew/Cellar/[email protected]/3.10.14_1/Frameworks/Python.framework/Versions/3.10/lib/python3.10/tkinter/__init__.py", line 37, in <module>
    import _tkinter # If this fails your Python may not be configured for Tk
ModuleNotFoundError: No module named '_tkinter

jordihm9 avatar Aug 11 '24 10:08 jordihm9

This Error appears when tk (tkinter) isn't installed in your system (not python module) brew install python-tk

burdukow avatar Aug 11 '24 10:08 burdukow

what worked for me:

  • installed tkinter as suggested above brew install python-tk
  • Then removed the previous venv, created a new one
  • in the new venv run pip with --force-reinstall. Just running pip install -r requirements.txt didn't work (cache I assume)

citizen-seven avatar Aug 11 '24 11:08 citizen-seven

Finally worked! I already had it installed, but a newer version.

If somebody else has the problem, use brew search python-tk to know which version it's intalled. I removed the one I had and then installed version 3.10.

jordihm9 avatar Aug 11 '24 17:08 jordihm9

@citizen-seven The steps mentioned above worked for me too, thank you.

TarikKaanKoc avatar Aug 12 '24 21:08 TarikKaanKoc