getting libcairo not found

i tried setting both of these... but no dice: NIXPACKS_APT_PKGS=libcairo2,libcairo2-dev NIXPACKS_PKGS= cairo i still get this in my logs: when i run sudo apt install libcairo2 and libcairo2-dev on jammy... everything works in my build should i just stick that in the run command? seems hacky
import cairosvg
File "/opt/venv/lib/python3.8/site-packages/cairosvg/__init__.py", line 26, in <module>
from . import surface # noqa isort:skip
File "/opt/venv/lib/python3.8/site-packages/cairosvg/surface.py", line 9, in <module>
import cairocffi as cairo
File "/opt/venv/lib/python3.8/site-packages/cairocffi/__init__.py", line 47, in <module>
cairo = dlopen(
File "/opt/venv/lib/python3.8/site-packages/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.
import cairosvg
File "/opt/venv/lib/python3.8/site-packages/cairosvg/__init__.py", line 26, in <module>
from . import surface # noqa isort:skip
File "/opt/venv/lib/python3.8/site-packages/cairosvg/surface.py", line 9, in <module>
import cairocffi as cairo
File "/opt/venv/lib/python3.8/site-packages/cairocffi/__init__.py", line 47, in <module>
cairo = dlopen(
File "/opt/venv/lib/python3.8/site-packages/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.
11 Replies
Percy
Percy5mo ago
Project ID: N/A
Brody
Brody5mo ago
it would be best for you to build your app with a dockerfile
simulxxx
simulxxx5mo ago
Reddit
From the django community on Reddit
Explore this post and more from the django community
simulxxx
simulxxx5mo ago
didn't even know nix supported dockerfiles how do i convince it to use a dockerfile?
Brody
Brody5mo ago
nixpacks and dockerfiles are not mutually exclusive, if you are using a dockerfile nixpacks has nothing to do with the build anymore you simply place a Dockerfile in your repo
simulxxx
simulxxx5mo ago
cool the thing is... it really looks like it's doing the right thing: #9 17.60 Unpacking libcairo2:amd64 (1.16.0-5ubuntu2) ... #9 17.63 Selecting previously unselected package libcairo-gobject2:amd64. i suspect it's a path thing.
Brody
Brody5mo ago
oh I know, it is doing the right thing but for some unknown reason during runtime it's like none of that stuff was ever installed better to just use a Dockerfile for this kind of thing so you don't have to deal with the nixpacks stuff
simulxxx
simulxxx5mo ago
if i use a dockerfile... do i still get the environment variables exposed nicely with the control panel?
Brody
Brody5mo ago
yes of course
simulxxx
simulxxx5mo ago
everything works... and the builds are faster because i can carefully control the layers. thanks a lot.
Brody
Brody5mo ago
no problem! a Dockerfile is always going to be the go to for people who want absolute control over their build