This vignette guides you through the installation process of QGIS, GRASS- and SAGA-GIS on three different platforms (Windows, Mac, Linux). Following our instructions should ensure that RQGIS will work properly. With the exception of SAGA, we recommend to use the latest stable version of all software packages. Though other versions might also work with RQGIS, we did not test this.
Overall, RQGIS allows access to more than 1000 geoalgorithms. However, please note that the number of geoalgorithms you can use from within RQGIS depends on the platform, the system architecture, the selection of installed third-party providers and software package versions.
There are at least two options to install QGIS on Windows in such a way that RQGIS can access QGIS. The first option is the Standalone Installer from the QGIS installer page. This will install QGIS along with the third-party providers GRASS and SAGA. However, if you would like to use even more third-party providers (e.g., GDAL, GEOS, Taudem, OTB, PostGIS, etc.), we recommend to use the OSGeo4W Network installer. This installer is available on the QGIS installer page as well as on the OSGeo4W-website.
To install OSGeo4W, the easiest way is to to use the Express installation:
We are sorry, that our installer uses a German dialog. Apparently, OSGeo4w automatically uses the language in accordance with the IP-address. Nevertheless, it should be easy enough to follow our steps.
This installation is more or less equivalent to the standalone QGIS-installation. However, to have the full choice of available geoalgorithms provided by QGIS, we recommend to use the advanced settings of the OSGeo4W Network installer:
Additionally, we choose the Desktop-GIS GRASS 6 & 7, the Orfeo Toolbox, SAGA, and of course QGIS. Here, we install both the most recent QGIS version as well as the long-term release. RQGIS will use the latter by default since this is the most stable version and everything is already set up correctly. By contrast, using QGIS 2.16.1 would require some additional code adjustment (see above).
Clicking “Next” once more will start the download and installation process which might take a while.
If you wish to to modify, uninstall or update some of the installed components, you might do so later on by running
../OSGeo4W/bin/osgeo4w-setup.exe. Alternatively, you can download and run again the latest OSGeo4W-executable.
If you additionally want to use the LiDAR processing tools (LAStools), please follow the steps found here.
We recommend to do all installations using the package management system
Two options exist installing QGIS on macOS
osgeo4mac tap supports the most recent QGIS versions for both the development version and the long term release (LTR). You can compile with various options, e.g.
brew info qgis2 for all available options. We recommend to compile QGIS using
brew install qgis2 --with-grass --with-saga-gis-lts.
The installation will take some time (30-45 mins, depending on your system) if you build from source. You can also install the bottled versions (= binary) step by step which will reduce installation time to a few minutes. If you want to install the LTR version, simply replace
Homebrew also supports GUI installations. QGIS can be installed using
brew cask install qgis
from the command line if homebrew is installed and configured correctly. If you do not (want to) use
homebrew, you can install the QGIS binary from https://www.qgis.org/en/site/forusers/download.html. This is exactly the same as calling
brew cask install qgis.
If you choose this option, you will get the following error messages during processing
QSqlDatabase: QSQLITE driver not loaded QSqlDatabase: available drivers: QSqlQuery::prepare: database not open  "ERROR: Opening of authentication db FAILED"  "WARNING: Auth db query exec() FAILED"
These look quite ugly but DO NOT affect RQGIS usage.
If you install QGIS > 2.16 on your system using
brew cask install qgis, GRASS7 will work out-of-the-box within QGIS. GRASS6 is deprecated and does not work anymore in QGIS > 2.16 (see this link). If you installed QGIS using option 1 (osgeo4mac), GRASS 7 will also work with QGIS < 2.16.
You can still use GRASS6 if you
brew install grass6from the ‘osgeo4mac’ tap
The binary GRASS installation can be found here.
The QGIS for Mac Kyngchaos binary comes with a preconfigured SAGA installation and should work out of the box.
Using homebrew, SAGA can be compiled via
brew install saga-gis-lts. If you installed QGIS using option 1) from the QGIS Mac section of this document, you will already have SAGA installed.
There is no binary install of SAGA for Mac. Therefore, we recommended to use the bottle installation from
homebrew. Alternatively, you can compile SAGA from source from the SAGA website. Make sure to check RQGIS compatibility with your SAGA version! You can do so using
qgis_session_info() in RQGIS.
To link a custom installation of SAGA with QGIS, follow these steps:
findSagaFolder()change the path setting pointing to the folder containing
testfolder = os.path.join(QgsApplication.prefixPath(), 'bin')
For homebrew installations (always located under “/usr/local/Cellar”) a working setup would look like this:
# testfolder = os.path.join(QgsApplication.prefixPath(), 'bin') testfolder = '/usr/local/Cellar/saga-gis/2.2.2/bin'
After restarting QGIS, you should recognize the change of the SAGA version under “Processing->Toolbox”.
If you install QGIS with the built-in software managers, you will most likely get an outdated QGIS version. To install more recent QGIS releases, we recommend to follow the installation instructions from the QGIS installers website.
Here, we just describe exemplarily the QGIS installation procedure under Debian/Ubuntu following the description found here. RQGIS should work as well with Linux derivatives other than Ubuntu. However, we did not test this.
Open a terminal window. First of all, make sure to remove QGIS and GRASS packages you may have installed before from other repositories:
sudo apt-get --purge remove qgis sudo apt autoremove --purge-remove sudo apt autoremove sudo apt-get update
Next add the correct repository to
/etc/apt/sources.list. Here, we use the current long-term release (2.18):
# add QGIS repository for Ubuntu 16.04 to sources.list sudo sh -c 'echo "deb http://qgis.org/ubuntugis xenial main" >> /etc/apt/sources.list' sudo sh -c 'echo "deb-src http://qgis.org/ubuntugis xenial main" >> /etc/apt/sources.list' sudo sh -c 'echo "deb http://ppa.launchpad.net/ubuntugis/ubuntugis-unstable/ubuntu xenial main" >> /etc/apt/sources.list' sudo add-apt-repository ppa:ubuntugis/ubuntugis-unstable
# add QGIS repository for Ubuntu 16.04 to sources.list sudo sh -c 'echo "deb http://qgis.org/ubuntugis-ltr xenial main" >> /etc/apt/sources.list' sudo sh -c 'echo "deb-src http://qgis.org/ubuntugis-ltr xenial main" >> /etc/apt/sources.list' sudo sh -c 'echo "deb http://ppa.launchpad.net/ubuntugis/ubuntugis-unstable/ubuntu xenial main" >> /etc/apt/sources.list' sudo add-apt-repository ppa:ubuntugis/ubuntugis-unstable
QGIS nightly (2.99)
# add QGIS repository for Ubuntu 16.04 to sources.list sudo sh -c 'echo "deb http://qgis.org/ubuntugis-nightly xenial main" >> /etc/apt/sources.list' sudo sh -c 'echo "deb-src http://qgis.org/ubuntugis-nightly xenial main" >> /etc/apt/sources.list' sudo sh -c 'echo "deb http://ppa.launchpad.net/ubuntugis/ubuntugis-unstable/ubuntu xenial main" >> /etc/apt/sources.list' sudo add-apt-repository ppa:ubuntugis/ubuntugis-unstable
For other Ubuntu releases, simply replace ‘xenial’ with the respective release name.
Now we need to add the GPG key so that we do not face key errors:
wget -O - http://qgis.org/downloads/qgis-2017.gpg.key | gpg --import # to verify, run: # gpg --fingerprint CAEB3DC3BDF7FB45 gpg --export --armor CAEB3DC3BDF7FB45 | sudo apt-key add -
After that, we can install QGIS and GRASS as follows:
sudo apt-get update sudo apt-get install qgis python-qgis qgis-plugin-grass
This will install the QGIS 2.14 release (LTR) as well as GRASS-GIS as third-party provider. To upgrade to QGIS 2.18 one simply has to change
/etc/apt/sources.list (see above) and run:
sudo apt-get update sudo apt-get upgrade
Assuming we have installed QGIS 2.18 and wish to replace it by QGIS 2.14, one naturally has to change
etc/apt/sources.list accordingly. Additionally, we probably need to downgrade some packages. For more information, please refer to this post.
You can install the SAGA LTS 2.3.1 version from the ubuntugis/unstable repository. If you haven’t done so yet, add the repository and then simply install SAGA via
sudo add-apt-repository ppa:ubuntugis/ubuntugis-unstable sudo apt-get update sudo apt-get install saga
If you would like to use another SAGA version, you need to compile it yourself. To find out which SAGA versions are supported by your QGIS installation, run:
library("RQGIS") info <- qgis_session_info() info$supported_saga_versions
After the installation you will find the SAGA algorithms in the processing toolbox of the QGIS GUI (this might not be true for SAGA >= 2.2.1 see further below). Prior to the SAGA installation, we need to install various dependencies required by SAGA. Here, we just quickly show how to install SAGA and its dependencies under Ubuntu. Please refer to this page for a more comprehensive SAGA installation guide. Please note that we here simply reproduce in great parts a copy of this guide.
First of all, install all necessary SAGA dependencies and a few compilation and configuration tools:
sudo apt-get install libwxgtk3.0-dev libtiff4-dev libgdal-dev libproj-dev libjasper-dev libexpat1-dev wx-common libexpat1-dev libogdi3.2-dev unixodbc-dev # compilation and configuration tools sudo apt-get install g++ make automake libtool git
Next, we would like to download a specific SAGA version. Check out the various available versions here. Here, we will download SAGA 2.3.1 into our home directory, unpack it and change the working directory to the unpacked folder:
wget -O /home/<YourUserName>/saga-git "https://sourceforge.net/projects/saga-gis/files/SAGA%20-%202.3/SAGA%202.3.1/saga_2.3.1.tar.gz" cd /home/<YourUserName> sudo tar -xvzf saga-git cd saga-2.3.1
Having done so, we are ready to compile SAGA:
sudo autoreconf -i sudo ./configure sudo make sudo make install
To check if SAGA was successfully compiled, run:
saga_gui produces following error message:
saga_gui: error while loading shared libraries: libsaga_gdi-2.3.1.so: cannot open shared object file: No such file or directory
In this case, you have to enable the SAGA GUI by specifying the path where
libsaga_gdi-2.3.1.so is located:
export LD_LIBRARY_PATH=/usr/local/lib:$LD_LIBRARY_PATH saga_gui
Using SAGA >= 2.2.1 you might encounter following message in the Processing log when opening QGIS:
Problem with SAGA installation: installed SAGA version (2.3.1) is not supported. Though in this case SAGA is not available in the processing toolbox, you might still able to use it via the QGIS Python API and therefore also with RQGIS. Please note that SAGA 2.3.1 is the latest SAGA version supported by QGIS (2.14 and 2.18).
In case you would like to uninstall SAGA, type:
cd /home/<YourUserName>/saga-2.3.1 sudo make uninstall
You can download the Orfeo Toolbox from here. We save the .run-script to the Desktop. Of course, you might select any other accesible folder. Next, we create a folder named “Applications” to which we move the .run script. Finally, we install OTB. Please note that so far there is only a 64-bit OTB version available. This version does not work on 32-bit machines!
mkdir /home/<YourUserName>/Applications/ mv /home/<YourUserName>/Desktop/<filename> /home/<YourUserName>/Applications sh /home/<YourUserName>/Applications/<NameOfScript>
(R)QGIS assumes that the “OTB applications folder” is located at “/usr/lib/otb/applications” (see also QGIS manual). Therefore, we need to move the OTB installation to the corresponding folder:
# move applications folder sudo mv /home/<YourUserName>/Applications/<YourOTBInstallation>/lib/otb /usr/lib/ # commandline tools cp -a /home/<YourUserName>/Applications/<YourOTBInstallation>/bin/. /usr/bin
OTB algorithms should be now availabe in the “Processing Toolbox” and in RQGIS (use
find_algorithms() to check). Finally, we clean up after ourselves by deleting the previously created Applications folder: