Skip to content

Instantly share code, notes, and snippets.

@holishing
Last active July 12, 2019 10:20
Show Gist options
  • Save holishing/019b2c8d025b9395aa8d9adae0f0de3c to your computer and use it in GitHub Desktop.
Save holishing/019b2c8d025b9395aa8d9adae0f0de3c to your computer and use it in GitHub Desktop.
Testing PyGMT on Debian Buster without Anaconda Python 3

Testing PyGMT on Debian Buster without Anaconda Python 3

Steps

  1. To build debain package, we need:
apt install fakeroot dpkg-dev build-essential \
            devscripts debhelper git # with root
                                     # git for fetching debian salsa repo
  1. make a new directory to place binary package and git repo:
mkdir dpkggmt # named by yourself
cd dpkggmt
  1. Fetch GMT Package on salsa git repo maintained by Debian GIS Project:
git clone https://salsa.debian.org/debian-gis-team/gmt.git gmt-debian
## renamed with gmt-debian in case of cufusing with gmt offical git repo
  1. checkout experimental branch
cd gmt-debian && git checkout experimental
  1. use mk-build-deps to make a virtual package with build dependencies (more convenient to autoremove)
mk-build-deps debian/control
apt install --no-install-recommends ./gmt-build-deps_6.0.0~rc2+dfsg-1~exp2_all.deb # with root
apt --fix-broken --no-install-recommends install # with root
  1. start to build package
debuild -b -rfakeroot -us -uc
  1. intsall gmt6
apt install ./gmt_6.0.0~rc2+dfsg-1~exp2_amd64.deb \
            ./libgmt6_6.0.0~rc2+dfsg-1~exp2_amd64.deb \
            ./gmt-common_6.0.0~rc2+dfsg-1~exp2_all.deb \
            ./gmt-doc_6.0.0~rc2+dfsg-1~exp2_all.deb \
            ./libgmt-dev_6.0.0~rc2+dfsg-1~exp2_amd64.deb  # with root
  1. install python3 (>=3.7, default version in buster), virtualenv
apt install virtualenv  # with root
  1. make another directory named pygmt
mkdir pygmt
  1. make virtual environment with virtualenv
virtualenv -p $(which python3) pygmt
  1. set up gmt library environment path, activate it
cd pygmt
echo 'export GMT_LIBRARY_PATH="/lib/x86_64-linux-gnu"' >> bin/activate
source bin/activate   ## enter "deactivate" command to exit the environment
  1. install git version pygmt with pip in virtual environment
#pip insatll pygmt  ## there's some problem in PyPI verion
pip install https://github.com/GenericMappingTools/pygmt/archive/master.tar.gz
  1. use python (python3) to test
python
>>> import pygmt ## if there's no error message, it works!

if advanced test is needed:

curl -LO https://github.com/GenericMappingTools/pygmt/raw/master/requirements-dev.txt
pip install -r requirements-dev.txt
python -c "import pygmt;pygmt.test()"

You can also test with these example in offcial tutorials: https://www.pygmt.org/dev/tutorials/first-figure.html

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment