Installing GPSTk in Anaconda Python

less than 1 minute read

GPSTk 2.10 Python examples require installing GPSTk for Python. GPSTk 2.10 requires Python 2.7.

Install GPSTk for Python

  1. Use Anaconda to switch to Python 2.7 by
    conda create -n py27 python=2.7
    conda activate py27
    conda install matplotlib
    
  2. install minimal prereqs
    apt install g++ make cmake swig
    
  3. Download gpstk source
    git clone --depth 1 https://github.com/SGL-UT/GPSTk
    cd GPSTk
    
  4. Build & install. This takes several minutes, and emits a very large number of C++11 deprecation warnings
    ./build.sh -ue
    

Test GPSTk Python

  1. get the example code
    git clone https://github.com/scivision/gpstk-examples-python
    
  2. try the examples like:
    ./example1.py
    

GPSTk Example 1

Notes

If you get an error like

CMake Error at swig/PythonSetup.cmake:45 (string): string sub-command REGEX, mode MATCH needs at least 5 arguments total to command.

Create a file GPSTk/swig/CustomPythonSetup.cmake with contents (assuming python in ~/anaconda2)

set( PYTHONLIBS_FOUND "TRUE" )
set( PYTHON_LIBRARIES
    "$ENV{HOME}/anaconda2/lib/libpython2.7.so"
    CACHE FILEPATH "File Path to system python shared object library" )
set( PYTHON_INCLUDE_DIRS
    "$ENV{HOME}/anaconda2/include/python2.7"
     CACHE PATH "Directory Path to system python includes" ) 

Tags:

Categories:

Updated:

Leave a comment