Installing PyGMT on Google Colab

How do you install PyGMT on Google Colab notebook.

1 Like

Try running following commands in Google Colab:

!wget https://repo.anaconda.com/miniconda/Miniconda3-latest-Linux-x86_64.sh
!chmod +x Miniconda3-latest-Linux-x86_64.sh
!bash ./Miniconda3-latest-Linux-x86_64.sh -bfp /usr/local
!conda update conda -y -q
!conda config --prepend channels conda-forge
!conda install -q -y --prefix /usr/local python=3.8 pygmt

import sys
import os
sys.path.append('/usr/local/lib/python3.8/site-packages')
os.environ["GMT_LIBRARY_PATH"]="/usr/local/lib"

Then you should be able to use pygmt:

import pygmt

@seisman Worked well for me, thanks!