How to solve issue with Django and Postgis 2.1 Django 02.12.2015

My development environment is

  • Arch Linux
  • Django 1.8.5
  • Postgis 2.2.0-1
  • Postgresql 9.4.5-1
  • Postgresql-libs 9.4.5-1

Today I experienced following error

could not access file "$libdir/postgis-2.1": No such file or directory

There are few solutions.

Solution 1: update DB

psql -U postgres dbname
dbname=#\dx

You can see postgis 2.1.5 but it should be postgis 2.2.0. Let's update.

dbname=#ALTER EXTENSION postgis UPDATE TO '2.2.0';
dbname=#\dx

Source.

Solution 2: downgrade postgis to 2.1 under Arch Linux

There is amazing Arch Linux Archive. We can find previous version of different packages there.

Old versions of postgis you can see here.

# remove old package
yaourt -Rs postgis

# download new package
wget http://ala.seblu.net/packages/p/postgis/postgis-2.1.8-1-x86_64.pkg.tar.xz

# install 
pacman -U postgis-2.1.8-1-x86_64.pkg.tar.xz

# forbid update
sudo vim /etc/pacman.conf
IgnorePkg = postgis