Skip to content

pygmt-session [ERROR]: GMT_COMPATIBILITY: Expects values from 6 to 6; reset to 6. #428

Closed

Description

@MarkWieczorek

pygmt continues to provide annoying errors about GMT_COMPATIBILITY. These can arise in many circumstances (such as in jupyter notebooks), but here is the easiest one:

In [1]: import pygmt
In [2]: exit
pygmt-session [ERROR]: GMT_COMPATIBILITY: Expects values from 6 to 6; reset to 6.
>  gmt --version
6.0.0
> brew info gmt
gmt: stable 6.0.0 (bottled), HEAD
Tools for manipulating and plotting geographic and Cartesian data
https://www.generic-mapping-tools.org/
/usr/local/Cellar/gmt/6.0.0_5 (1,584 files, 150.6MB) *

OS: macos
pygmt: v0.1 (installed via pypi)
gmt: installed by brew (v. 6.0.0_5)
python: 3.7.7

Activity

  1. weiji14 commented on May 16, 2020

    @weiji14
    Member

    Hi @MarkWieczorek, as mentioned in #365, this is an upstream issue with GMT6.0.0. You'll have to wait for 6.1.0 to be released, or build GMT from the master branch and tie that to pygmt. Alternatively, you might be able to use pygmt.config in your script to override your main gmt.conf file?

  2. seisman commented on May 16, 2020

    @seisman
    Member

    Alternatively, you might be able to use pygmt.config in your script to override your main gmt.conf file?

    What PyGMT can do is always calling "gmt set GMT_COMPATIBILITY 6" when a session is started, i.e., adding

    lib.call_module("set", "GMT_COMPATIBILITY 6")
    

    after line 17:

    def begin():
    """
    Initiate a new GMT modern mode session.
    Used in combination with :func:`pygmt.end`.
    Only meant to be used once for creating the global session.
    """
    prefix = "pygmt-session"
    with Session() as lib:
    lib.call_module("begin", prefix)
    .

  3. weiji14 commented on May 17, 2020

    @weiji14
    Member

    What PyGMT can do is always calling "gmt set GMT_COMPATIBILITY 6" when a session is started, i.e., adding

    lib.call_module("set", "GMT_COMPATIBILITY 6")
    

    Smart, I can whip a pull request for that (or review one). Could make it into a bugfix release too.

    But just a question (since I don't use gmt.conf files much), isn't it possible to set a local gmt.conf file (see https://docs.generic-mapping-tools.org/latest/cookbook/features.html?highlight=gmt%20conf#overview-and-the-gmt-conf-file) to override the main gmt.conf file in /home/.gmt?

  4. seisman commented on May 17, 2020

    @seisman
    Member

    But just a question (since I don't use gmt.conf files much), isn't it possible to set a local gmt.conf file (see https://docs.generic-mapping-tools.org/latest/cookbook/features.html?highlight=gmt%20conf#overview-and-the-gmt-conf-file) to override the main gmt.conf file in /home/.gmt?

    Yes, if you have a "gmt.conf" file in your current directory (where you run "gmt begin" or "import pygmt"), the local "gmt.conf" will be found and loaded as the "current" settings.

  5. seisman commented on May 17, 2020

    @seisman
    Member

    Running "gmt begin" (in CLI) or "import pygmt" (in PyGMT) creates a new GMT session. If you have a "gmt.conf" file in your current directory, ~/.gmt/gmt.conf or ~/gmt.conf, then it will copy the "gmt.conf" to the current session directory.

  6. MarkWieczorek commented on May 17, 2020

    @MarkWieczorek
    ContributorAuthor

    Sorry for being impatient. There were a couple post 6.0.0 gmt releases on brew (macos), and I just assumed that these would have included the prior gmt bug fixes.

  7. weiji14 commented on May 17, 2020

    @weiji14
    Member

    No worries, it's still a valid concern. We're thinking of pinning to GMT 6.1.0 (when that gets released) for PyGMT v0.2.0, so things will get properly fixed by then.

    That might take a while though, so I'll get the workaround PR done, and see if we can get it to you sooner for v0.1.1 :)

  8. weiji14 commented on May 17, 2020

    @weiji14
    Member
    lib.call_module("set", "GMT_COMPATIBILITY 6")
    

    Ok, we'll also need reset the GMT_COMPATIBILITY to the global default set in gmt.conf when we exit pygmt (but can't figure out how to...). I think that's what the actual error mentioned in the OP is about.

  9. seisman commented on May 17, 2020

    @seisman
    Member

    Ok, we'll also need reset the GMT_COMPATIBILITY to the global default set in gmt.conf when we exit pygmt.

    No need to do that. import pygmt will create a separate session directory. If any global gmt.conf file is found, it will be copied to the session directory, then

    lib.call_module("set", "GMT_COMPATIBILITY 6")
    

    only changes the value in the session gmt.conf file. When we exit pygmt, the session directory will be removed, and the global "gmt.conf" keeps untouched.

  10. added this to the 0.1.x milestone on May 20, 2020
  11. added
    bug
    on May 20, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bug

    Type

    No type

    Projects

    No projects

      Milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions