🚨 This package is in the early stages of design and implementation. 🚨
You’ll need Python 3.6 or greater to run PyGMT.
We recommend using the Anaconda Python
distribution to ensure you have all dependencies installed and the
package manager available.
Installing Anaconda does not require administrative rights to your computer and
doesn’t interfere with any other Python installations in your system.
PyGMT requires Generic Mapping Tools (GMT) version 6 as a minimum, which is the latest released version that can be found at the GMT official site. We need the latest GMT (>=6.0.0) since there are many changes being made to GMT itself in response to the development of PyGMT, mainly the new modern execution mode.
Compiled conda packages of GMT for Linux, macOS and Windows are provided through conda-forge. Advanced users can also build GMT from source instead, which is not so recommended but we would love to get feedback from anyone who tries.
We recommend following the instructions further on to install GMT 6.
PyGMT requires the following libraries:
The following are optional (but recommended) dependencies:
IPython: For embedding the figures in Jupyter notebooks.
Installing GMT and other dependencies¶
Before installing PyGMT, we must install GMT itself along with the other dependencies.
The easiest way to do this is using the
conda package manager.
We recommend working in an isolated
to avoid issues with competing versions of its dependencies.
First, we must configure conda to get packages from the conda-forge channel:
conda config --prepend channels conda-forge
Now we can create a new conda environment with Python and all our dependencies installed
(we’ll call it
pygmt but you can change it to whatever you want):
conda create --name pygmt python=3.8 pip numpy pandas xarray netcdf4 packaging gmt
Activate the environment by running:
conda activate pygmt
From now on, all commands will take place inside the conda virtual environment and won’t affect your default installation.
Now that you have GMT installed and your conda environment activated, you can
conda to install the latest release of PyGMT from conda-forge:
conda install pygmt
pip to install from PyPI:
pip install pygmt
Alternatively, you can install the development version from the Github repository:
pip install https://github.com/GenericMappingTools/pygmt/archive/master.zip
This will allow you to use the
pygmt library from Python.
Testing your install¶
PyGMT ships with a full test suite. You can run our tests after you install it but you will need a few extra dependencies as well (be sure to have your conda env activated):
conda install pytest pytest-mpl sphinx jinja2 docutils ipython
Test your installation by running the following inside a Python interpreter:
import pygmt pygmt.test()