Import PyGMT in JupyterLab error

Hello,

I’m new to GMT and I was trying to install PyGMT on JupyterLab when I got the following error.

GMTCLibNotFoundError: Error loading GMT shared library at 'libgmt.so'.
libgmt.so: cannot open shared object file: No such file or directory

I have looked at the install guide and the various posts on the forum where others have encountered the same issue but none of the solutions seemed to have worked for me. May I get some help with this?

Hello @Edgar, could you briefly describe the way you installed PyGMT and GMT (the C library)? The error message you posted indicates that PyGMT is having trouble finding the GMT C library, so you would either need to provide the correct path following https://www.pygmt.org/v0.6.1/install.html#finding-the-gmt-shared-library, or more usually, it would be a matter of activating the Python virtual environment correctly.

If you let us know which Operating system (Windows/macOS/Linux) and package manager you are using (e.g. conda, apt-get, brew, etc), it’ll be easier for us to advise on what to do.

Hi Wei Ji,

I am using Windows and I installed the 64 bit standalone installers from the repository and I followed the conda install method from the install guide. Weirdly enough, I managed to install and import PyGMT locally on Anaconda and worked there instead so I somewhat avoided the JupyterLab problem.

Hmm I see, maybe double-check that you have set jupyter to use the pygmt kernel? See my answer at https://flint.soest.hawaii.edu/t/no-module-named-pygmt-in-spyder/702/3. There should be a place on the top-right corner where you can select the kernel.

Change kernel in Jupyter Lab