Comments (8)
Hi!
Your problem is probably caused by missing system libraries. CairoSVG relies on libraries that can’t be installed using the Python package manager, so you have to install them. On Vercel, you should be able to do this following https://vercel.com/docs/deployments/build-image#installing-additional-packages
The package you need to install is Cairo.
from cairosvg.
hi, a looked a bit into logs and i tried using
yum install cairo -y
and
amazon-linux-extras install cairo
but it didn't worked. The logs are same. Do you know the command to fix it?
from cairosvg.
Could you please share amazon-linux-extras install cairo
logs?
from cairosvg.
GET]
/image
Time
September 16 10:29:07.35 GMT+02:00
Request Path
less-p271pg1uc-mankifg.vercel.app/image
Status Code
500
Host
less-p271pg1uc-mankifg.vercel.app
Request ID
g8lkq-1694852947343-cd87dba08c51
Request User Agent
Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/116.0.0.0 Safari/537.36
Level
Error
Environment
preview
Cache
MISS
Type
Serverless Function
Function
/api/index.py
Location
Washington, D.C., USA (iad1)
Runtime
Python 3.9
Execution Duration / Limit
798ms / 10s
Memory Used / Limit
89 MB / 1024 MB
1,1,1,1,1,1,1,1,1
000000000001
[ERROR] 2023-09-16T08:29:08.202Z 85c1d036-56fb-486f-a00d-a36f2a0d9ccc 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.
and i found there logs:
Running build in Washington, D.C., USA (East) – iad1 (Hive)
--
10:27:07.405 | Cloning github.com/Mankifg/LessApi (Branch: main, Commit: 21ca055)
10:27:07.723 | Cloning completed: 317.533ms
10:27:07.890 | Restored build cache
10:27:07.957 | Running "vercel build"
10:27:08.498 | Vercel CLI 32.2.4
10:27:08.660 | WARN! Due to `builds` existing in your configuration file, the Build and Development Settings defined in your Project Settings will not apply. Learn More: https://vercel.link/unused-build-settings
10:27:08.686 | Installing required dependencies...
10:27:33.746 | Build Completed in /vercel/output [25s]
10:27:34.150 | Deploying outputs...
10:27:49.691 | Deployment completed
10:27:50.259 | Uploading build cache [29.00 B]...
10:27:50.637 | Build cache uploaded: 377.315ms
from cairosvg.
Then I’m sorry, but I won’t be able to help you, I don’t know Vercel at all, and it’s definitely a problem with Vercel. If Cairo was installed, you wouldn’t have this error.
WARN! Due to
builds
existing in your configuration file, the Build and Development Settings defined in your Project Settings will not apply. Learn More: https://vercel.link/unused-build-settings
Looks like the commands you put in your dashbord are not applied. You should ask the Vercel community, there’s nothing we can do here for you :/.
from cairosvg.
well now i remove someting and i get error that cairo is not found
Vercel CLI 32.2.4
2023-09-16T09:06:20.834Z Running "install" command: `amazon-linux-extras install cairo`...
2023-09-16T09:06:22.652Z Topic cairo is not found.
2023-09-16T09:06:22.671Z Error: Command "amazon-linux-extras install cairo" exited with 4
from cairosvg.
Could you please share
amazon-linux-extras install cairo
logs?
Vercel CLI 32.2.4
2023-09-16T09:06:20.834Z Running "install" command: amazon-linux-extras install cairo
...
2023-09-16T09:06:22.652Z Topic cairo is not found.
2023-09-16T09:06:22.671Z Error: Command "amazon-linux-extras install cairo" exited with 4
here are logs
from cairosvg.
@Mankifg Then you have to ask on Vercel forums how to install cairo.
from cairosvg.
Related Issues (20)
- `text` property `shape-inside` not respected HOT 1
- Convert to WebP HOT 1
- Add rlPyCairo to requirements.txt HOT 1
- Stroke Width is not taken into account for final height / width HOT 3
- OSE Error cairo-2 not found HOT 6
- Conversion of multiple files halted with error HOT 2
- SVG to PDF render improper PNG position HOT 1
- OSError: no library called "cairo-2" was found HOT 1
- RecursionError: maximum recursion depth exceeded in comparison HOT 1
- Truncating fractional height in pixels HOT 4
- svg2pdf incorrect width and height output - HOT 1
- Feature request: support style='background_color:xxxx' in the <svg> object
- Add support for blend modes
- Missing linked images and text HOT 6
- svg2png the stroke attribute causes display anomalies. HOT 1
- Fail of image path resolution in a defs/use context HOT 1
- SVG path parse error
- ValueError: could not convert string to float: 'null' HOT 1
- ValueError: could not convert string to float: '' HOT 1
- Can't convert svg to pdf HOT 3
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from cairosvg.