2

I'm just trying to make a simple GTK Hello World app run in Pycharm.

When I try to run this stuff, I first get the error

C:\Users\[...]\Anaconda3\python.exe C:/Users/[...]/PycharmProjects/HelloTk/hellotk.py
Traceback (most recent call last):
  File "C:/Users/[...]/PycharmProjects/HelloTk/hellotk.py", line 3, in <module>
    import pygtk
ImportError: No module named 'pygtk'

Which I tried to resolve by the instructions on SO: How do I import modules in Pycharm. However, this does not work for the error

Collecting PyGTK
  Using cached pygtk-2.24.0.tar.bz2
    Complete output from command python setup.py egg_info:
    ERROR: Could not import dsextras module: Make sure you have installed pygobject.

Which brought me to the next step, installing pygobject. At first, this failed because of a missing pkg-config, which I installed according the instructions on Stack Overflow How to install pkg config in windows?. This seemed to work, but I now get the error

Collecting PyGObject
  Using cached pygobject-2.28.3.tar.bz2
    Complete output from command python setup.py egg_info:
    * glib-2.0.pc could not be found, bindings for glib._glib will not be built.
    ERROR: Nothing to do, glib could not be found and is essential.

Googling more, I found Installing PygObject via PIP in virtualenv, but the solution is for Linux only.

Since ~2h since I installed PyCharm and Anaconda I'm trying to compile a stupid simple Hello World program. How do I make it work and what was I doing wrong?

Community
  • 1
  • 1
Thomas Weller
  • 55,411
  • 20
  • 125
  • 222

1 Answers1

1

You need to download the latest installer for windows from: https://sourceforge.net/projects/pygobjectwin32/files/?source=navbar

Also, you must make sure you are not running python 3.5 or newer, the last supported version seems to be 3.4.x for GTK.

It took me a few hours to figure this out as the installer completes without complaining at all on 3.5 as well, it just doesn't install the package.

Regards,

Hunor

Edit: so, while this sort of works to install, i still can't get quite a few things to work in it :(