Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to install the pyautogui module on RedHat

I've been using the Python module pyautogui on Windows where it is fairly simple to install and need to install it on a RedHat server for work.

The official documentation gives the following instructions for Linux installation:

pip3 install python3-xlib

sudo apt-get install scrot

sudo apt-get install python3-tk

sudo apt-get install python3-dev

pip3 install pyautogui

Now, two things bother me with this:

1) It assumes using Python 3 but we're using Python 2. Does it imply that the module only exists for Python 3 in Linux? Because I have been using it for Python 2 on Windows.

2) Dependency-wise, it assumes using Debian's package manager APT, certainly these dependencies should be available on a RedHat system with yum.

I first decided to install python-xlib which is the Python 2 version of the first package and it worked.

Secondly I tried:

sudo yum install scrot

Which resulted in the error "No package Scrot available". Finding a dead-end this way, I tried to manually download the sources for Scrot and install it.

I followed the instructions:

$ wget http://linuxbrit.co.uk/downloads/scrot-0.8.tar.gz
$ tar -xvf scrot-0.8.tar.gz
$ cd /scrot-0.8
$ ./configure --prefix=/usr
$ make
$ su -c "make install"

Which only resulted in getting the error

checking whether to enable maintainer-specific portions of Makefiles... no
checking for giblib-config... no
checking for giblib - version >= 1.2.3... no
*** The giblib-config script installed by giblib could not be found
*** If giblib was installed in PREFIX, make sure PREFIX/bin is in
*** your path, or set the GIBLIB_CONFIG environment variable to the
*** full path to giblib-config.
configure: error: Cannot find giblib: Is giblib-config in the path?

I found some threads addressing the issue and roughly asking to install giblib. However, I failed in doing so. Again, I only found instructions to install it in Debian-like systems and could not find out how to install it on a RedHat system. So now I'm trying to download and install the sources of giblib but this is beginning messy, especially given the fact that I'll have to ask that pyautogui to be installed on our production servers and I don't see myself explaining to my boss such a tremendous and bulky procedure. That would get rejected right away.

So I am now asking for help, a perhaps better or easier way to install the Python pyautogui moduke for Python 2 on a RedHat system. Or maybe even a similar module, I could not find any, as simple and efficient to use, alternative.

If someone could help me on this, that would be really helpful and would save me a lot of work and dead-ends.

like image 637
Toussah Avatar asked Nov 08 '22 08:11

Toussah


1 Answers

I was facing the exact same issue, got into a loop of missing dependencies. Finally, someone helped me out, and it works.

yum install epel-release

yum install wget imlib2

wget http://packages.psychotic.ninja/7/base/x86_64/RPMS/scrot-0.8-12.el7.psychotic.x86_64.rpm

wget http://packages.psychotic.ninja/7/base/x86_64/RPMS/giblib-1.2.4-22.el7.psychotic.x86_64.rpm

rpm -Uvh giblib-1.2.4-22.el7.psychotic.x86_64.rpm

rpm -Uvh scrot-0.8-12.el7.psychotic.x86_64.rpm

And that's it. I was able to use PyAutoGUI after this.

like image 87
ScriptKiddieOnAComputer Avatar answered Nov 14 '22 21:11

ScriptKiddieOnAComputer