Pycairo error on deploy

Hi. I new on discord so I hope I am in the right place to put this question. I got an deploy error (on railway) for my python-django project. I am also using xhtml2pdf which seams to include pycairo. After adding xhtml2pdf I got this error when trying to deploy. some of the the log: #10 15.75 ╰─> [15 lines of output] #10 15.75 running bdist_wheel #10 15.75 running build #10 15.75 running build_py #10 15.75 creating build #10 15.75 creating build/lib.linux-x86_64-cpython-38 #10 15.75 creating build/lib.linux-x86_64-cpython-38/cairo #10 15.75 copying cairo/init.py -> build/lib.linux-x86_64-cpython-38/cairo #10 15.75 copying cairo/init.pyi -> build/lib.linux-x86_64-cpython-38/cairo #10 15.75 copying cairo/py.typed -> build/lib.linux-x86_64-cpython-38/cairo #10 15.75 running build_ext #10 15.75 Package cairo was not found in the pkg-config search path. #10 15.75 Perhaps you should add the directory containing `cairo.pc' #10 15.75 to the PKG_CONFIG_PATH environment variable #10 15.75 No package 'cairo' found #10 15.75 Command '['pkg-config', '--print-errors', '--exists', 'cairo >= 1.15.10']' returned non-zero exit status 1. #10 15.75 [end of output] I will apreciat any suggest to solve this problem. I will love to be able to deploy this proyect. On my computer (windows) ir run perfectly. I include a complete log. Thanks in advance, Bruno
7 Replies
Percy
Percy11mo ago
Project ID: N/A
Bruno Cippitelli
Bruno Cippitelli11mo ago
I am not sure if the project id is this: greedy-blow Project ID: Project ID: greedy-blow Project ID: N/A
Adam
Adam11mo ago
Looks like you’re trying to install a package called cairo. The correct package name is pycairo. Please change your requirements.txt accordingly If pycairo is already in your requirements.txt, please share your repo
Bruno Cippitelli
Bruno Cippitelli11mo ago
Hi Adam, I have been reasearching and it seams that pycairo is needed by xhtml2pdf . I see my requirements.txt pycairo is there. In pycairo web the put: Getting Started Installation: pip3 install pycairo Installing Pycairo requires pkg-config and cairo including its headers. Here are some examples on how to install those for some platforms: Ubuntu/Debian: sudo apt install libcairo2-dev pkg-config python3-dev macOS/Homebrew: brew install cairo pkg-config Arch Linux: sudo pacman -S cairo pkgconf Fedora: sudo dnf install cairo-devel pkg-config python3-devel openSUSE: sudo zypper install cairo-devel pkg-config python3-devel So, it seams that I have to tell railway to install pkg-config and cairo.
Adam
Adam11mo ago
You are correct. You will be able to install them as either nix packages, nix libraries, or apt packages. Please reference these docs to create a nixpacks.toml to place in your project. https://nixpacks.com/docs/configuration/file
Configuration File Reference | Nixpacks
App source + Nix packages + Docker = Image
Adam
Adam11mo ago
you can search for available nix packages here https://search.nixos.org/packages
Bruno Cippitelli
Bruno Cippitelli11mo ago
Thanks Adam, I add this on my nixpacks.toml [phases.setup] nixPkgs = ['...', 'cairo', 'pkg-config' ] but I still get the error on the build proceso. Part of the log: ║ setup │ python38, gcc, cairo, pkg-config ║ #8 19.87 /nix/store/hjic5yz9kb4h6dw2avw504z5j3fxgmjx-cairo-1.16.0 #8 21.47 copying path '/nix/store/hjic5yz9kb4h6dw2avw504z5j3fxgmjx-cairo-1.16.0' from 'https://cache.nixos.org';... #10 11.08 Collecting pycairo==1.25.1 #10 18.48 Building wheels for collected packages: pycairo #10 18.48 Building wheel for pycairo (pyproject.toml): started #10 18.82 Building wheel for pycairo (pyproject.toml): finished with status 'error' #10 18.83 × Building wheel for pycairo (pyproject.toml) did not run successfully. #10 18.83 creating build/lib.linux-x86_64-cpython-38/cairo #10 18.83 copying cairo/init.py -> build/lib.linux-x86_64-cpython-38/cairo #10 18.83 copying cairo/init.pyi -> build/lib.linux-x86_64-cpython-38/cairo #10 18.83 copying cairo/py.typed -> build/lib.linux-x86_64-cpython-38/cairo #10 18.83 Package cairo was not found in the pkg-config search path. #10 18.83 Perhaps you should add the directory containing `cairo.pc' #10 18.83 No package 'cairo' found #10 18.83 Command '['pkg-config', '--print-errors', '--exists', 'cairo >= 1.15.10']' returned non-zero exit status 1. #10 18.83 ERROR: Failed building wheel for pycairo #10 18.83 Failed to build pycairo #10 18.83 ERROR: Could not build wheels for pycairo, which is required to install pyproject.toml-based projects 18.83 Command '['pkg-config', '--print-errors', '--exists', 'cairo >= 1.15.10']' returned non-zero exit status 1. 18.83 ERROR: Failed building wheel for pycairo 18.83 Failed to build pycairo 18.83 ERROR: Could not build wheels for pycairo, which is required to install pyproject.toml-based projects
Want results from more Discord servers?
Add your server