How-to run QGIS 2 and QGIS 3 at the same time in Archlinux or Manjaro

Since QGIS 3 was released, it's a nice and very pleasant upgrade. Unfortunately some plugins I use does still not work with Qgis 3 due to python upgrade from version 2 to 3.
It's possible to upgrade with tools like 2to3 (If interested, I suggest to watch Heikki Vesanto blog : ) but some plugins needs time to debug.

That's why, it's interesting during migration to have Qgis 2 and 3 at the same time in one computer. It's also possible to run Qgis 2 and 3 at the same time due to profile migration. They are not sharing same preferences folder so you are not breaking anything.
It's possible to have Qgis 2 and 3 running at the time with different way like Conda or Docker. But it's lightest to run it natively.

Archlinux/Manjaro is the Linux distribution I use. It have in my opinion a powerfull little thing called AUR (Arch User Repository) which automate installation of software. Furthermore, if you don't happy with compilation parameters and want a custom value added parameters you could modify it by editing a file named PKGBUILD. Archlinux based linux system is a rolling release and now qgis package move from AUR to official package, version 3 is available today. There is still a qgis-ltr version in AUR, version 2.18.19, but this package needs building. As explain before it's not difficult because everything is automated but at this time qgis package is in conflict with qgis-ltr package. So you have only choice to have qgis or qgis-ltr installed, not both.

Let's just edit PKGBUILD and we will be able to have both packages installed.

1) Download PKGBUILD : 

 a) Auto download with yaourt :
From command line just run
yaourt -S qgis-ltr
Then you will be prompt to edit file or not

 b) Download from AUR :
Go here :
On the right side there is View PKGBUILD, download it

2) Edit PKGBUILD : 

We need to modify this file to install in different directory. Like INSTALL file from qgis github repository, I installed qgis-ltr in my home

We need to modify these lines :

line 36 : (disable conflicts check between these 2 packages)
It becomes

line 64 : (change installed directory with cmake option)


line 93 to 108 : (comment by adding # in front or remove these lines)

3) Build package : 

  a) With yaourt :

At the end of editing PKGBUILD, it will continue alone.

  b) If you download PKGBUILD:

In directory where you download PKGBUILD, run

from command line and wait.

4) Install package : 

  a) With yaourt :

You will be asked to install or not generated package

  b) If you download PKGBUILD:

pacman -U qgis*.pkg.tar.xz

5) Run qgis 2 : 

Open a terminal and launch these commands :

export LD_LIBRARY_PATH="${LD_LIBRARY_PATH}:${HOME}/apps/lib"
cd ${HOME}/apps/bin
6) Automate qgis 2 launcher :

Edit file in /usr/local/bin :

nano /usr/local/bin/qgis2

Put this in it :

export LD_LIBRARY_PATH="${LD_LIBRARY_PATH}:${HOME}/apps/lib"
cd ${HOME}/apps/bin

Save and close.
Make it executable :

chmod +x /usr/local/bin/qgis2

Now you could just type in terminal to run Qgis2 :

NOTE : Overview of modified PKGBUILD. Available for download here :

# Maintainer: Doug Newgard
# Contributor: SaultDon
# Contributor: Lantald < lantald at >
# Contributor: Thomas Dziedzic < gostrc at gmail >
# Contributor: dibblethewrecker
# Contributor: Gerardo Exequiel Pozzi
# Contributor: Eric Forgeot < >

# Globe Plugin and Map Server are disabled in cmake by default.
# Uncomment them in the build() portion if you'd like them enabled.
# You will also need to install osgearth-qt4 or fcgi, respectively, before building.

pkgdesc='Geographic Information System (GIS) that supports vector, raster & database formats; Long Term Release'
arch=('i686' 'x86_64')
depends=('expat' 'gcc-libs' 'gdal' 'geos' 'glibc' 'libspatialite' 'postgresql-libs' 'proj'
         'qt4' 'qca-qt4' 'qjson' 'qscintilla-qt4' 'qwt-qt4' 'qwtpolar-qt4' 'spatialindex' 'sqlite'
         'python2' 'python2-httplib2' 'python2-future' 'python2-qscintilla-qt4' 'python2-sip' 'python2-six')
