Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ModuleNotFoundError: No module named 'tkinter' #21

Open
R3tr0BoiDX opened this issue Dec 18, 2019 · 6 comments
Open

ModuleNotFoundError: No module named 'tkinter' #21

R3tr0BoiDX opened this issue Dec 18, 2019 · 6 comments

Comments

@R3tr0BoiDX
Copy link

seaborn uses tkinter, which I dont have (and probably won't need for this)

Traceback (most recent call last): File "report.py", line 5, in <module> import seaborn as sns File "C:\Program Files\Python37\lib\site-packages\seaborn\__init__.py", line 6, in <module> from .rcmod import * File "C:\Program Files\Python37\lib\site-packages\seaborn\rcmod.py", line 5, in <module> from . import palettes, _orig_rc_params File "C:\Program Files\Python37\lib\site-packages\seaborn\palettes.py", line 12, in <module> from .utils import desaturate, set_hls_values, get_color_cycle File "C:\Program Files\Python37\lib\site-packages\seaborn\utils.py", line 11, in <module> import matplotlib.pyplot as plt File "C:\Program Files\Python37\lib\site-packages\matplotlib\pyplot.py", line 2349, in <module> switch_backend(rcParams["backend"]) File "C:\Program Files\Python37\lib\site-packages\matplotlib\pyplot.py", line 221, in switch_backend backend_mod = importlib.import_module(backend_name) File "C:\Program Files\Python37\lib\importlib\__init__.py", line 127, in import_module return _bootstrap._gcd_import(name[level:], package, level) File "C:\Program Files\Python37\lib\site-packages\matplotlib\backends\backend_tkagg.py", line 1, in <module> from . import _backend_tk File "C:\Program Files\Python37\lib\site-packages\matplotlib\backends\_backend_tk.py", line 6, in <module> import tkinter as tk ModuleNotFoundError: No module named 'tkinter'

@joshinils
Copy link

indeed, i do get the same error-message:

nils@niels:~/YouTube-Report$ python report.py
Traceback (most recent call last):
  File "report.py", line 8, in <module>
    import matplotlib.pyplot as plt
  File "/home/nils/.local/lib/python2.7/site-packages/matplotlib/pyplot.py", line 115, in <module>
    _backend_mod, new_figure_manager, draw_if_interactive, _show = pylab_setup()
  File "/home/nils/.local/lib/python2.7/site-packages/matplotlib/backends/__init__.py", line 63, in pylab_setup
    [backend_name], 0)
  File "/home/nils/.local/lib/python2.7/site-packages/matplotlib/backends/backend_tkagg.py", line 4, in <module>
    from . import tkagg  # Paint image to Tk photo blitter extension.
  File "/home/nils/.local/lib/python2.7/site-packages/matplotlib/backends/tkagg.py", line 5, in <module>
    from six.moves import tkinter as Tk
  File "/home/nils/.local/lib/python2.7/site-packages/six.py", line 203, in load_module
    mod = mod._resolve()
  File "/home/nils/.local/lib/python2.7/site-packages/six.py", line 115, in _resolve
    return _import_module(self.mod)
  File "/home/nils/.local/lib/python2.7/site-packages/six.py", line 82, in _import_module
    __import__(name)
  File "/usr/lib/python2.7/lib-tk/Tkinter.py", line 42, in <module>
    raise ImportError, str(msg) + ', please install the python-tk package'
ImportError: No module named _tkinter, please install the python-tk package

@joshinils
Copy link

and subsequent tries to install the suggested package also fail:

nils@niels:~/YouTube-Report$ pip install python-tk
Collecting python-tk
Exception:
Traceback (most recent call last):
  File "/usr/lib/python2.7/dist-packages/pip/basecommand.py", line 215, in main
    status = self.run(options, args)
  File "/usr/lib/python2.7/dist-packages/pip/commands/install.py", line 353, in run
    wb.build(autobuilding=True)
  File "/usr/lib/python2.7/dist-packages/pip/wheel.py", line 749, in build
    self.requirement_set.prepare_files(self.finder)
  File "/usr/lib/python2.7/dist-packages/pip/req/req_set.py", line 380, in prepare_files
    ignore_dependencies=self.ignore_dependencies))
  File "/usr/lib/python2.7/dist-packages/pip/req/req_set.py", line 554, in _prepare_file
    require_hashes
  File "/usr/lib/python2.7/dist-packages/pip/req/req_install.py", line 278, in populate_link
    self.link = finder.find_requirement(self, upgrade)
  File "/usr/lib/python2.7/dist-packages/pip/index.py", line 465, in find_requirement
    all_candidates = self.find_all_candidates(req.name)
  File "/usr/lib/python2.7/dist-packages/pip/index.py", line 423, in find_all_candidates
    for page in self._get_pages(url_locations, project_name):
  File "/usr/lib/python2.7/dist-packages/pip/index.py", line 568, in _get_pages
    page = self._get_page(location)
  File "/usr/lib/python2.7/dist-packages/pip/index.py", line 683, in _get_page
    return HTMLPage.get_page(link, session=self.session)
  File "/usr/lib/python2.7/dist-packages/pip/index.py", line 795, in get_page
    resp.raise_for_status()
  File "/usr/share/python-wheels/requests-2.18.4-py2.py3-none-any.whl/requests/models.py", line 935, in raise_for_status
    raise HTTPError(http_error_msg, response=self)
HTTPError: 404 Client Error: Not Found for url: https://pypi.org/simple/python-tk/

@SuperSandro2000
Copy link
Contributor

Did you untick tk when installing python on windows? It should be part of the standard library.

@joshinils
Copy link

no, i used ubuntu 18.04

@SuperSandro2000
Copy link
Contributor

You probably want to install python-tk or python3-tk. You can take a look at https://packages.ubuntu.com/eoan/python3-tk, too.

@joshinils
Copy link

i'm sorry i havent googled why i could not install python-tk, tkinter or as you suggested python3-tk using pip or pip3, using sudo apt install python-tk worked.

but now i still have another isse (#29), but this one is closed for me.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants