No matching distribution found for tkinter - python

I am stuck with this issue since last two days and I have tried every possible solution on the stack and github. It will be really great if someone can recommend.
I am working with python 2.7 in a virtual environment on CentOS Linux release 7.3.1611.
I am running a script that uses matplotlib.pyplot and on run gives this error
import matplotlib.pyplot as plt
File "/usr/local/packages/Python-2.7/lib/python2.7/lib-tk/Tkinter.py", line 39, in <module>
import _tkinter # If this fails your Python may not be configured for Tk
ImportError: No module named _tkinter
I tried to install tkinter using -
pip install tkinter and it gave this error
Could not find a version that satisfies the requirement tkinter (from versions: )
No matching distribution found for tkinter
then I even installed -
sudo yum install tk
sudo yum install tk-devel
sudo yum install tc
and it says packages are already installed and nothing to to
I have set up my virtual environment again to see if I missed something but I cannot get anywhere. Please help!

Try this
sudo apt-get install python3-tk
this worked for me

Try with apt-get install python-tk

had same issue: yum install tkinter for CentOS and RedHat for python 2.x!

For people still experiencing this issue, try to change your Python project interpreter. Tkinter should be included by default, but it is possible that your distribution does not have it included. Always download the latest base interpreter from the official site.

I had the same error as you, I try installing dependencies, tk/tcl, but it didn't work. Finally I solved it using:
sudo apt-get update
sudo apt-get install python-tk
on ubuntu16.04

sudo yum install python-tools -y
This worked for me on Amazon Linux 2.

Since you are using python 2.7 tkinter is Tkinter. Try importing Tkinter.
https://docs.python.org/2/library/tkinter.html

Related

Unable to install pandas or other packages in linux virtual environment

I am unable to install module pandas in my linux vm. I tried all ways to install it, but it says it has version 1.1.5 requirement already satistied. But when I try running the code, it says, no module found. The latest version of python in it is 2.7.3, but I want to install 3.8 or 3.7, but I'm unable to. Where am I going wrong?
Did you try installing python3 from your package manager? You can install python 3.9 from apt using the below command
apt install python3 pip -y
You can also install the below package to use python in the terminal instead of python3 every time
apt install python-is-python3 -y
I cant comment yet so using the answer section, kindly give me an upvote so I can start using the comment feature, sorry for the trouble

How to install tkinker for Python 3.4 on Ubuntu 14.10

I'm a beginner to Python.
I'm using Python 3.4 on my Ubuntu 14.10.
I wanted to install tkinter on to my PyCharm IDE.
I did some research and found out that there are two different names for it on Python2 and Python3, Tkinter and tkinter respectively.
So, I wanted to know how to install it for Python 3.4 on Ubuntu.
You can try these methods
sudo apt-get build-dep python3-tk
sudo apt-get install python3-tk
if it hasn't been worked tell me

Installing wxpython on ubuntu 14.04

When I try to open PlayOnLinux from the commandline, I get this error:
Looking for python... 2.7.8 - selected
Traceback (most recent call last):
File "mainwindow.py", line 31, in <module>
import wxversion
ImportError: No module named wxversion
Nearly every forum post I have found has suggested I install wxPython, then links here or to some other wxpython wiki page. Unfortunately, the entire wxpython wiki website currently says "wxPyWiki is down for troubleshooting" right now.
I found this StackOverflow question, which is basically the same as mine. I tried all the lower-voted comments, and they all appear to work, but import wx still fails. When I tried the top-rated comment in that thread, I got to step 7 successfully, but then it says
In file included from scr/helpers.cpp:16:0:
include/wx/wxPython/wxPython_int.h:19:19: fatal error: wx/wx.h: No such file or directory
#include <wx/wx.h>
compilation terminated
If anyone has any suggestions for how I can properly install wxPython on Ubuntu, they would be greatly appreciated.
EDIT: sudo pip install wxPython tells me it's already installed ("Requirement already satisfied") and suggests I use --upgrade. It's not installed, import wx still fails.
EDIT: sudo apt-get install wxpython gives the error Unable to locate package wxpython
EDIT: I tried sudo apt-get install python-wxglade and it appeared to work, but playonlinux still gives the same error and import wx still fails.
EDIT: I tried uninstalling and reinstalling playonlinux and python-wxversion. Both remove/install appeared successful, but I still get the same No module named wxversion error.
EDIT: I tried the solutions posted here (except for reinstalling the OS). They did not work. I'd rather not reinstall Ubuntu.
Before that install gtk3
$ sudo apt-get install libgtk-3-dev
If you are facing problem to install wxpython on Python3 please use this command to install wxpython
$ pip install -U -f https://extras.wxpython.org/wxPython4/extras/linux/gtk3/ubuntu-16.04 wxPython
By this command you can install latest wxPython4 version.
If you are using Windows or macOS
$ pip install -U wxpython
If you are using Anaconda/Conda
$ conda install -C anaconda wxpython
The answer about installing "python-wxgtk2.8" is correct. But that's if you want to install 2.8, if you want 3.0 in 14.04, you can get it by following this post. I have done that, and have wx 3.0 installed.
All you need is:
sudo apt-get install python-wxgtk3.0
Try installing python-wxglade.It must have all necessary wx modules inside.
Check Synaptic for wxPython 3.x to see if you can install it that way. According to https://www.playonlinux.com/en/news.html, version 4.2.5 of PlayOnLinux supports wxPython 3. If you can't get Synaptic to find a copy of wxPython 3, then you should refer to the official build instructions found here:
http://wxpython.org/builddoc.php
wxPython package is named "python-wxgtk2.8" for wxWidgets 2.8
Install it: sudo apt-get install python-wxgtk2.8
I tried many things, so I'm not sure if this is the minimum set of pre-requisites.
$ sudo apt-get install libwxbase3.0-dev libwxgtk3.0-dev wx-common libwebkit-dev libwxgtk-webview3.0-dev wx3.0-examples wx3.0-headers wx3.0-i18n libwxgtk-media3.0-dev
Then I pip installed the Phoenix version:
$ sudo pip install --upgrade --pre -f http://wxpython.org/Phoenix/snapshot-builds/ --trusted-host wxpython.org wxPython_Phoenix
This installs wxPython via pip, but I don't think it addresses your issue with wxversion.

