Hitting issues with deploying govips image compression with DO Functions

Deploying '/Users/**/Projects/**/**'
  to namespace 'fn-**'
  on host 'https://**'
Submitted function 'sample/hello' for remote building and deployment in runtime go:default (id: 6385b32b4639433585b32b4639b3359a)
Transcript of remote build session for action 'sample/hello':
Output of failed build in %s
downloading modules
# pkg-config --cflags  -- vips
Package vips was not found in the pkg-config search path.
Perhaps you should add the directory containing `vips.pc'
to the PKG_CONFIG_PATH environment variable
No package 'vips' found
pkg-config: exit status 1

with the following code

package main

import (


func checkError(err error) {
  if err != nil {
    fmt.Println("error:", err)

func Main() {

  _// fetch image_
  url := ""
  response, _ := http.Get(url)

  image1bytes, err := io.ReadAll(response.Body)
  image1, err := vips.NewThumbnailFromBuffer(image1bytes, 200, 200, vips.InterestingCentre)


  _// Rotate the picture upright and reset EXIF orientation tag_
  err = image1.AutoRotate()

  ep := vips.NewDefaultJPEGExportParams()
  image1bytes, _, err = image1.Export(ep)
  err = os.WriteFile("output.jpg", image1bytes, 0644)

would love some insight on what to do. I tried finding this in the docs somewhere but I had no luck.


Submit an answer

This textbox defaults to using Markdown to format your answer.

You can type !ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!

Sign In or Sign Up to Answer

These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.

Bobby Iliev
Site Moderator
Site Moderator badge
February 9, 2024


The error message:

Package vips was not found in the pkg-config search path.
Perhaps you should add the directory containing `vips.pc'
to the PKG_CONFIG_PATH environment variable
No package 'vips' found

indicates that the pkg-config tool can’t find the libvips development files. This is because DigitalOcean Functions, being a serverless environment, doesn’t have libvips installed by default.

As of the time being I don’t think that there is a way to install custom dependencies with the serverless functions, the best thing to do to get your voice heard regarding this would be to head over to our Product Ideas board and post a new idea, including as much information as possible for what you’d like to see implemented.

An alternative option would be to switch to the App Platform and use a Dockerfile for your function deployment. This way, you can ensure that the libvips library is available during both build and runtime:

Hope that helps!

- Bobby.

Try DigitalOcean for free

Click below to sign up and get $200 of credit to try our products over 60 days!

Sign up

Featured on Community

Get our biweekly newsletter

Sign up for Infrastructure as a Newsletter.

Hollie's Hub for Good

Working on improving health and education, reducing inequality, and spurring economic growth? We'd like to help.

Become a contributor

Get paid to write technical tutorials and select a tech-focused charity to receive a matching donation.

Welcome to the developer cloud

DigitalOcean makes it simple to launch in the cloud and scale up as you grow — whether you're running one virtual machine or ten thousand.

Learn more
DigitalOcean Cloud Control Panel