Skip to content

Build for Ubuntu

Kirk Martinez edited this page May 10, 2021 · 45 revisions

Installing the maintained ubuntu/debian binary packages

You won't usually need to build VIPS from source on Ubuntu, just install the standard packages (and you won't need to add environment lines to your .bashrc either!):

sudo apt install libvips libvips-dev

If you also need the vips and vipsthumbnail command line tools:

sudo apt install libvips-tools

If you need the Python 3.x typelib bindings and overrides (based on gobject-introspection):

# Python 3 gi library and vips typelib
sudo apt-get install python3-gi gir1.2-vips-8.0
# download and install typelib "overrides"
sudo su
wget https://raw.githubusercontent.com/jcupitt/libvips/8.4/python/packages/gi/overrides/Vips.py \
    -O /usr/lib/python3/dist-packages/gi/overrides/Vips.py
exit

Or for Python 2.7:

# Python 2 gi library and vips typelib
sudo apt-get install python-gi gir1.2-vips-8.0
# download and install typelib "overrides"
sudo su
wget https://raw.githubusercontent.com/jcupitt/libvips/8.4/python/packages/gi/overrides/Vips.py \
    -O /usr/lib/python2.7/dist-packages/gi/overrides/Vips.py
exit

Building from source

If you want to build from source yourself, perhaps to get a more recent version or for development/optimisation:

Get any packages you may have missing:

sudo apt-get install git build-essential automake libtool swig libxml2-dev libfftw3-dev \
	             libmagickwand-dev libopenexr-dev liborc-0.4-0 gobject-introspection \
                     libgsf-1-dev libglib2.0-dev liborc-0.4-dev gtk-doc-tools libopenslide-dev \
                     libmatio-dev libgif-dev libwebp-dev libjpeg-turbo8-dev libexpat1-dev

For the Python bindings, also install these:

sudo apt-get install python-gi-dev libgirepository1.0-dev

now you can build vips:

git clone https://github.com/libvips/libvips.git
cd libvips
./autogen.sh
make
sudo make install

Note that sudo is NOT needed if you build into your home area with "./autogen.sh --prefix=/home/yourid/vips". Now you need to set up your environment or the things in /usr/local or your area won't be found. This can be added to the end of your ~/.bashrc file in your home folder:

export VIPSHOME=/usr/local
export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$VIPSHOME/lib
export PATH=$PATH:$VIPSHOME/bin
export PKG_CONFIG_PATH=$PKG_CONFIG_PATH:$VIPSHOME/lib/pkgconfig
export MANPATH=$MANPATH:$VIPSHOME/man
export PYTHONPATH=$VIPSHOME/lib/python3.6/site-packages

Run . ~/.bashrc after adding the exports Test you have it all working by running "vips" which will say you didn't give args.

nip2 GUI

To build nip2 from a fresh install of Ubuntu you typically need:

sudo apt-get install libgtk2.0-dev flex bison
    git clone https://github.com/jcupitt/nip2.git
    cd nip2
    ./autogen.sh
    ./configure
    make
    sudo make install

Note that if you build libVips from source - the nip2 debian package may not work well with it (so build nip from src or use both as packages)

*tested on Ubuntu 16.04, 18.04, 20.04, 21.04 and Pi OS Buster

Clone this wiki locally