ImportError: No module names 'matplotlib' Python 3.3

I'm new to python (started 2 days ago) and I have gotten to the point where I want to use matplotlib for my program. I am using python 3.3 and after I have followed the instructions of installing matplotlib I've gone through the following steps:
sudo apt-get install python-pip
sudo pip install matplotlib
That returned this import error:
ImportError: No module named 'matplotlib'
So after some research I tried this:
sudo apt-get update
sudo apt-get build-dep python-matplot
I'm still getting the same import error. I have found this page here: https://askubuntu.com/questions/427708/matplotlib-error-no-module-named-matplotlib-even-though-it-is-installed
This has given me the impression that I have installed the incorrect version of matplotlib and that I need v1.2 or higher. Can someone explain to me what I need to do to be able to use matplotlib and not get this error with Python 3.3?
I'm currently using Ubuntu 12.04.
Thank you.
On my Mint 17 I just did, with Python 3.4 (would recommend that as you just start with Python, unless you need some library which does not yet support 3.4):
sudo pip3 install matplotlib
Then test the install:
python3
import matplotlib
matplotlib.__version__
Should give you '1.4.0'
I am using python3 installed through anaconda3 on Ubuntu 16.04.
sudo <path to anaconda>/anaconda3/bin/conda install matplotlib
Path to anaconda installation directory can be found using:
conda info --envs

how to install python distutils

I just got some space on a VPS server(running on ubuntu 8.04), and I'm trying to install django on it. The server has python 2.5 installed, but I guess its non standard installation. When I run install script for django, I get
amitoj#ninja:~/Django-1.2.1$ python setup.py install
Traceback (most recent call last):
File "setup.py", line 1, in <module>
from distutils.core import setup
ImportError: No module named distutils.core
I'm stumped. All the articles on internet tell me how to install modules using distutils. But how do I get distutils itself? Can anyone point me to the archive for distutils? I looked in /usr/lib/local/python2.5, /usr/lib/python2.5 etc, and as expected there is no distutils to be found.
I know this is an old question, but I just come across the same issue using Python 3.6 in Ubuntu, and I am able to solve it using the following command (this works in Ubuntu 18.04, 20.04 and 22.04):
sudo apt-get install python3-distutils
If you are unable to install with either of these:
sudo apt-get install python-distutils
sudo apt-get install python3-distutils
Try this instead:
sudo apt-get install python-distutils-extra
Ref: https://groups.google.com/forum/#!topic/beagleboard/RDlTq8sMxro
you can use sudo apt-get install python3-distutils by root permission.
i believe it worked here
You can install the python-distutils package. sudo apt-get install python-distutils should suffice.
I ran across this error on a Beaglebone Black using the standard Angstrom distribution. It is currently running Python 2.7.3, but does not include distutils. The solution for me was to install distutils. (It required su privileges.)
su
opkg install python-distutils
After that installation, the previously erroring command ran fine.
python setup.py build
The simplest way to install setuptools when it isn't already there and you can't use a package manager is to download ez_setup.py and run it with the appropriate Python interpreter. This works even if you have multiple versions of Python around: just run ez_setup.py once with each Python.
Edit: note that recent versions of Python 3 include setuptools in the distribution so you no longer need to install separately. The script mentioned here is only relevant for old versions of Python.
The module not found likely means the packages aren't installed.
Debian has decided that distutils is not a core python package, so it is not included in the last versions of debian and debian-based OSes. You should be able to do
sudo apt-get install python3-distutils
sudo apt-get install python3-apt
If you are in a scenario where you are using one of the latest versions of Ubuntu (or variants like Linux Mint), one which comes with Python 3.8, then you will NOT be able to have Python3.7 distutils, alias not be able to use pip or pipenv with Python 3.7, see:
How to install python-distutils for old python versions
Obviously using Python3.8 is no problem.
This didn't work for me: sudo apt-get install python-distutils
So, I tried this: sudo apt-get install python3-distutils
If the system Python is borked (i.e. the OS packages split distutils in a python-devel package) and you can’t ask a sysadmin to install the missing piece, then you’ll have to install your own Python. It requires some header files and a compiler toolchain. If you can’t have those, try compiling a Python on an identical computer and just copying it.
By searching all python-distutils related package:
apt-cache search x
I get python3-distutils-extra - enhancements to the Python3 build system
Then just try:
sudo apt-get install python3-distutils-extra

Categories