makedepends=('cmake' 'gsl' 'perl' 'txt2tags')
optdepends=('gpsbabel: GPS Tool plugin'
            'gsl: Georeferencer plugin'
            'python2-gdal: DB Manager plugin; Processing plugin'
            'python2-jinja: MetaSearch plugin'
            'python2-owslib: MetaSearch plugin'
            'python2-psycopg2: DB Manager plugin; Processing plugin'
            'python2-pygments: MetaSearch plugin; DB Manager plugin'
            'python2-pyspatialite: DB Manager plugin; Processing plugin'
            'python2-yaml: Processing plugin'
            'saga-gis-ltr: Saga processing tools')

prepare() {
  cd $_pkgname-$pkgver

  # Make sure we find the -qt4 versions of qwt and qwtpolar
  sed -i '/QWT_LIBRARY_NAMES/ s/qwt /qwt-qt4 /' cmake/FindQwt.cmake
  sed -i '/PATH_SUFFIXES/ s/qwt$/&-qt4/;/LIBRARY NAMES/ s/qwtpolar/&-qt4/' cmake/FindQwtPolar.cmake

  # Fix references to "python"
  sed -i 's/\(env \|\/usr\/bin\/\)python$/&2/' $(find . -iname "*.py")

  # Remove mime types already defined by
  sed -e '/type="image\/tiff"/,/<\/mime-type>/d' \
      -e '/type="image\/jpeg"/,/<\/mime-type>/d' \
      -e '/type="image\/jp2"/,/<\/mime-type>/d' \
      -e '/type="application\/x-adobe-mif"/,/<\/mime-type>/d' \
      -i debian/qgis.xml

  [[ -d build ]] || mkdir build

build() {
  cd $_pkgname-$pkgver/build

  cmake -G "Unix Makefiles" ../ \
    -DQGIS_MANUAL_SUBDIR=share/man \


  # Rebuild srs database, QGIS distributes an old, buggy one
  LD_LIBRARY_PATH="$PWD/output/lib/" make synccrsdb
  mv /tmp/srs.db ../resources/

package() {
  cd $_pkgname-$pkgver/build

  # Add optional deps based on selected or autodetected options
  [[ -n "$(sed -n '/^GRASS_PREFIX:/  s/.*=//p' CMakeCache.txt)" ]]      && optdepends+=('grass6: GRASS6 plugin')
  [[ -n "$(sed -n '/^GRASS_PREFIX7:/ s/.*=//p' CMakeCache.txt)" ]]      && optdepends+=('grass: GRASS7 plugin')
  [[ "$(sed -n '/^WITH_SERVER:/ s/.*=//p' CMakeCache.txt)" == "TRUE" ]] && optdepends+=('fcgi: Map Server')
  [[ "$(sed -n '/^WITH_GLOBE:/  s/.*=//p' CMakeCache.txt)" == "TRUE" ]] && optdepends+=('osgearth-qt4: Globe plugin')

  make DESTDIR="$pkgdir" install

  cd "$srcdir/$_pkgname-$pkgver"

  # install desktop files and icons
#  install -Dm644 debian/{qgis,qbrowser}.desktop -t "$pkgdir/usr/share/applications/"
#  for _icon in qgis-icon{,-16x16,-60x60} qbrowser-icon{,-60x60}; do
#    local _resolution="${_icon##*-}"; [[ "$_resolution" == "icon" ]] && _resolution="512x512"
#    install -Dm644 images/icons/$_icon.png "$pkgdir/usr/share/icons/hicolor/$_resolution/apps/${_icon%%-*}.png"
#  done
#  for _prog in qgis qbrowser; do
#    install -Dm644 images/icons/${_prog}_icon.svg "$pkgdir/usr/share/icons/hicolor/scalable/apps/#$_prog.svg"
#  done

#  install mime information and icons
#  install -Dm644 debian/qgis.xml -t "$pkgdir/usr/share/mime/packages/"
#  install -Dm644 images/icons/qgis-mime-icon.png "$pkgdir/usr/share/icons/hicolor/128x128/mimetypes/qgis-mime.png"
#  for _type in asc ddf dem dt0 dxf gml img mime mldata qgs qlr qml qpt shp sqlite; do
#    install -Dm644 images/icons/qgis_${_type}_icon.svg "$pkgdir/usr/share/icons/hicolor/scalable/#mimetypes/qgis-$_type.svg"
#  done

  # compile python files, since the cmake option doesn't seem to account for DESTDIR
  python2 -m compileall -q "$pkgdir"


Posts les plus consultés de ce blog

Install GDAL ECW Support in Archlinux / Manjaro

Disposer du support de l'ECW sous Ubuntu

L'ECW sous MacOSX : comment le rendre fonctionnel