Skip to main content
5 of 5
replaced http://askubuntu.com/ with https://askubuntu.com/

How to install QGIS from source into user space?

I want to install QGIS from source on Ubuntu 13.10. (saucy). into ~/bin. There is Python 2.7.5+ installed. Therefore, I cloned the repository to my machine and checked out the master branch. First I did what the QGIS documentation recommends:

  1. $ export CMAKE_INSTALL_PREFIX=$HOME/bin
  2. $ cd QGIS
  3. $ mkdir build-master
  4. $ cd build-master
  5. $ ccmake ..

CMake stops with the following error message:

CMake Error: The following variables are used in this project, but they are set to NOTFOUND. Please set them or make sure they are set and tested correctly in the CMake files: PYTHON_LIBRARY
linked by target "qgispython" in directory /home/jjd/QGIS/src/python
linked by target "python_module_qgis_analysis" in directory /home/jjd/QGIS/python
linked by target "python_module_qgis_core" in directory /home/jjd/QGIS/python
linked by target "python_module_qgis_gui" in directory /home/jjd/QGIS/python
linked by target "python_module_qgis_networkanalysis" in directory /home/jjd/QGIS/python

Second try following the advise of Secagy ...

  1. $ export CMAKE_INSTALL_PREFIX=$HOME/bin
  2. $ cd QGIS
  3. $ mkdir build-master
  4. $ cd build-master
  5. $ ccmake -DPYTHON_LIBRARY=/usr/bin/python2 ..

This time CMake stops with:

BINDINGS_GLOBAL_INSTALL: Install bindings to global python directory? (might need root)

Running the above command with sudo does not make a difference. In the following I tried various build flags inspired by different posts without success.

References:


Solution

Actually, the message "BINDINGS_GLOBAL_INSTALL: Install bindings to global python directory? (might need root)" shown at the bottom is not an error but a help message. So after supplying the include and library paths I could continue by pressing g in the ccmake wizard to start the generate task.
Here are the steps (customize the paths for your system!):

  1. $ cd QGIS
  2. $ mkdir build-master
  3. $ cd build-master
  4. $ ccmake ..
  5. In the wizard set CMAKE_INSTALL_PREFIX to /home/user/bin/qgis. Make sure to append qgis here!
  6. In the wizard set PYTHON_INCLUDE_PATH to /usr/include/python2.7. Should be already set.
  7. In the wizard set PYTHON_LIBRARY to /usr/lib/x86_64-linux-gnu/libpython2.7.so.
  8. Press c
  9. Press g
  10. $ make -j2 The number should correspond to the number of processors in your machine.
  11. $ make install
  12. Add export LD_LIBRARY_PATH=$HOME/bin/qgis/lib to your ~/.bashrc or ~/.zshrc and re-source the shell.
  13. Start QGIS from ~/bin/qgis/bin/qgis.
  14. You can also create a .desktop file as described here.
JJD
  • 587
  • 3
  • 10
  • 27