Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Upgrade gmt from 6.0.0rc1 to 6.0.0rc4 #327

Merged
merged 6 commits into from
Oct 1, 2019
Merged
Show file tree
Hide file tree
Changes from 5 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
67 changes: 35 additions & 32 deletions doc/install.rst
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ Which Python?

You'll need **Python 3.6 or greater** to run PyGMT.

We recommend using the `Anaconda <http:https://continuum.io/downloads#all>`__ Python
We recommend using the `Anaconda <https:https://www.anaconda.com/distribution>`__ Python
distribution to ensure you have all dependencies installed and the ``conda``
package manager available.
Installing Anaconda does not require administrative rights to your computer and
Expand All @@ -29,14 +29,23 @@ doesn't interfere with any other Python installations in your system.
Which GMT?
----------

You'll need the latest development version available from
`the GitHub repository <https://github.com/GenericMappingTools/gmt>`__.
PyGMT is based on GMT 6, **which has not yet been officially released**.
PyGMT requires GMT 6 as a minimum, which you can find the latest development version
at `this GitHub repository <https://github.com/GenericMappingTools/gmt>`__.

We need the very latest GMT since there are many changes being made to GMT itself in
response to the development of PyGMT, mainly the new
`modern execution mode <http:https://gmt.soest.hawaii.edu/projects/gmt/wiki/Modernization>`__.
`modern execution mode <https:https://gmt.soest.hawaii.edu/projects/gmt/wiki/Modernization>`__.

**GMT 6 has not been officially released yet**, but will be soon!
In the meantime, GMT does provide compiled conda packages of their development version
for Linux, Mac and Windows through
`conda-forge <https://anaconda.org/conda-forge/gmt>`__.
Advanced users can also
`build GMT from source <https://github.com/GenericMappingTools/gmt/blob/master/BUILDING.md>`__
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.

Dependencies
------------
Expand All @@ -53,44 +62,38 @@ The following are optional (but recommended) dependencies:
* `IPython <https://ipython.org/>`__: For embedding the figures in Jupyter notebooks.


Installing GMT
--------------

Unfortunately, you'll have to build GMT from source in order to get PyGMT working.
Please follow the `GMT Building Instructions <https://github.com/GenericMappingTools/gmt/blob/master/BUILDING.md>`__.

For Windows users, you can also try to install the binaries of
GMT development version, available from http:https://w3.ualg.pt/~jluis/mirone/downloads/gmt.html.
Currently, we don't have tests running on Windows yet, so things might be broken.
Please report any errors by `creating an issue on Github <https://github.com/GenericMappingTools/pygmt/issues>`__.

.. note::

We used to maintain conda packages for the latest GMT. That caused many problems and
was very difficult to maintain updated. We have opted to not do that anymore so that
we can develop more quickly. Once GMT 6 is officially released, we'll have conda
packages available again. Please bear with us.

Installing dependencies
-----------------------
Installing GMT and other dependencies
-------------------------------------

Before installing PyGMT, we must install its 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
`conda environment <https://conda.io/docs/user-guide/tasks/manage-environments.html>`__
`conda environment <https://conda.io/projects/conda/en/latest/user-guide/tasks/manage-environments.html>`__
to avoid issues with competing versions of its dependencies.

We can create a new conda environment with Python and all our dependencies installed
First, we must configure conda to get packages from the
`conda-forge channel <https://conda-forge.org/>`__ (the order is important)::

conda config --prepend channels conda-forge/label/dev
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.6 pip numpy pandas xarray packaging
conda create --name pygmt python=3.6 pip numpy pandas xarray packaging gmt=6.0.0rc*

Activate the environment by running::

source activate pygmt
conda activate pygmt

From now on, all commands will take place inside the conda virtual environment and won't
affect your default installation.

.. note::

From now on, all commands will take place inside the environment and won't affect your
default installation.
**Currently, this has only been tested to work on Linux and macOS.**
We don't have tests running on Windows yet, so things might be broken.
Please report any errors by `creating an issue on Github <https://github.com/GenericMappingTools/pygmt/issues>`__.

Installing PyGMT
----------------
Expand Down
6 changes: 3 additions & 3 deletions pygmt/clib/session.py
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ class Session:
library in the directory specified by it.

A ``GMTVersionError`` exception will be raised if the GMT shared library reports a
version < 6.0.0rc1.
version < 6.0.0rc4.

The ``session_pointer`` attribute holds a ctypes pointer to the currently open
session.
Expand Down Expand Up @@ -112,7 +112,7 @@ class Session:
"""

# The minimum version of GMT required
required_version = "6.0.0rc1"
required_version = "6.0.0rc4"

@property
def session_pointer(self):
Expand Down Expand Up @@ -463,7 +463,7 @@ def call_module(self, module, args):
Parameters
----------
module : str
Module name (``'pscoast'``, ``'psbasemap'``, etc).
Module name (``'coast'``, ``'basemap'``, etc).
args : str
String with the command line arguments that will be passed to the
module (for example, ``'-R0/5/0/10 -JM'``).
Expand Down
2 changes: 1 addition & 1 deletion pygmt/tests/test_clib.py
Original file line number Diff line number Diff line change
Expand Up @@ -791,7 +791,7 @@ def test_get_default():
with clib.Session() as lib:
assert lib.get_default("API_GRID_LAYOUT") in ["rows", "columns"]
assert int(lib.get_default("API_CORES")) >= 1
assert Version(lib.get_default("API_VERSION")) >= Version("6.0.0rc1")
assert Version(lib.get_default("API_VERSION")) >= Version("6.0.0rc4")


def test_get_default_fails():
Expand Down
2 changes: 1 addition & 1 deletion pygmt/tests/test_session_management.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ def test_begin_end():
end() # Kill the global session
begin()
with Session() as lib:
lib.call_module("psbasemap", "-R10/70/-3/8 -JX4i/3i -Ba")
lib.call_module("basemap", "-R10/70/-3/8 -JX4i/3i -Ba")
end()
begin() # Restart the global session
assert os.path.exists("pygmt-session.pdf")
Expand Down
2 changes: 1 addition & 1 deletion requirements.txt
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# Requirements for installing with conda
gmt=6.0.0rc1
gmt=6.0.0rc4
numpy
pandas
xarray
Expand Down