Skip to content

Build for Ubuntu

Kirk Martinez edited this page Dec 14, 2020 · 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 do need/want to build from source yourself, perhaps to get a more recent version or for development/optimisation, read on.

Get any packages you may have missing:

sudo apt-get install git build-essential libxml2-dev libfftw3-dev \
	libmagickwand-dev libopenexr-dev liborc-0.4-0 \
	gobject-introspection libgsf-1-dev \
	libglib2.0-dev liborc-0.4-dev

For the Python bindings, also install these:

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

For a full build from the git sources, you probably need these packages: sudo apt-get install automake libtool swig gtk-doc-tools libopenslide-dev \ libmatio-dev libgif-dev libwebp-dev libjpeg-turbo8-dev libexpat1-dev gtk-doc-tools now you can build vips:

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

Now you need to set up your environment or the things in /usr/local won't be found. This can be added to the end of your ~/.bashrc file in your home folder:

For Python 2.7:

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/python2.7/site-packages

For Python 3.x:

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 source ~/.bashrc after adding the exports

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

Clone this wiki locally