Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

dlopen() fails on Windows #1

Closed
SimonSapin opened this issue Jan 9, 2013 · 8 comments
Closed

dlopen() fails on Windows #1

SimonSapin opened this issue Jan 9, 2013 · 8 comments

Comments

@SimonSapin
Copy link
Member

Reported by @randfb on Reddit:

http://www.reddit.com/r/Python/comments/165bbf/cairocffi_dropin_pycairo_replacement_installs/c7tjwo7
http://www.reddit.com/r/Python/comments/165bbf/cairocffi_dropin_pycairo_replacement_installs/c7tkae4

I can't install on windows. I had pycairo working fine.
I can do a:

import cairo

without errors, but not

import cairocffi as cairo

319 path = ctypes.util.find_library(name)
320 if path is None:
--> 321 raise OSError("library not found: %r" % (name,))
322 #
323 backend = ffi._backend

OSError: library not found: 'cairo'

It seems that dlopen() fails to find cairo.dll.

@randfb, how did you install pycairo and cairo?

@arigo
Copy link

arigo commented Jan 9, 2013

As you've seen, it uses internally ctypes.util.find_library('cairo'). Make sure that this works. Consult if needed http://docs.python.org/2/library/ctypes.html#finding-shared-libraries .

@SimonSapin
Copy link
Member Author

@randfb please try this:

  1. Download and extract the GTK all-in-one bundle from http://www.gtk.org/download/win32.php or http://www.gtk.org/download/win64.php depending on whether your Python is 32-bit or 64-bit
  2. Add its bin directory to your PATH environment variable
  3. In cairocffi/__init__.py, replace ffi.dlopen('cairo') by ffi.dlopen('libcairo-2')

I’ll write up more detailed instruction later.

@SimonSapin
Copy link
Member Author

Alternatively for step 1~2, try the PyGTK all-in-one installer. It installs more stuff, but an installer might be easier than changing the PATH manually.

Step 3 is now done in 07cba79. Please test with the cairocffi’s git version.

@SimonSapin
Copy link
Member Author

Fixed in 0.3 (just released.)

@fjcaetano
Copy link

I'm having a similar problem, but it's specifically with 'libcairo.so.2'. I searched the project and realised that there's no file with that name.

Was I supposed to have installed something before cairocffi? I simply ran 'pip install cairocffi'

@SimonSapin
Copy link
Member Author

Hi @fjcaetano. If you issue is not exactly the same, it’s usually better to open a new one and refer to this with the number like #1. What OS are you on? And yes, cairocffi needs cairo.

@sasnfbi1234
Copy link

There is no ffi.dlopen('cairo') and I am still having this issue

@SimonSapin
Copy link
Member Author

@sasnfbi1234 Yes, on Windows it’s (probably) ffi.dlopen('libcairo-2'). Did you install cairo?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants