Problem with cairo dll's

Hello All,

I installed wxPython 3.0 on a standard Python 2.7.6 installation 64bit. After wxPython 3.0, I check if cairo dll’s are installed.

Then I proceed to the installation of the demo, but cairo demos don’t work. Demo raises a RuntimeError, “Unable to find the Cairo shared library”. (see attached picture)
I tried to research the problem a little bit. Inside module wx.lib.wxcairo, in function _findCairoLib and after following the calls to ctypes , it seems
that the function ctypes.util.find_library is unable to find the installed libcairo-2.dll (which is installed in C:\Tools\Python27\Lib\site-packages\wx-3.0-msw\wx) because the path is not in the environment variable %PATH%. In the command line I try set PATH=%PATH%;C:\Tools\Python27\Lib\site-packages\wx-3.0-msw\wx. Then I open a python interpreter and I can assure ctypes.util.find_library(“libcairo-2”) returns the correct path to file C:\Tools\Python27\Lib\site-packages\wx-3.0-msw\wx\libcairo-2.dll, but the ctypes.CDLL(previous_path_with_file) returns the following error message:

Traceback (most recent call last):
File “”, line 1, in
File “C:\Tools\Python27\lib\ctypes_init_.py”, line 365, in init
self._handle = _dlopen(self._name, mode)
WindowsError: [Error 193] %1 is not a valid Win32 application

Now I’m stuck! My platform is Windows 8.1, Python 2.7.6 64bit, wxpython-3.0-64bit. All builds are standard builds for the Internet.
Any help would be greatly appreciated,
Costis Hatzopoulos,
Structural Engineer

“Module cairo not found” means that the installation is not complete.

Unfortunately the process of activating (py)cairo on Windows is less than intuitive. Please be advised that the following is written for Windows 8/Python 2.7/wxPython 3.0.1dev 32 bit (!).

If you search for cairo in the wxPython demo, you find two entries, cairo and cairo_snippets. If you scroll to the very last sentence, there is something like:

"Finally, there is an installer for the pycairo pacakge here:

http://wxpython.org/cairo/

".

Download py2cairo-1.10.0.win32-py2.7.exe and install (contrary to its name this allows you to “import cairo”).

Since wx 2.9 the cairo DLLs are already included, if the option has been selected on the binary installer (find the latest wx3.0.1dev-classic) from

http://wxpython.kosoftworks.com/preview/20140104/

However there will still remain the problem, that the py2cairo files on wxpython.org are 32 bit only and as far as I know mixing 32/64 bit python binaries does not work.

If you are stuck on 64 bit Python you can try the precompiled pycairo (sic!) library (64bit amd) from Christoph Gohlke

http://www.lfd.uci.edu/~gohlke/pythonlibs/

However, when I last tried with Christophs version (32 bit), it works well standalone (with the cairo DLLs directly downloaded from the GTK site), but not in combination with wx. It was just easier to use the way described above.

···

On Monday, May 19, 2014 6:41:47 PM UTC+2, Κωστής Χατζόπουλος wrote:

Hello All,

I installed wxPython 3.0 on a standard Python 2.7.6 installation 64bit. After wxPython 3.0, I check if cairo dll’s are installed.