# Can't find my error

**URL:** <https://forum.generic-mapping-tools.org/t/cant-find-my-error/3137>\
**Category:** Q&A\
**Created:** [July 19, 2022, 5:15pm UTC](https://forum.generic-mapping-tools.org/t/cant-find-my-error/3137 "2022-07-19T17:15:19Z")\
**Posts on this page:** 12\
**Page:** 1

<div class="post-metadata">

**Author:** ![jaltekruse](https://yyz1.discourse-cdn.com/flex047/user_avatar/forum.generic-mapping-tools.org/jaltekruse/32/1607_2.png) [@jaltekruse](https://forum.generic-mapping-tools.org/u/jaltekruse)\
**Post date:** [July 19, 2022, 5:15pm UTC](https://forum.generic-mapping-tools.org/t/cant-find-my-error/3137/1 "2022-07-19T17:15:19Z")

</div>

I’m at a loss, please help! I expected the colorbar to be centered beneath the subplot, but for some reason it’s not ending up where I think it should. I have scripts that make a whole bunch of maps with 1x2 subplots, each subplot with a color bar centered below it. I changed something and now it’s not working. I’m sure it’s a small flag or offset that I can’t find (and of course I’m on a deadline…)

Here’s a stripped down sample with only one subplot (with both subplots, the colorbars are plotted on top of each other)

```shell
gmt begin test-cbar png A+m0.1c

gmt subplot begin 1x1 -Fs4i/0 -R-125.5/-110.5/37.0/49.5 -JM4i -Sr -BWeSn -Baf

gmt subplot set 

gmt coast -Na/0.2p,dimgray -W0.2p,dimgray -Df -A10000

echo "Dummy subplot" | gmt text -F+cTL+f10p -Dj0.15c/0.2c -C0.1c -Gwhite

gmt colorbar -Cbam -DJBC+w90%/5%+e -Bxa0.1f0.05g0.1 -F+g255+c0 -Np

gmt subplot end
gmt end show

```

Thanks!!!

 ![test-cbar](https://canada1.discourse-cdn.com/flex047/uploads/gmt/original/2X/e/e072aac48480c0af053e08d2a6298882150de38d.png)

---

<div class="post-metadata">

**Author:** ![pwessel](https://yyz1.discourse-cdn.com/flex047/user_avatar/forum.generic-mapping-tools.org/pwessel/32/30_2.png) [@pwessel](https://forum.generic-mapping-tools.org/u/pwessel)\
**Post date:** [July 19, 2022, 5:41pm UTC](https://forum.generic-mapping-tools.org/t/cant-find-my-error/3137/2 "2022-07-19T17:41:43Z")

</div>

Unable to reproduce - works fine here. What GMT version and OS?

---

<div class="post-metadata">

**Author:** ![jaltekruse](https://yyz1.discourse-cdn.com/flex047/user_avatar/forum.generic-mapping-tools.org/jaltekruse/32/1607_2.png) [@jaltekruse](https://forum.generic-mapping-tools.org/u/jaltekruse)\
**Post date:** [July 19, 2022, 5:48pm UTC](https://forum.generic-mapping-tools.org/t/cant-find-my-error/3137/3 "2022-07-19T17:48:46Z")

</div>

I was afraid of that.  
gmt 6.3.0 on macOS (installed via conda).

I’ve also been getting `gmt [WARNING]: GMT_COMPATIBILITY: Expects values from 6 to 6; reset to 6.`, so it seems to be grabbing a bad/old config file from somewhere, but I’m not sure where.

---

<div class="post-metadata">

**Author:** ![pwessel](https://yyz1.discourse-cdn.com/flex047/user_avatar/forum.generic-mapping-tools.org/pwessel/32/30_2.png) [@pwessel](https://forum.generic-mapping-tools.org/u/pwessel)\
**Post date:** [July 19, 2022, 6:04pm UTC](https://forum.generic-mapping-tools.org/t/cant-find-my-error/3137/4 "2022-07-19T18:04:08Z")

</div>

Seems fine with 6.3.0 here on my mac (via bundle). Look for old gmt.conf files lurking around.

---

<div class="post-metadata">

**Author:** ![jaltekruse](https://yyz1.discourse-cdn.com/flex047/user_avatar/forum.generic-mapping-tools.org/jaltekruse/32/1607_2.png) [@jaltekruse](https://forum.generic-mapping-tools.org/u/jaltekruse)\
**Post date:** [July 19, 2022, 6:12pm UTC](https://forum.generic-mapping-tools.org/t/cant-find-my-error/3137/5 "2022-07-19T18:12:51Z")

</div>

Shouldn’t adding `-C` to the `gmt begin` command make sure that the session is started with no old gmt.conf files? I do this and still get the mis-placed colorbar and GMT\_COMPATIBILITY warning. `gmt defaults -D`, which I expect to get the system defaults, has GMT\_COMPATIBILITY = 6, so I’m not sure where this is coming from (and I’ve made sure `~/.gmt/gmt.conf` and `./gmt.conf` match the system defaults)

---

<div class="post-metadata">

**Author:** ![pwessel](https://yyz1.discourse-cdn.com/flex047/user_avatar/forum.generic-mapping-tools.org/pwessel/32/30_2.png) [@pwessel](https://forum.generic-mapping-tools.org/u/pwessel)\
**Post date:** [July 19, 2022, 6:38pm UTC](https://forum.generic-mapping-tools.org/t/cant-find-my-error/3137/6 "2022-07-19T18:38:40Z")

</div>

yes. Not sure of course. Things to check: More than one GMT installation and mixup in paths? printenv | grep GMT and look for odd environmental settings. Maybe someone else using GMT via conda can list other issues.

---

<div class="post-metadata">

**Author:** ![jaltekruse](https://yyz1.discourse-cdn.com/flex047/user_avatar/forum.generic-mapping-tools.org/jaltekruse/32/1607_2.png) [@jaltekruse](https://forum.generic-mapping-tools.org/u/jaltekruse)\
**Post date:** [July 19, 2022, 6:50pm UTC](https://forum.generic-mapping-tools.org/t/cant-find-my-error/3137/7 "2022-07-19T18:50:46Z")

</div>

`printenv | grep GMT` returns nothing. `gmt --show-sharedir` points to ~/miniconda3/envs/gmt\_py3/share/gmt in the conda environment . Last time I updated gmt, I deleted the entire environment and started from scratch with a saved environment file. Unfortunately, I don’t remember when those compatibility warnings started cropping up as I thought it was just because of an older config file hanging around in a different project.

I do have some older GMT installations, all in conda environments (so these _should_ be isolated). This afternoon, I’ll probably delete all copies of gmt.conf that I can find on my machine, delete all conda environments containing GMT, and start over.

---

<div class="post-metadata">

**Author:** ![jaltekruse](https://yyz1.discourse-cdn.com/flex047/user_avatar/forum.generic-mapping-tools.org/jaltekruse/32/1607_2.png) [@jaltekruse](https://forum.generic-mapping-tools.org/u/jaltekruse)\
**Post date:** [July 19, 2022, 10:47pm UTC](https://forum.generic-mapping-tools.org/t/cant-find-my-error/3137/8 "2022-07-19T22:47:08Z")

</div>

Apparent solution (may work without uninstalling/reinstalling all GMT installations):

```auto
gmt clear sessions

```

I eventually found and ran `gmt clear sessions` after noticing that there were a few dozen or so `gmt_session.#####` folders in `~/.gmt/sessions/`. This removed all of these and the next time I tried running a script, it worked - no compatibility warnings and color bars as expected. I notice that `gmt_session.#####` folders don’t persist after my recent runs, maybe old ones were hanging around (and re-activated???) after I interrupted scripts with Ctrl+Z or Ctrl+.?

Before I found the solution above, I uninstalled all instances of GMT (all were in conda environments, so I deleted those environments) and deleted/renamed all `gmt.conf` files I could find on my machine. After a reboot, I recreated the conda environment with GMT (now v6.4.0). I reran an existing script that hasn’t been modified since it ran successfully (i.e. put the color bars in the right place), and got the same GMT\_COMPATIBILITY warning and misplaced color bars.

@pwessel - lacking any `gmt.conf` files on my computer (as best I can tell), where does `gmt defaults -Ds` get the defaults? For me, this returns defaults with GMT\_COMPATIBILITY=4 (from a clean v6.4.0 installation via conda: gmt, version = 6.4.0, build = h7f1b9d3\_1, channel = conda-forge). This doesn’t seem to cause the compatibility warnings after clearing the sessions, so those warnings must have been coming from something in one of those.

---

<div class="post-metadata">

**Author:** ![Joaquim](https://yyz1.discourse-cdn.com/flex047/user_avatar/forum.generic-mapping-tools.org/joaquim/32/16_2.png) [@Joaquim](https://forum.generic-mapping-tools.org/u/Joaquim)\
**Post date:** [July 19, 2022, 11:06pm UTC](https://forum.generic-mapping-tools.org/t/cant-find-my-error/3137/9 "2022-07-19T23:06:58Z")

</div>

> [@jaltekruse](#):
>
> where does `gmt defaults -Ds` get the defaults?

From where the GMT documentation explains it does. From memory: current dir, user home dir, GMT default values. Now if Conda, and the crazy idea that every installation should go into its own environment (and makes a copy of everything like it does on Windows), is mixing this simple rule, that I don’t know.

---

<div class="post-metadata">

**Author:** ![jaltekruse](https://yyz1.discourse-cdn.com/flex047/user_avatar/forum.generic-mapping-tools.org/jaltekruse/32/1607_2.png) [@jaltekruse](https://forum.generic-mapping-tools.org/u/jaltekruse)\
**Post date:** [July 19, 2022, 11:50pm UTC](https://forum.generic-mapping-tools.org/t/cant-find-my-error/3137/10 "2022-07-19T23:50:32Z")

</div>

I skipped a thought or two in my question, after deleting or renaming all gmt.conf files on my system (so nothing in current dir or home dir or ~/.gmt/, where are the system GMT default values stored? I seem to recall, from many machines/OSes/GMT versions ago, system default files (.gmtdefaults?) somewhere in the GMT installation directory, but I haven’t found the equivalent with recent versions (installed by conda).

The compatibility warning was, I think, a red herring, since even with the compatibility set to 4 after clearing the sessions, I’m no longer getting the compatibility warnings or misplaced color bars.

Peter, Joaquim - thanks for your help!

---

<div class="post-metadata">

**Author:** ![Joaquim](https://yyz1.discourse-cdn.com/flex047/user_avatar/forum.generic-mapping-tools.org/joaquim/32/16_2.png) [@Joaquim](https://forum.generic-mapping-tools.org/u/Joaquim)\
**Post date:** [July 19, 2022, 11:54pm UTC](https://forum.generic-mapping-tools.org/t/cant-find-my-error/3137/11 "2022-07-19T23:54:04Z")

</div>

Yep, many moons ago the gmtdefauts used to be stored in an internal text file but now they are inbeded in the binary code.

---

<div class="post-metadata">

**Author:** ![pwessel](https://yyz1.discourse-cdn.com/flex047/user_avatar/forum.generic-mapping-tools.org/pwessel/32/30_2.png) [@pwessel](https://forum.generic-mapping-tools.org/u/pwessel)\
**Post date:** [July 20, 2022, 7:18am UTC](https://forum.generic-mapping-tools.org/t/cant-find-my-error/3137/12 "2022-07-20T07:18:31Z")

</div>

All good. If you want to get compatibility warnings so you can upgrade any affected options in your script then you just set the compatibility level to 6 and it will complain.
