justvanrossum / drawbot-skia

A cross-platform subset of the DrawBot drawing API, using Skia

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Error while import drawbot_skia

guidoferreyra opened this issue · comments

Hi! I just installed Drawbot Skia and I got this error:

Traceback (most recent call last):
  File "./test.py", line 3, in <module>
    from drawbot_skia.drawbot import *
  File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/drawbot_skia/drawbot.py", line 1, in <module>
    from .drawing import Drawing
  File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/drawbot_skia/drawing.py", line 4, in <module>
    import skia
ImportError: dlopen(/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/skia.cpython-37m-darwin.so, 2): Symbol not found: _XML_ErrorString
  Referenced from: /Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/skia.cpython-37m-darwin.so
  Expected in: flat namespace
 in /Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/skia.cpython-37m-darwin.so

This is my script

from drawbot_skia.drawbot import *

rect(100, 100, 100, 100)
saveImage('test.jpeg')

And I runned it with python ./test.py

Am I doing something wrong? I’m on OS: Mac Os Mojave 10.14.6

I can't reproduce this, aka "it works for me".

Did you install skia-python with pip?

(In general, it's better to use a Python virtual environment, rather than to install modules globally. Ideally, that should be unrelated to this problem, but it may be worth a try.)

I just tried on a virtual environment and I got the same error. This is what I got installed on the venv.

`Package Version


drawbot-skia 0.4.8
fonttools 4.26.2
numpy 1.21.2
pip 21.2.4
pybind11 2.7.1
python-bidi 0.4.2
setuptools 57.4.0
six 1.16.0
skia-python 87.2
uharfbuzz 0.18.0
unicodedata2 13.0.0.post2
wheel 0.37.0`

I installed Drawbot-skia via pip and skia-python automatically with it.

Ah wait, I think there is a problem with skia-python on macos < 10.15: kyamagu/skia-python#137

It's possible to build drawbot-skia manually: https://kyamagu.github.io/skia-python/install.html It's a bit painful, but perhaps it can get you going. Upgrading to 10.15 is also an option.

ohh! Ok thanks. I’ve been delaying the OS update for months, maybe in a few weeks I will do it or maybe I will try to build skia-python manually. Thanks for taking the time with this, I will try to return to this issue with more info asap.

The latest skia-python may have fixed this. Is it possible for you to try?

Same result, using skia-python 87.3. skia-python in ./venv/lib/python3.7/site-packages (87.3)

Hey Guido, would you be willing to do another test? Download the artifact from this build: https://github.com/kyamagu/skia-python/actions/runs/1209672577, and install the included wheel with pip: pip install path/to/artifact/skia_python-87.3-cp37-cp37m-macosx_10_9_x86_64.whl If so, perhaps you can report your findings directly here: kyamagu/skia-python#137

It works! Thanks a lot! I will comment in the issue you mentioned.
I’m really happy that now I can start to use Drawbot-skia!