gizeh
gizeh copied to clipboard
Issue when importing gizeh
When simply running: import gizeh
I get the error:
Traceback (most recent call last):
File "C:\Users\Sam\Documents\Python\python 2.7\animations.py", line 6, in
Thanks for the feedback. Can you also report the pip issues ? What did they look like ? You will need to install Cairo (I thought it was automatically installed with cairocffi but apparently not).
http://cairographics.org/download/
Tell me if it works after you installed Cairo.
Pip error http://pastebin.com/q6gKfYPL
@GreenVars you need Visual Studio installed to build C/C++ extensions or you may download precompiled binaries here http://www.lfd.uci.edu/~gohlke/pythonlibs/#numpy
cannot load library libcairo.so.2
I used this all-in-one installer http://sourceforge.net/projects/gtk-win/, works fine
@GreenVars @RealJTG Maybe it would be simpler to get the binaries here: http://sourceforge.net/projects/numpy/files/NumPy/1.9.0/
Also, that's the first time I see this error.
I have installed numpy and the all in one installer and am getting the same error.
Hi, good library!, but I have any problems. I work on OS X Mavericks and I have installed Cairo library and followings python libraries: cairocffi (0.6) cffi (0.8.6) distribute (0.7.3) ez-setup (0.9) gizeh (0.1.06) numpy (1.9.0) pip (1.5.6) pycparser (2.10) setuptools (3.6) And I have same problem that GreenVars when import gizeh in Python 3.4.1 Thanks
Can you paste the whole error that you get ? maybe there will be more infos.
Python 3.4.1 (v3.4.1:c0e311e010fc, May 18 2014, 00:54:21) [GCC 4.2.1 (Apple Inc. build 5666) (dot 3)] on darwin Type "help", "copyright", "credits" or "license" for more information.
import gizeh Traceback (most recent call last): File "
", line 1, in File " ", line 2237, in _find_and_load File " ", line 2226, in _find_and_load_unlocked File " ", line 1191, in _load_unlocked File " ", line 1161, in _load_backward_compatible File "/Users/josecarrascore/Proyectos/Gizeh_Moviepy/venv/lib/python3.4/site-packages/gizeh-0.1.06-py3.4.egg/gizeh/init.py", line 5, in File " ", line 2237, in _find_and_load File " ", line 2226, in _find_and_load_unlocked File " ", line 1191, in _load_unlocked File " ", line 1161, in _load_backward_compatible File "/Users/josecarrascore/Proyectos/Gizeh_Moviepy/venv/lib/python3.4/site-packages/gizeh-0.1.06-py3.4.egg/gizeh/gizeh.py", line 4, in File "/Users/josecarrascore/Proyectos/Gizeh_Moviepy/venv/lib/python3.4/site-packages/cairocffi/init.py", line 41, in cairo = dlopen(ffi, *CAIRO_NAMES) File "/Users/josecarrascore/Proyectos/Gizeh_Moviepy/venv/lib/python3.4/site-packages/cairocffi/init.py", line 34, in dlopen return ffi.dlopen(names[0]) # pragma: no cover File "/Users/josecarrascore/Proyectos/Gizeh_Moviepy/venv/lib/python3.4/site-packages/cffi/api.py", line 118, in dlopen lib, function_cache = _make_ffi_library(self, name, flags) File "/Users/josecarrascore/Proyectos/Gizeh_Moviepy/venv/lib/python3.4/site-packages/cffi/api.py", line 411, in _make_ffi_library backendlib = _load_backend_lib(backend, libname, flags) File "/Users/josecarrascore/Proyectos/Gizeh_Moviepy/venv/lib/python3.4/site-packages/cffi/api.py", line 400, in _load_backend_lib return backend.load_library(name, flags) OSError: cannot load library libcairo.so.2: dlopen(libcairo.so.2, 2): image not found
@josecarrascore @GreenVars Same answer as for GreenVars: have you installed Cairo on your computer? I will make that clearer in the docs, but the idea is that Gizeh relies on a C program called Cairo (which does all the drawing job)
Yes, I installed Cairo. During the installation, Cairo refer to Python 2.7:
---> Fetching archive for python27 ---> Attempting to fetch python27-2.7.8_1.darwin_13.x86_64.tbz2 from http://lil.fr.packages.macports.org/python27 ---> Attempting to fetch python27-2.7.8_1.darwin_13.x86_64.tbz2.rmd160 from http://lil.fr.packages.macports.org/python27 ---> Installing python27 @2.7.8_1 ---> Activating python27 @2.7.8_1 ---->To make python 2.7 the default (i.e. the version you get when you run 'python'), please run: ----> sudo port select --set python python27
Can Python 3.4.1 work with Cairo?
Thanks.
Hello @GreenVars @josecarrascore , a fellow Mac user posted the detail of what he installed to make everything work:
http://zulko.github.io/blog/2014/09/20/vector-animations-with-python/#comment-1609747524
If you want to give it a try, please tell me if it worked for you.
As said in: https://github.com/Kozea/WeasyPrint/issues/79#issuecomment-28835056:
$ export DYLD_FALLBACK_LIBRARY_PATH=/opt/local/lib
Works with macports and Python 3.4. Can be put into ~/.profile
.
Hey I installed Cairo as mentioned in first reply. Still I am get error. Please help to resolve this error
Traceback (most recent call last): File "C:\Python34\vector.py", line 1, in import gizeh File "C:\Python34\lib\site-packages\gizeh__init__.py", line 5, in from .gizeh import * File "C:\Python34\lib\site-packages\gizeh\gizeh.py", line 4, in import cairocffi as cairo File "C:\Python34\lib\site-packages\cairocffi__init__.py", line 46, in cairo = dlopen(ffi, 'cairo', 'cairo-2') File "C:\Python34\lib\site-packages\cairocffi__init__.py", line 43, in dlopen raise OSError("dlopen() failed to load a library: %s" % ' / '.join(names)) OSError: dlopen() failed to load a library: cairo / cairo-2
Here is what I have done to overcome this dlopen fail problem.
I installed the appropriate Pycairo executable whl from here: http://www.lfd.uci.edu/~gohlke/pythonlibs/#pycairo select the version that matches your python version, for example: pycairo‑1.13.0‑cp27‑cp27m‑win32.whl is for python 2.7 32 bit architecture
After installing gizeh, I opened gizeh.py and replaced the following line:
"import cairocffi as cairo" with "import cairo"
I am not sure how dangerous this hack, I think @Zulko who can better tell us. After this modification, I made another change in pillowmulti.py by adding "quantizer=1" before line 333. Again, I am not sure how badly this affects the performance of gizeh.py. However, after these couple of changes, I was able to run the examples in the following link successfully and generate the corresponding images: http://zulko.github.io/blog/2014/09/20/vector-animations-with-python/
In case things did not work with you, for your information, I am working on winpython 3.5 64 bit which can be installed from the following link: https://winpython.github.io/
It is a portable python release for scientific and educational usage.