peter.petrov
peter.petrov

Reputation: 39437

cairocffi - DLL cannot find entry point inflateReset2

I am trying to get cairocffi working on Windows 10.
I have 64 bit OS and 64 bit Python I am new to Python and I am having issues with that.

I did this by following exactly what cairocffi suggests.

To do this I downloaded and installed GTK+ first.

1) OK, so to install the cairo graphics library I installed
GTK+ as described here: https://www.gtk.org/download/windows.php

2) this step 1 goes through installing MSYS2 (http://www.msys2.org/)
so I followed the exact instructions for that too

3) Now when I try to import cairocffi from python I get this error

    C:\>python
    Python 3.6.3 (v3.6.3:2c5fed8, Oct  3 2017, 18:11:49) [MSC v.1900 64 bit (AMD64)] on win32
    Type "help", "copyright", "credits" or "license" for more information.
    >>> import cairocff
    Traceback (most recent call last):
      File "<stdin>", line 1, in <module>
    ModuleNotFoundError: No module named 'cairocff'
    >>> import cairocffi
    Traceback (most recent call last):
      File "<stdin>", line 1, in <module>
      File "C:\Programs\Python36\lib\site-packages\cairocffi\__init__.py", line 41, in <module>
        cairo = dlopen(ffi, 'cairo', 'cairo-2')
      File "C:\Programs\Python36\lib\site-packages\cairocffi\__init__.py", line 38, in dlopen
        raise OSError("dlopen() failed to load a library: %s" % ' / '.join(names))
    OSError: dlopen() failed to load a library: cairo / cairo-2

enter image description here

4) My PATH is pointing to C:\Programs\msys64\mingw64\bin already.
I can see some related cairo DLLs there.

C:\Programs\msys64\mingw64\bin>dir *cair*
 Volume in drive C is OS
 Volume Serial Number is BC61-492E

 Directory of C:\Programs\msys64\mingw64\bin

12/13/2017  03:10 AM         1,014,974 libcairo-2.dll
12/13/2017  03:10 AM            37,299 libcairo-gobject-2.dll
12/13/2017  03:10 AM           161,107 libcairo-script-interpreter-2.dll
09/04/2017  01:07 AM            64,920 libpangocairo-1.0-0.dll
               4 File(s)      1,278,300 bytes
               0 Dir(s)  115,848,929,280 bytes free

I was also quite cautious to install 64 bit packages only.

So I do not understand... Why I am getting this DLL entry point error?!

Could it be because the DLL is compiled with GCC for Windows while my Python distribution is compiled with MSC (Visual Studio compiler)?

Upvotes: 2

Views: 1039

Answers (1)

Danilo Mz
Danilo Mz

Reputation: 499

Suggested workaround which worked for me after facing a similar issue.

The cause seems to be related to a particular file (zlib1.dll), and checking my PATH variable I had multiple of these, used by different programs. What I did was to move the 'C:\Program Files\GTK3-Runtime Win64\bin' entry in the windows PATH to be the first entry (or place it before the other PATH entries referencing zlib1.dll). Haven't encountered any issues since then.

Upvotes: 3

Related Questions