ImportError: No named '_tkinter', please install the python3-tk package
up vote
12
down vote
favorite
I am new to Ubuntu and Linux in general.
I created a dual boot OS on my laptop (Windows 10 and Ubuntu).
- Typing:
sudo apt-get install python3-tk
(or evenpython-tk
) didn't work. - Trying to install the
python3-dev
orpython-devel
(no luck). - Downloading Tcl and Tk to manually install.
In Windows 10 Bash Subsystem the Tk and Tcl are already included, so I thought Ubuntu already had it. But, I want to use my Ubuntu desktop to develop Python GUI apps.
So, how can I install the Tcl/Tk to be use in Python 3.5 for GUI development?
I loaded Python 3.5.2 fine but need the GUI modules enabled.
The code to test that Tk is working is:
- Type
python3
Type:
import tkinter
tkinter._test()
Result: a GUI pop-up displaying
This is a Tcl/Tk version..
python3
add a comment |
up vote
12
down vote
favorite
I am new to Ubuntu and Linux in general.
I created a dual boot OS on my laptop (Windows 10 and Ubuntu).
- Typing:
sudo apt-get install python3-tk
(or evenpython-tk
) didn't work. - Trying to install the
python3-dev
orpython-devel
(no luck). - Downloading Tcl and Tk to manually install.
In Windows 10 Bash Subsystem the Tk and Tcl are already included, so I thought Ubuntu already had it. But, I want to use my Ubuntu desktop to develop Python GUI apps.
So, how can I install the Tcl/Tk to be use in Python 3.5 for GUI development?
I loaded Python 3.5.2 fine but need the GUI modules enabled.
The code to test that Tk is working is:
- Type
python3
Type:
import tkinter
tkinter._test()
Result: a GUI pop-up displaying
This is a Tcl/Tk version..
python3
2
" I loaded Python 3.5.2" - how exactly? if you are running a manually installed python then installing system python packages with apt-get is unlikely to help
– steeldriver
Aug 23 '16 at 17:07
1
I saw that your answer to your own question is to compile Tcl/Tk from source but I don't think that is needed unless you manually installed Python, i.e., without using the Apt package manager. Can you clarify if you had installed Python manually? Installingpython3-tk
and then running the Python code you provided works on my system Python 3.
– edwinksl
Aug 28 '17 at 17:15
add a comment |
up vote
12
down vote
favorite
up vote
12
down vote
favorite
I am new to Ubuntu and Linux in general.
I created a dual boot OS on my laptop (Windows 10 and Ubuntu).
- Typing:
sudo apt-get install python3-tk
(or evenpython-tk
) didn't work. - Trying to install the
python3-dev
orpython-devel
(no luck). - Downloading Tcl and Tk to manually install.
In Windows 10 Bash Subsystem the Tk and Tcl are already included, so I thought Ubuntu already had it. But, I want to use my Ubuntu desktop to develop Python GUI apps.
So, how can I install the Tcl/Tk to be use in Python 3.5 for GUI development?
I loaded Python 3.5.2 fine but need the GUI modules enabled.
The code to test that Tk is working is:
- Type
python3
Type:
import tkinter
tkinter._test()
Result: a GUI pop-up displaying
This is a Tcl/Tk version..
python3
I am new to Ubuntu and Linux in general.
I created a dual boot OS on my laptop (Windows 10 and Ubuntu).
- Typing:
sudo apt-get install python3-tk
(or evenpython-tk
) didn't work. - Trying to install the
python3-dev
orpython-devel
(no luck). - Downloading Tcl and Tk to manually install.
In Windows 10 Bash Subsystem the Tk and Tcl are already included, so I thought Ubuntu already had it. But, I want to use my Ubuntu desktop to develop Python GUI apps.
So, how can I install the Tcl/Tk to be use in Python 3.5 for GUI development?
I loaded Python 3.5.2 fine but need the GUI modules enabled.
The code to test that Tk is working is:
- Type
python3
Type:
import tkinter
tkinter._test()
Result: a GUI pop-up displaying
This is a Tcl/Tk version..
python3
python3
edited Feb 14 at 11:10
Zanna
49.1k13123234
49.1k13123234
asked Aug 23 '16 at 16:54
MaximoTrinidad
69114
69114
2
" I loaded Python 3.5.2" - how exactly? if you are running a manually installed python then installing system python packages with apt-get is unlikely to help
– steeldriver
Aug 23 '16 at 17:07
1
I saw that your answer to your own question is to compile Tcl/Tk from source but I don't think that is needed unless you manually installed Python, i.e., without using the Apt package manager. Can you clarify if you had installed Python manually? Installingpython3-tk
and then running the Python code you provided works on my system Python 3.
– edwinksl
Aug 28 '17 at 17:15
add a comment |
2
" I loaded Python 3.5.2" - how exactly? if you are running a manually installed python then installing system python packages with apt-get is unlikely to help
– steeldriver
Aug 23 '16 at 17:07
1
I saw that your answer to your own question is to compile Tcl/Tk from source but I don't think that is needed unless you manually installed Python, i.e., without using the Apt package manager. Can you clarify if you had installed Python manually? Installingpython3-tk
and then running the Python code you provided works on my system Python 3.
– edwinksl
Aug 28 '17 at 17:15
2
2
" I loaded Python 3.5.2" - how exactly? if you are running a manually installed python then installing system python packages with apt-get is unlikely to help
– steeldriver
Aug 23 '16 at 17:07
" I loaded Python 3.5.2" - how exactly? if you are running a manually installed python then installing system python packages with apt-get is unlikely to help
– steeldriver
Aug 23 '16 at 17:07
1
1
I saw that your answer to your own question is to compile Tcl/Tk from source but I don't think that is needed unless you manually installed Python, i.e., without using the Apt package manager. Can you clarify if you had installed Python manually? Installing
python3-tk
and then running the Python code you provided works on my system Python 3.– edwinksl
Aug 28 '17 at 17:15
I saw that your answer to your own question is to compile Tcl/Tk from source but I don't think that is needed unless you manually installed Python, i.e., without using the Apt package manager. Can you clarify if you had installed Python manually? Installing
python3-tk
and then running the Python code you provided works on my system Python 3.– edwinksl
Aug 28 '17 at 17:15
add a comment |
3 Answers
3
active
oldest
votes
up vote
12
down vote
sudo apt-get install python3-tk
Installs tkinter
for Python3.x.x
Sources:
https://stackoverflow.com/questions/6084416/tkinter-module-not-found-on-ubuntu
https://pythonprogramming.net/python-3-tkinter-basics-tutorial/
3
Note -- for python3.6 in which python3.5 was my default, I had to use ...install python3.6-tk....
– SteveJ
Dec 7 '17 at 16:50
+1. I would add for those reading this that tkinter does not seem to have a PyPI package so that using the Ubuntu package manager as suggested in this answer is the likely the next best option.
– dpritch
Jul 29 at 23:04
1
@dpritch There is a package available in the Universe repository called[ pypibrowser](packages.ubuntu.com/… which supplies the functionality I believe you are looking for. Cheers!
– Elder Geek
Aug 2 at 18:49
add a comment |
up vote
11
down vote
A note -- for a python 3.6 virtual environment with a system python 3.5 , I had to install;
sudo apt-get install python3.6-tk
My default python in ubuntu was 3.5, so when using a venv for 3.6, I would get an import error. Drove me crazy for a while.
[Edit: In response to Elders very reasonable request]
The repository for python3.6-tk (in my case) was the same for that of python 3.6
sudo add-apt-repository ppa:deadsnakes/ppa
The aforementioned repository has the python3.6-tk package available for both xenial and trusty as well as the very recently released Python 3.7.0 beta 2 release.
However, this answer will be dated once 3.6+ is mainstream on Ubuntu as I suspect it will be in the main repository.
1
Interesting. You might go so far as to explain which PPA you installed it from as as far as I can see python3.6-tk doesn't exist in the repositories at this moment.
– Elder Geek
Feb 19 at 13:55
1
@ElderGeek - Thank you, I made the edit.
– SteveJ
Mar 1 at 18:34
1
I made a further edit in an attempt to make it more current.
– Elder Geek
Mar 1 at 18:55
FINALLY! This is the worked for me whensudo apt-get install python3-tk
did not. Thanks
– Peter
Jun 13 at 12:39
add a comment |
up vote
0
down vote
This might be interesting when installing from source (which most python users won't):
After installing tcl and tk.
Go back to your version of Python, do make
. And, if multiple version of python
exist, do a make altinstall
.
- Open Python3.5
type:
import tkinter
tkinter._test()
results OK - pop GUI opened and working as expected.
2
-1 This will not be relevant to most people as most will install via package manager rather than from source.
– RockJake28
Jun 19 '17 at 10:36
added introduction, so it won't confuse and still might help someone
– mit
Nov 20 at 8:23
add a comment |
3 Answers
3
active
oldest
votes
3 Answers
3
active
oldest
votes
active
oldest
votes
active
oldest
votes
up vote
12
down vote
sudo apt-get install python3-tk
Installs tkinter
for Python3.x.x
Sources:
https://stackoverflow.com/questions/6084416/tkinter-module-not-found-on-ubuntu
https://pythonprogramming.net/python-3-tkinter-basics-tutorial/
3
Note -- for python3.6 in which python3.5 was my default, I had to use ...install python3.6-tk....
– SteveJ
Dec 7 '17 at 16:50
+1. I would add for those reading this that tkinter does not seem to have a PyPI package so that using the Ubuntu package manager as suggested in this answer is the likely the next best option.
– dpritch
Jul 29 at 23:04
1
@dpritch There is a package available in the Universe repository called[ pypibrowser](packages.ubuntu.com/… which supplies the functionality I believe you are looking for. Cheers!
– Elder Geek
Aug 2 at 18:49
add a comment |
up vote
12
down vote
sudo apt-get install python3-tk
Installs tkinter
for Python3.x.x
Sources:
https://stackoverflow.com/questions/6084416/tkinter-module-not-found-on-ubuntu
https://pythonprogramming.net/python-3-tkinter-basics-tutorial/
3
Note -- for python3.6 in which python3.5 was my default, I had to use ...install python3.6-tk....
– SteveJ
Dec 7 '17 at 16:50
+1. I would add for those reading this that tkinter does not seem to have a PyPI package so that using the Ubuntu package manager as suggested in this answer is the likely the next best option.
– dpritch
Jul 29 at 23:04
1
@dpritch There is a package available in the Universe repository called[ pypibrowser](packages.ubuntu.com/… which supplies the functionality I believe you are looking for. Cheers!
– Elder Geek
Aug 2 at 18:49
add a comment |
up vote
12
down vote
up vote
12
down vote
sudo apt-get install python3-tk
Installs tkinter
for Python3.x.x
Sources:
https://stackoverflow.com/questions/6084416/tkinter-module-not-found-on-ubuntu
https://pythonprogramming.net/python-3-tkinter-basics-tutorial/
sudo apt-get install python3-tk
Installs tkinter
for Python3.x.x
Sources:
https://stackoverflow.com/questions/6084416/tkinter-module-not-found-on-ubuntu
https://pythonprogramming.net/python-3-tkinter-basics-tutorial/
answered Aug 28 '17 at 19:49
Elder Geek
26.1k951124
26.1k951124
3
Note -- for python3.6 in which python3.5 was my default, I had to use ...install python3.6-tk....
– SteveJ
Dec 7 '17 at 16:50
+1. I would add for those reading this that tkinter does not seem to have a PyPI package so that using the Ubuntu package manager as suggested in this answer is the likely the next best option.
– dpritch
Jul 29 at 23:04
1
@dpritch There is a package available in the Universe repository called[ pypibrowser](packages.ubuntu.com/… which supplies the functionality I believe you are looking for. Cheers!
– Elder Geek
Aug 2 at 18:49
add a comment |
3
Note -- for python3.6 in which python3.5 was my default, I had to use ...install python3.6-tk....
– SteveJ
Dec 7 '17 at 16:50
+1. I would add for those reading this that tkinter does not seem to have a PyPI package so that using the Ubuntu package manager as suggested in this answer is the likely the next best option.
– dpritch
Jul 29 at 23:04
1
@dpritch There is a package available in the Universe repository called[ pypibrowser](packages.ubuntu.com/… which supplies the functionality I believe you are looking for. Cheers!
– Elder Geek
Aug 2 at 18:49
3
3
Note -- for python3.6 in which python3.5 was my default, I had to use ...install python3.6-tk....
– SteveJ
Dec 7 '17 at 16:50
Note -- for python3.6 in which python3.5 was my default, I had to use ...install python3.6-tk....
– SteveJ
Dec 7 '17 at 16:50
+1. I would add for those reading this that tkinter does not seem to have a PyPI package so that using the Ubuntu package manager as suggested in this answer is the likely the next best option.
– dpritch
Jul 29 at 23:04
+1. I would add for those reading this that tkinter does not seem to have a PyPI package so that using the Ubuntu package manager as suggested in this answer is the likely the next best option.
– dpritch
Jul 29 at 23:04
1
1
@dpritch There is a package available in the Universe repository called[ pypibrowser](packages.ubuntu.com/… which supplies the functionality I believe you are looking for. Cheers!
– Elder Geek
Aug 2 at 18:49
@dpritch There is a package available in the Universe repository called[ pypibrowser](packages.ubuntu.com/… which supplies the functionality I believe you are looking for. Cheers!
– Elder Geek
Aug 2 at 18:49
add a comment |
up vote
11
down vote
A note -- for a python 3.6 virtual environment with a system python 3.5 , I had to install;
sudo apt-get install python3.6-tk
My default python in ubuntu was 3.5, so when using a venv for 3.6, I would get an import error. Drove me crazy for a while.
[Edit: In response to Elders very reasonable request]
The repository for python3.6-tk (in my case) was the same for that of python 3.6
sudo add-apt-repository ppa:deadsnakes/ppa
The aforementioned repository has the python3.6-tk package available for both xenial and trusty as well as the very recently released Python 3.7.0 beta 2 release.
However, this answer will be dated once 3.6+ is mainstream on Ubuntu as I suspect it will be in the main repository.
1
Interesting. You might go so far as to explain which PPA you installed it from as as far as I can see python3.6-tk doesn't exist in the repositories at this moment.
– Elder Geek
Feb 19 at 13:55
1
@ElderGeek - Thank you, I made the edit.
– SteveJ
Mar 1 at 18:34
1
I made a further edit in an attempt to make it more current.
– Elder Geek
Mar 1 at 18:55
FINALLY! This is the worked for me whensudo apt-get install python3-tk
did not. Thanks
– Peter
Jun 13 at 12:39
add a comment |
up vote
11
down vote
A note -- for a python 3.6 virtual environment with a system python 3.5 , I had to install;
sudo apt-get install python3.6-tk
My default python in ubuntu was 3.5, so when using a venv for 3.6, I would get an import error. Drove me crazy for a while.
[Edit: In response to Elders very reasonable request]
The repository for python3.6-tk (in my case) was the same for that of python 3.6
sudo add-apt-repository ppa:deadsnakes/ppa
The aforementioned repository has the python3.6-tk package available for both xenial and trusty as well as the very recently released Python 3.7.0 beta 2 release.
However, this answer will be dated once 3.6+ is mainstream on Ubuntu as I suspect it will be in the main repository.
1
Interesting. You might go so far as to explain which PPA you installed it from as as far as I can see python3.6-tk doesn't exist in the repositories at this moment.
– Elder Geek
Feb 19 at 13:55
1
@ElderGeek - Thank you, I made the edit.
– SteveJ
Mar 1 at 18:34
1
I made a further edit in an attempt to make it more current.
– Elder Geek
Mar 1 at 18:55
FINALLY! This is the worked for me whensudo apt-get install python3-tk
did not. Thanks
– Peter
Jun 13 at 12:39
add a comment |
up vote
11
down vote
up vote
11
down vote
A note -- for a python 3.6 virtual environment with a system python 3.5 , I had to install;
sudo apt-get install python3.6-tk
My default python in ubuntu was 3.5, so when using a venv for 3.6, I would get an import error. Drove me crazy for a while.
[Edit: In response to Elders very reasonable request]
The repository for python3.6-tk (in my case) was the same for that of python 3.6
sudo add-apt-repository ppa:deadsnakes/ppa
The aforementioned repository has the python3.6-tk package available for both xenial and trusty as well as the very recently released Python 3.7.0 beta 2 release.
However, this answer will be dated once 3.6+ is mainstream on Ubuntu as I suspect it will be in the main repository.
A note -- for a python 3.6 virtual environment with a system python 3.5 , I had to install;
sudo apt-get install python3.6-tk
My default python in ubuntu was 3.5, so when using a venv for 3.6, I would get an import error. Drove me crazy for a while.
[Edit: In response to Elders very reasonable request]
The repository for python3.6-tk (in my case) was the same for that of python 3.6
sudo add-apt-repository ppa:deadsnakes/ppa
The aforementioned repository has the python3.6-tk package available for both xenial and trusty as well as the very recently released Python 3.7.0 beta 2 release.
However, this answer will be dated once 3.6+ is mainstream on Ubuntu as I suspect it will be in the main repository.
edited Nov 20 at 10:58
mit
1,13241319
1,13241319
answered Dec 7 '17 at 4:40
SteveJ
21626
21626
1
Interesting. You might go so far as to explain which PPA you installed it from as as far as I can see python3.6-tk doesn't exist in the repositories at this moment.
– Elder Geek
Feb 19 at 13:55
1
@ElderGeek - Thank you, I made the edit.
– SteveJ
Mar 1 at 18:34
1
I made a further edit in an attempt to make it more current.
– Elder Geek
Mar 1 at 18:55
FINALLY! This is the worked for me whensudo apt-get install python3-tk
did not. Thanks
– Peter
Jun 13 at 12:39
add a comment |
1
Interesting. You might go so far as to explain which PPA you installed it from as as far as I can see python3.6-tk doesn't exist in the repositories at this moment.
– Elder Geek
Feb 19 at 13:55
1
@ElderGeek - Thank you, I made the edit.
– SteveJ
Mar 1 at 18:34
1
I made a further edit in an attempt to make it more current.
– Elder Geek
Mar 1 at 18:55
FINALLY! This is the worked for me whensudo apt-get install python3-tk
did not. Thanks
– Peter
Jun 13 at 12:39
1
1
Interesting. You might go so far as to explain which PPA you installed it from as as far as I can see python3.6-tk doesn't exist in the repositories at this moment.
– Elder Geek
Feb 19 at 13:55
Interesting. You might go so far as to explain which PPA you installed it from as as far as I can see python3.6-tk doesn't exist in the repositories at this moment.
– Elder Geek
Feb 19 at 13:55
1
1
@ElderGeek - Thank you, I made the edit.
– SteveJ
Mar 1 at 18:34
@ElderGeek - Thank you, I made the edit.
– SteveJ
Mar 1 at 18:34
1
1
I made a further edit in an attempt to make it more current.
– Elder Geek
Mar 1 at 18:55
I made a further edit in an attempt to make it more current.
– Elder Geek
Mar 1 at 18:55
FINALLY! This is the worked for me when
sudo apt-get install python3-tk
did not. Thanks– Peter
Jun 13 at 12:39
FINALLY! This is the worked for me when
sudo apt-get install python3-tk
did not. Thanks– Peter
Jun 13 at 12:39
add a comment |
up vote
0
down vote
This might be interesting when installing from source (which most python users won't):
After installing tcl and tk.
Go back to your version of Python, do make
. And, if multiple version of python
exist, do a make altinstall
.
- Open Python3.5
type:
import tkinter
tkinter._test()
results OK - pop GUI opened and working as expected.
2
-1 This will not be relevant to most people as most will install via package manager rather than from source.
– RockJake28
Jun 19 '17 at 10:36
added introduction, so it won't confuse and still might help someone
– mit
Nov 20 at 8:23
add a comment |
up vote
0
down vote
This might be interesting when installing from source (which most python users won't):
After installing tcl and tk.
Go back to your version of Python, do make
. And, if multiple version of python
exist, do a make altinstall
.
- Open Python3.5
type:
import tkinter
tkinter._test()
results OK - pop GUI opened and working as expected.
2
-1 This will not be relevant to most people as most will install via package manager rather than from source.
– RockJake28
Jun 19 '17 at 10:36
added introduction, so it won't confuse and still might help someone
– mit
Nov 20 at 8:23
add a comment |
up vote
0
down vote
up vote
0
down vote
This might be interesting when installing from source (which most python users won't):
After installing tcl and tk.
Go back to your version of Python, do make
. And, if multiple version of python
exist, do a make altinstall
.
- Open Python3.5
type:
import tkinter
tkinter._test()
results OK - pop GUI opened and working as expected.
This might be interesting when installing from source (which most python users won't):
After installing tcl and tk.
Go back to your version of Python, do make
. And, if multiple version of python
exist, do a make altinstall
.
- Open Python3.5
type:
import tkinter
tkinter._test()
results OK - pop GUI opened and working as expected.
edited Nov 20 at 11:07
mit
1,13241319
1,13241319
answered Aug 23 '16 at 17:35
MaximoTrinidad
69114
69114
2
-1 This will not be relevant to most people as most will install via package manager rather than from source.
– RockJake28
Jun 19 '17 at 10:36
added introduction, so it won't confuse and still might help someone
– mit
Nov 20 at 8:23
add a comment |
2
-1 This will not be relevant to most people as most will install via package manager rather than from source.
– RockJake28
Jun 19 '17 at 10:36
added introduction, so it won't confuse and still might help someone
– mit
Nov 20 at 8:23
2
2
-1 This will not be relevant to most people as most will install via package manager rather than from source.
– RockJake28
Jun 19 '17 at 10:36
-1 This will not be relevant to most people as most will install via package manager rather than from source.
– RockJake28
Jun 19 '17 at 10:36
added introduction, so it won't confuse and still might help someone
– mit
Nov 20 at 8:23
added introduction, so it won't confuse and still might help someone
– mit
Nov 20 at 8:23
add a comment |
Thanks for contributing an answer to Ask Ubuntu!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Some of your past answers have not been well-received, and you're in danger of being blocked from answering.
Please pay close attention to the following guidance:
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2faskubuntu.com%2fquestions%2f815874%2fimporterror-no-named-tkinter-please-install-the-python3-tk-package%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
2
" I loaded Python 3.5.2" - how exactly? if you are running a manually installed python then installing system python packages with apt-get is unlikely to help
– steeldriver
Aug 23 '16 at 17:07
1
I saw that your answer to your own question is to compile Tcl/Tk from source but I don't think that is needed unless you manually installed Python, i.e., without using the Apt package manager. Can you clarify if you had installed Python manually? Installing
python3-tk
and then running the Python code you provided works on my system Python 3.– edwinksl
Aug 28 '17 at 17:15