Doing a test about pygmt

Hello,

I’m Sihan, trying to install pygmt via anaconda according to the instructions from PYGMT web. After installation, I tried to test it but failed with this error:

import pygmt
pygmt.show_versions()
PyGMT information:
version: v0.3.0
System information:
python: 3.9.2 | packaged by conda-forge | (default, Feb 21 2021, 05:02:46) [GCC 9.3.0]
executable: /home/sihan/anaconda3/envs/pygmt/bin/python
machine: Linux-3.10.0-957.el7.x86_64-x86_64-with-glibc2.17
Dependency information:
numpy: 1.20.1
pandas: 1.2.2
xarray: 0.16.2
netCDF4: 1.5.6
packaging: 20.9
ghostscript: 9.53.3
gmt: 6.1.1
Segmentation fault (core dumped)

May someone give me some suggestions?

Thanks a million

Hmm, segmentation faults are never fun (or easy to debug). Your versions are pretty much the same as what I have, but missing the “GMT library information” part:

PyGMT information:
  version: v0.3.1.dev29+geca74273.d20210226
System information:
  python: 3.8.6 | packaged by conda-forge | (default, Jan 25 2021, 23:21:18)  [GCC 9.3.0]
  executable: /home/user/miniconda3/envs/pygmt/bin/python
  machine: Linux-4.19.0-8-amd64-x86_64-with-glibc2.10
Dependency information:
  numpy: 1.20.1
  pandas: 1.2.2
  xarray: 0.16.2
  netCDF4: 1.5.6
  packaging: 20.9
  ghostscript: 9.53.3
  gmt: 6.1.1
GMT library information:
  binary dir: /home/user/miniconda3/envs/pygmt/bin
  cores: 2
  grid layout: rows
  library path: /home/user/miniconda3/envs/pygmt/lib/libgmt.so
  padding: 2
  plugin dir: /home/user/miniconda3/envs/pygmt/lib/gmt/plugins
  share dir: /home/user/miniconda3/envs/pygmt/share/gmt
  version: 6.1.1

Could you describe a little bit more on how you installed pygmt (e.g. the commands you used), and where is it that you are running pygmt.show_versions()? Is this in a Jupyter notebook, or IPython, or somewhere else?

My guess is there is something wrong with the GMT installation, but need more information to be sure. Could you provide the output of gmt --show-library too please?

Dear weiji14,

many thanks for your reply! Yes, I installed pygmt via anaconda like this on my terminal:
(base) [sihan@localhost excluded_stations]$ conda activate pygmt
(pygmt) [sihan@localhost excluded_stations]$ conda install pygmt

after I successfully installed, I opened the python interpreter also based on terminal:

(base) [sihan@localhost excluded_stations]$ conda activate pygmt
(pygmt) [sihan@localhost excluded_stations]$ python
Python 3.9.2 | packaged by conda-forge | (default, Feb 21 2021, 05:02:46)
[GCC 9.3.0] on linux
Type “help”, “copyright”, “credits” or “license” for more information.

import pygmt
pygmt.show_versions()

afterwards, it gave me such previous error at the last:
Segmentation fault (core dumped)

I checked my gmt library, the information is here:
[sihan@localhost excluded_stations]$ gmt --show-library
/opt/GMT-6.1.1/lib64/libgmt.so

Thanks a lot for your help again!

Hmm, could you provide the output of conda list? I don’t see why gmt --show-library is pointing to /opt/GMT-6.1.1 instead of your conda environment (e.g. /home/sihan/anaconda3/envs/pygmt/....

Or are you trying to use the system installed GMT? In which case you will need set GMT_LIBRARY_PATH following https://www.pygmt.org/v0.3.0/install.html#finding-the-gmt-shared-library.

1 Like

Dear weiji,

many thnx for your kind help and reply! I finally figured this prob… just I didn’t put the right lib path for pygmt. Thanks a lot again!

1 Like