Welcome!
This is the community forum for my apps Pythonista and Editorial.
For individual support questions, you can also send an email. If you have a very short question or just want to say hello — I'm @olemoritz on Twitter.
Import cairo
-
I have a script written using Pycharm. It uses Cairo. When I try to run it in Pythonista it tells me “no module named Cairo”. Is it possible to install Cairo in Pythonista?
-
I tried using stash to import Cairo and pycairo but no success;
Running selfupdate ...
Target: ywangd:master
Checking for new version ...
Already at latest version
[~/Documents]$ pip install cairo
Querying PyPI ...
Error: Failed to fetch package release urls
[~/Documents]$ pip install pycairo
Querying PyPI ...
Downloading package ...
Opening: https://files.pythonhosted.org/packages/3c/1a/c0478ecab31baae50fda9956547788afbd0ca563adc52c9b03cab30f17eb/pycairo-1.18.2.tar.gzSave as: /private/var/mobile/Containers/Data/Application/999F7ACA-16F5-4A4D-9A54-34378FC88558/tmp//pycairo-1.18.2.tar.gz (200462 bytes)
200462 [100.00%]
Extracting archive file ...
Archive extracted.
Running setup file ...
TypeError("unsupported operand type(s) for +: 'OmniClass' and 'list'",)
Failed to run setup.py
Fall back to directory guessing ...
Error: Cannot locate packages. Manual installation required.
[~/Documents]$ -
@stuart-e-anders, pycairo is Python bindings for the cairo graphics library. cairo is written in C, and cannot be installed in Pythonista.
Pythonista has support for all the things cairo does, but with a different API. There have been compatibility layers written between iOS graphics and libraries like Kivy, but I have not heard anyone implementing such for cairo.
-
@zacbir implemented some amount of support for quartz/core graphics support, in his geometer repo. (I don't fully from the differences if any between Cairo, quartz, core graphics)
It is also possible that, with some small modifications that cairocffi might work in pythonista, since cffi can be made to work in pythonista
-
Not sure if it helps but... I made a small library to unify drawing API for various backends. So far it only supports "vector" drawing. It does not provide you with Cairo but at least you can have the same code for PyCairo as well as for Pythonista. See https://github.com/xxao/pero