Failed to load CairoSVG in serverless program
Nobody has claimed this yet.
Assessment
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Newbie friendliness
- 25/100
Research direction
Start with drawsvg/raster.py and the full-feature installation guidance linked in the error, then review how the Flask app in the linked repository is deployed through Vercel. Determine whether the missing native libcairo library can be supplied by that deployment and document the supported dependency setup or limitation.
Written by the indexing model from the issue text.
Description
Hello, so im deploying my image api made in python flask with drawsvg, so the error is i can't install additonal packages in serverless ( or at least i don't know how), bellow are full logs, code is avalible here: https://github.com/Mankifg/LessApi , and this is my requirements.txt
drawsvg==2.3.0
Flask==2.2.2
Pillow==10.0.0
and I am deploing in vercel. If you nead any more info please let me know.
Thanks
Logs:
[ERROR] 2023-09-12T18:39:38.085Z bf3817cd-34cc-4527-8b68-cfde954ddaad Exception on /image [GET]
Traceback (most recent call last):
File "/var/task/drawsvg/raster.py", line 9, in delay_import_cairo
import cairosvg
File "/var/task/cairosvg/__init__.py", line 26, in <module>
from . import surface # noqa isort:skip
File "/var/task/cairosvg/surface.py", line 9, in <module>
import cairocffi as cairo
File "/var/task/cairocffi/__init__.py", line 47, in <module>
cairo = dlopen(
File "/var/task/cairocffi/__init__.py", line 44, in dlopen
raise OSError(error_message) # pragma: no cover
OSError: no library called "cairo-2" was found
no library called "cairo" was found
no library called "libcairo-2" was found
cannot load library 'libcairo.so.2': libcairo.so.2: cannot open shared object file: No such file or directory. Additionally, ctypes.util.find_library() did not manage to locate a library called 'libcairo.so.2'
cannot load library 'libcairo.2.dylib': libcairo.2.dylib: cannot open shared object file: No such file or directory. Additionally, ctypes.util.find_library() did not manage to locate a library called 'libcairo.2.dylib'
cannot load library 'libcairo-2.dll': libcairo-2.dll: cannot open shared object file: No such file or directory. Additionally, ctypes.util.find_library() did not manage to locate a library called 'libcairo-2.dll'
The above exception was the direct cause of the following exception:
Traceback (most recent call last):
File "/var/task/flask/app.py", line 2525, in wsgi_app
response = self.full_dispatch_request()
File "/var/task/flask/app.py", line 1822, in full_dispatch_request
rv = self.handle_user_exception(e)
File "/var/task/flask/app.py", line 1820, in full_dispatch_request
rv = self.dispatch_request()
File "/var/task/flask/app.py", line 1796, in dispatch_request
return self.ensure_sync(self.view_functions[rule.endpoint])(**view_args)
File "./api/index.py", line 40, in get_image
filename = generate_merged_image(t)
File "/var/task/mergeimg.py", line 18, in generate_merged_image
path = make_tile_and_save_it(dec)
File "/var/task/geneate_image.py", line 141, in make_tile_and_save_it
tile.save_png(path)
File "/var/task/drawsvg/drawing.py", line 337, in save_png
self.rasterize(to_file=fname, context=context)
File "/var/task/drawsvg/drawing.py", line 340, in rasterize
return raster.Raster.from_svg_to_file(
File "/var/task/drawsvg/raster.py", line 56, in from_svg_to_file
cairosvg = delay_import_cairo()
File "/var/task/drawsvg/raster.py", line 11, in delay_import_cairo
raise ImportError(
ImportError: Failed to load CairoSVG. drawSvg will be unable to output PNG or other raster image formats. See https://github.com/cduck/drawsvg#full-feature-install for more details.
- Dominant language
- Python
- Stars
- 959
- Forks
- 172
- PR merge metrics
- No merged PRs in 30d
Getting set up
This project ships no dev container, Dockerfile or contributing guide, so setting up is up to you: start from its README, and see our first-contribution guide for the general steps.
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from Kozea/CairoSVG
-
Difficulty 2/5 1-3 hours Newbie friendliness 88/100
-
并发下的渲染表现Open
Difficulty 4/5 3-5 days Newbie friendliness 35/100
-
Difficulty 4/5 3-5 days Newbie friendliness 35/100
-
Exception "The SVG size is undefined" raised using svg2pngPossibly taken @DSeaStar claimed this 111 days ago. Openbug
Difficulty 3/5 1-2 days Newbie friendliness 35/100
-
feature
Difficulty 4/5 3-5 days Newbie friendliness 30/100
Similar issues
-
Difficulty 1/5 Under an hour Newbie friendliness 92/100
Techiebutler/freeframe#687 ·
Maintainers usually reply within 1 day
-
bug verbose GC
Difficulty 2/5 1-3 hours Newbie friendliness 74/100
IBM/javacore-analyser#677 ·
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 79/100
Maintainers usually reply within 2 days
-
area/config comp/plugins P1 platform/qqbot tool/file type/bug
Difficulty 2/5 1-3 hours Newbie friendliness 75/100
NousResearch/hermes-agent#163932 · 1 comment ·
Maintainers usually reply within 1 day
-
plugins/dsh: todayStr() computes UTC but is documented as local — journal entries written 00:00–08:00 local land in the previous day's filePossibly taken @Beehtrix claimed this today. Openbug
Difficulty 2/5 1-3 hours Newbie friendliness 82/100
zilliztech/memsearch#907 · 1 comment ·
Maintainers usually reply within 1 day