I cannnot add Tkinter to package list

Answered
  • I am using  LINUX UBUNTU  and tried everything so the Tkinter module appear in the list of packages but it does not work.
    I have:
  • Installed directly on Linux using apt-get install
  • tried adding the directory to manage repositories

Nothing works.  I can use the basics with the TkBasic package available but it is not the original package

 

 

16 comments
Comment actions Permalink

Hello,

Have you added your system python as project interpreter to Pycharm(https://www.jetbrains.com/help/pycharm/2017.1/configuring-local-python-interpreters.html)? If so, Tkinter should appear in the packages list in Settings| Project| Project interpreter. 

0
Comment actions Permalink

I am using windows 7 64 bit with Python 64 bit. I am having the same issue. Tkinter isn't available. I have already set Python as my interpreter. I've also looked for Tkinter under the "Available Packages" by selecting the green "plus" button. I see several items, but none are Tkinter. Any help would be much appreciated.

0
Comment actions Permalink

HI Levipack! Could you please clarify what do you mean by "isn't available"? tkinter is in the standard Python library, so you don't need to install it.

0
Comment actions Permalink

I knew that! Just joking... I didn't know that! Boy, do I feel whatever the exact opposite of really smart is.

 

Thanks!!!

0
Comment actions Permalink

Hi, Folks!

 

I have the same problem: my Pycharm Comminity Version 2018.3 doesn't see tkinter module.

When running it pops out with the error.

0
Comment actions Permalink

Hi Pythontarium,

How does it go if you run your script outside of PyCharm (e.g. from the system terminal) using the same interpreter? Does the same error appear?

0
Comment actions Permalink

When I open the terminal and type:

python3 (press enter)

from tkinter import *
root = Tk()  (press enter)

It works and the window appears.
When I do the same thing in the pycharm ide, it give me an error.

ModuleNotFoundError: No module named 'tkinter'

I try to edit configurations and switch between interpreters, but it makes no difference. I try to install python3-tk and python3-tkinter and tkinter in the terminal, but I get the message that these modules are already installed.

0
Comment actions Permalink

@Tomandsusan4ever

What you need to do is to ensure that you're using the same interpreter and environment in PyCharm that you were using in the terminal where it was working.

Try the following:

1. In your system terminal, run `python3 -m tkinter` . Tkinter sample window should pop up indicating tkinter is installed and working

2. Open your PyCharm project, open the terminal, check your python version first with `python -V`, ensure it's python 3, and then do the same - `python -m tkinter`

If you get the error here, you're using different interpreter with no tkinter installed.

0
Comment actions Permalink

@Andrey Reslner

I followed those instruction: I got the sample window when I entered 'python3 -m tkinter' in terminal. When I entered python -V in the pycharm terminal, I got 'Python 2.7.15'. I've gone to Run> Edit Configurations > Python interpreter and selected a version of Python 3. I've even added python interpreters by going to  FIle > Settings > Project Interpreter and then adding to the list of interpreters. I have several Python 3 files which I select as interpreters, but none of them work and I still get the 'Python 2.7.15' in the terminal regardless of what ever I select.

0
Comment actions Permalink

Then, the problem is that your project is using python 2.x, not 3.x

Try to delete and recreate the interpreter. Provide screenshots of each step of the process, so I could understand where is the issue in your configuration.

Make sure you're following the documentation: https://www.jetbrains.com/help/pycharm/creating-virtual-environment.html

(I suggest creating a new virtualenv based on python 3.x)

0
Comment actions Permalink

@Andrey Resler

I've gone to File > Setting > Project Interpeter > (gear icon) > Add... > Virtualenv Environment. From there I can not delete any interpreters unless I navigate to the files where the python files are and delete them . I tried that once when I was having problems with Ubuntu and it totally screwed many of the programs in Ubuntu. It is my understanding that many programs in Linux run on python. When I enter the screen, python 3.7 is shown as the base interpreter. I select a different versions of python under the New Environment section, but whatever I pick, the OK button is inactive. I can select Existing Environment and navigate to versions of 3.7 such as the one in usr/bin. I apply the changes but it doesn't change the python -V in pycharm's terminal.

Under > System Interpreter I don't get an option for a 3 or 3.7. I can press the ... icon and navigate to one. Then I apply the changes, but the python -V in pycharm's terminal still reads 2.7.

Sorry I can't include screenshots. For some reason I can't access jetbrains forums with modzilla on my virtual machine.

 

0
Comment actions Permalink

>navigate to versions of 3.7 such as the one in usr/bin

This is a global system interpreter and should be configured as system interpreter, not virtual environment.

Try this:

1. Open interpreter list and delete ALL interpreters

2. Confirm that you have python3 interpreter in your system. Try `python -V` or `python3 -V`

2. Restart PyCharm, start a new project > Pure python > new virtual env > Select Python 3.7 as base interpreter, click OK

Which step produces and error? Please provide screenshot of the error (I seen that you have issues with screenshots, but otherwise your problem is very confusing and I can't understand it just using my imagination, unfortunately)

0
Comment actions Permalink

Well, I did have success with this. In PyCharm I went to File > Settings > Project: > Project Interpreter > click the drop down menu on the Project Interpreter > Show All... > (press '-' to delete all interpreters from the drop down menu. Then I quit and restarted the program. Then File > New Project > Then created new project. From there I went to File > Settings > Project: > Project Interpreter and selected Python 3.7. Now when I open the terminal in pycharm (located at the bottom of the pycharm window) and type python -V. I get the response Python 3.7.2.

Now I'm having a hard time getting tkinter installed.... I was able to install openpyxl an Pillow using "pip install openpyxl" in the terminal in pycharm, but "pip install tkinter" returns the error "Could not find a version that satisfies the requirement tkinter (from versions: ) No matching distribution found for tkinter." You did answer the orignal question though. Any further help would be appreciated.

0
Comment actions Permalink
Hi, tkinter is a standard python module and don't need to be installed. In python 3 it's imported like `import tkinter`, please try it.
0
Comment actions Permalink

@Jiri Fait
That is the case with python for windows. That is not the case with python for linux. I've tried many many times.

0

Please sign in to leave a comment.