Building GMT on FreeBSD 12.1-RELEASE

Thanks for your feedback! I think it means PyGMT works well on FreeBSD, at least the simplest examples should work.

The error you’re seeing is because the default Python console can’t “show” the image you’re plotting. You have to use fig.show(method="external") to open the figure using your default PDF viewer. (Please note that the error message says “use 'external=True” but the message is out-of-date and should be fixed.)

Great work @seisman.

I’ll play around and do some more testing when I have the time and let you know if I encounter any problems.

1 Like

I tried to install pygmt using the command:
pip install git+https://github.com/GenericMappingTools/pygmt.git@freebsd

It doesn’t work. I get this error message.

Collecting git+https://github.com/GenericMappingTools/pygmt.git@freebsd
Cloning https://github.com/GenericMappingTools/pygmt.git (to revision freebsd) to /tmp/pip-req-build-yfd06wdt
WARNING: Did not find branch or tag ‘freebsd’, assuming revision or ref.
ERROR: Command errored out with exit status 1: git checkout -q freebsd Check the logs for full command output.

This is on FreeBSD 12.1-RELEASE amd64

@ahogrelius Thanks for your trying to help. We already merged the “freebsd” branch into master branch (i.e., PyGMT now provides some basic support for FreeBSD, although there is no guarantee that it works well as expected).

To install the latest PyGMT, you can use the following command:

pip install git+https://github.com/GenericMappingTools/pygmt.git

@Andreas @ahogrelius Again, Thanks for all your help. If you find any problems, please open an issue in the PyGMT repository (https://github.com/GenericMappingTools/pygmt) so that we can better keep track of them.

I added the code segment below manually to the clib_names function in /usr/local/lib/python3.7/site-packages/pygmt/clib/loading.py

elif os_name.startswith("freebsd"):
    libnames = ["libgmt.so"]

After the addition I get the following:
Python 3.7.9 (default, Oct 3 2020, 01:29:35)
[Clang 8.0.1 (tags/RELEASE_801/final 366581)] on freebsd12
Type “help”, “copyright”, “credits” or “license” for more information.

import pygmt
pygmt.show_versions()
PyGMT information:
version: v0.2.1
System information:
python: 3.7.9 (default, Oct 3 2020, 01:29:35) [Clang 8.0.1 (tags/RELEASE_801/final 366581)]
executable: /usr/local/bin/python3
machine: FreeBSD-12.1-RELEASE-amd64-64bit-ELF
Dependency information:
numpy: 1.19.4
pandas: 1.1.4
xarray: 0.16.1
netCDF4: 1.5.4
packaging: 20.4
ghostscript: None
gmt: 6.1.1
GMT library information:
binary dir:
cores: 16
grid layout: rows
library path: /usr/local/lib/libgmt.so
padding: 2
plugin dir: /usr/local/lib/gmt/plugins
share dir: /usr/local/share/gmt
version: 6.1.1

Yes, this also worked and the result looked like expected.

import pygmt
fig = pygmt.Figure()
fig.basemap(region=[-90, -70, 0, 20], projection=“M8i”, frame=True)
fig.coast(shorelines=True)
fig.savefig(“test.pdf”)

1 Like