Open adriangabura opened 2 years ago
Also happening on Fedora 36
Also happening on Fedora 36
Yeah clearly. This package does not check for the kind of distro. Will all due respect to Debian, that's not the only distro by far.
So after a bit of digging it seems like the error actually originated from the Mouseinfo package which seems to have some issue with import tkinter in fedora. I’ll do a bit more testing but it might be a good idea to make an issue on the that library.
I believe it’s this repo https://github.com/asweigart/mouseinfo
So after a bit of digging it seems like the error actually originated from the Mouseinfo package which seems to have some issue with import tkinter in fedora. I’ll do a bit more testing but it might be a good idea to make an issue on the that library.
@MaximumMaxxx Do you incidentally use pyenv?
I use pyenv and when I had pyenv global set not to system but to another version it had problems importing tkinter.
Besides tkinter is in the standard library so it should be compiled in the build as far as I can say...
This code gave a ModuleNotFoundError:
python -c "import tkinter"
That makes sense, I was using the builtin venv but seems like that’s what the issue is. I’ll mess with my venv config to see if that solves it.
On Arch Linux, sudo pacman -S tk
works for installing pyautogui
sudo pacman -S tk thanks it's working
if anyone is having this problem on ubuntu, this may help
NOTE: You must install Tkinter on Linux to use MouseInfo. Run the following: sudo apt-get install python3-tk python3-dev
i had this problem too, even with sudo apt-get install python3-tk python3-dev
it ditn't work.
firstly try to run this command specifying python version, for example, in python 3.10:
sudo apt-get install python3.10-tk python3-dev
if the above command doesn't solve, after hours of despair i found this topic how to install tkinter for python 3.8, there is this tutorial
basically i solved my problem by doing this:
recompile and reinstall python3.10 specifying path to folders with tcl, tk includes and libraries
sudo apt install build-essential zlib1g-dev libncurses5-dev libgdbm-dev libnss3-dev libssl-dev libreadline-dev libffi-dev python-tk python3-tk tk-dev
reinstall python 3.10
wget https://www.python.org/ftp/python/3.10.0/Python-3.10.0.tgz
tar -xvf Python-3.10.0.tgz
edit configure
cd Python-3.10.0
vim ./configure
search for with-tcltk-includes/with-tcltk-libs and replace part in "...", looking like this:
--with-tcltk-includes='-I/usr/include'
--with-tcltk-libs='-L/usr/lib'
hint: for search in vim \phrase to search
then run
./configure
make -j2
sudo make install
sudo ./configure --with-tcltk-includes='-I/usr/include -I/usr/include/tcl' --with-tcltk-libs='-L/usr/lib -ltcl -ltk' --enable-optimizations
note: replace 2 on command "make -j2" by number of processor cores
Any solution? Daniela's method did not work for me on Ubuntu. I'm just trying to use pyautogui on ubuntu so I can free up my mac for other things.
Took me less than a minute to run my script on Mac and I've spent 4 hours troubleshooting just to get it running on linux with absolutely no solutions.
TL;DR @covalspace for me, it was a matter of switching pyenv back to the system installed python with pyenv global system
.
The instructions that tell you to sudo apt-get install
are installing tk to the system version of python. Since I was using pyenv to use a newer version of python my python move_mouse.py
script wasn't using the same version that had the tk libs available. Once I changed back to the system python I did another pip install pyautogui
and everything worked as expected.
Ok so basically you're saying I am forced to use an out of date version of python because Linux requires "tkinter" to install pyautogui?
That is unacceptable by my standards.
I just ran my script on a mac VM in my Mac and am a happy boy.
I am beginning to believe that Linux is the absolute worst option available for anything that isn't ultra privacy related.
I am using fedora 38. Upon installing the python3-tkinter
package the problem was fixed.
sudo dnf install python3-tkinter
Just in case anyone else using the same setting: I use homebrew-linux on ubuntu to install my python environment
To get tk working, you need to brew install python-tk@3.?
where 3.?
is the version of interpreter you are using.
Using fedora 39 here and running Python 3.11 in my venv with the dependencies installed using sudo dnf install python3-tkinter python3-devel
did not solve the issue.
The only solution that worked for me was to use Python 3.10 instead and install the dependencies on it.
Using fedora 39 here and running Python 3.11 in my venv with the dependencies installed using
sudo dnf install python3-tkinter python3-devel
did not solve the issue.The only solution that worked for me was to use Python 3.10 instead and install the dependencies on it.
You run it on venv? That could be the issue. Check for yourself if tkinter is even imported. And make sure that you check on the system python for which you installed the packages. Use which to check what python path you're executing. If there is something related to tkinter, the issue has nothing to do with pyautogui. So check that first.
On Arch Linux,
sudo pacman -S tk
works for installing pyautogui
worked for me, thanks.
I am using fedora 38. Upon installing the
python3-tkinter
package the problem was fixed.
sudo dnf install python3-tkinter
If anyone stumbles on this issue, for Fedora run the below 2 commands, and the issue will be fixed.
sudo dnf install python3-tkinter
yum install python-devel
Hi, I run Fedora 35 Workstation, what apt is this talking about even?
I installed all dependencies from Fedora repositories python3-tkinter, python3-devel and python3-xlib. I still get this.