wavexx / screenkey

A screencast tool to display your keys inspired by Screenflick
https://www.thregr.org/~wavexx/software/screenkey/
GNU General Public License v3.0
757 stars 66 forks source link

Problems while installing (PyGTK) #74

Closed nihal111 closed 5 years ago

nihal111 commented 6 years ago

I ran into problems while installing screenkey. sudo ./setup.py install gave errors for both pycairo and PyGTK.

pycairo

pycairo did not install straight from the install script.

Solution

I had to manually install pycairo, only worked after I did- sudo apt-get install libcairo2-dev libjpeg-dev libgif-dev and then pip install pycairo to run. It threw a Package cairo was not found in the pkg-config search path. Comment on pycairo issue SO Ref


PyGTK

Installing pygtk was a real headache, even messed up my pip and setuptools. I tried installing using sudo pip install pygtk, only to get this error

Downloading from URL https://pypi.python.org/packages/7c/18/fa4f2de77500dd62a314fd845ff6e903ac2ce551164cb421c5750969f799/pygtk-2.24.0.tar.bz2#md5=a1051d5794fd7696d3c1af6422d17a49 (from https://pypi.python.org/simple/pygtk/)
  Running setup.py (path:/tmp/pip-build-cJ2V7E/pygtk/setup.py) egg_info for package pygtk
    ********************************************************************
    * Building PyGTK using distutils is only supported on windows. *
    * To build PyGTK in a supported way, read the INSTALL file.    *
    ********************************************************************
    Complete output from command python setup.py egg_info:
    ********************************************************************

* Building PyGTK using distutils is only supported on windows. *

* To build PyGTK in a supported way, read the INSTALL file.    *

********************************************************************

----------------------------------------
Cleaning up...
Command python setup.py egg_info failed with error code 1 in /tmp/pip-build-cJ2V7E/pygtk
Exception information:
Traceback (most recent call last):
  File "/usr/lib/python2.7/dist-packages/pip/basecommand.py", line 122, in main
    status = self.run(options, args)
  File "/usr/lib/python2.7/dist-packages/pip/commands/install.py", line 290, in run
    requirement_set.prepare_files(finder, force_root_egg_info=self.bundle, bundle=self.bundle)
  File "/usr/lib/python2.7/dist-packages/pip/req.py", line 1230, in prepare_files
    req_to_install.run_egg_info()
  File "/usr/lib/python2.7/dist-packages/pip/req.py", line 326, in run_egg_info
    command_desc='python setup.py egg_info')
  File "/usr/lib/python2.7/dist-packages/pip/util.py", line 716, in call_subprocess
    % (command_desc, proc.returncode, cwd))
InstallationError: Command python setup.py egg_info failed with error code 1 in /tmp/pip-build-cJ2V7E/pygtk

Reference which explains the same problem

Solution

I found this gist that installs PyGTK. (simple ./configure && make; stuff I believe). Running the install script still didn't allow me to proceed since PyGTK wasn't installed as a pip package. I had to modify the setup.py file and remove 'PyGTK' from the install_requires list.

After doing all this, I was finally able to get it to work. Hope this helps someone.

wavexx commented 6 years ago

On Fri, May 25 2018, Nihal Singh wrote:

I ran into problems while installing screenkey. sudo ./setup.py install gave errors for both pycairo and PyGTK.

This is not unsurprising. Language package managers such as pip will fail flatly on their face for anything but the simplest pure-python dependency.

pycairo

pycairo did not install straight from the install script.

Solution

I had to manually install pycairo, only worked after I did- sudo apt-get install libcairo2-dev libjpeg-dev libgif-dev and then pip install pycairo to run.

The README instructions for ubuntu/debian involve installing pygtk and pycairo via:

apt-get install python-gtk2

This should work correctly and install python-cairo as a dependency. This will also result in way less installed dependencies, as there's no need to have developer tools installed.

Is there a reason why this didn't work before attempting to install pygtk from source?

nihal111 commented 6 years ago

apt-get install python-gtk2

Oh, yes I had done that. Also had tried apt-get install python-gtk2-dev Neither stopped me from getting this error. I'm unsure why.

********************************************************************
* Building PyGTK using distutils is only supported on windows.  
* To build PyGTK in a supported way, read the INSTALL file.  

*********************************************************************
* Building PyGTK using distutils is only supported on windows. *

* To build PyGTK in a supported way, read the INSTALL file.    *
.
.
Command python setup.py egg_info failed with error code 1 in /tmp/pip-build-cJ2V7E/pygtk
ggodreau commented 6 years ago

Thanks @nihal111 this helped me out; here was my process:

sudo apt-get install python-gtk2

remove PyGTK from install_requires, line 33 of setup.py. Post edit looks as such:

      scripts=['screenkey'],
      packages=['Screenkey'],
      setup_requires=['setuptools', 'python-distutils-extra'],
      install_requires=['pycairo'],
      data_files=[('share/applications', ['data/screenkey.desktop']),
                  ('share/doc/screenkey', ['README.rst', 'NEWS.rst'])],