Complete question_Error_basemap plotting

Hello Leo

I am learning GMT plotting and getting across with your github about pygmt. I am also learning python.

I use Pycharm IDE and was trying to plot the basemap of your poster titled Central america with exact code written on your poster. Unfortunately, it does not work. I installed pygmt for the project interpreter.

I tried to rewrite your script of basemap plotting on my pycharm. The script is such below

import pygmt
fig = pygmt.Figure()
fig.basemap(region=[-100, -50, 5, 25], frame=True, projection="M20c")

But the result is getting error. The comment is below

"C:\Users\HP OMEN\AppData\Local\Programs\Python\Python37-32\python.exe" "C:/Users/HP OMEN/Python Practices/"
Traceback (most recent call last):
  File "C:/Users/HP OMEN/Python Practices/", line 1, in <module>
    import pygmt
  File "C:\Users\HP OMEN\AppData\Local\Programs\Python\Python37-32\lib\site-packages\pygmt\", line 31, in <module>
  File "C:\Users\HP OMEN\AppData\Local\Programs\Python\Python37-32\lib\site-packages\pygmt\", line 16, in begin
    with Session() as lib:
  File "C:\Users\HP OMEN\AppData\Local\Programs\Python\Python37-32\lib\site-packages\pygmt\clib\", line 177, in __enter__
  File "C:\Users\HP OMEN\AppData\Local\Programs\Python\Python37-32\lib\site-packages\pygmt\clib\", line 328, in create
  File "C:\Users\HP OMEN\AppData\Local\Programs\Python\Python37-32\lib\site-packages\pygmt\clib\", line 276, in get_libgmt_func
    self._libgmt = load_libgmt()
  File "C:\Users\HP OMEN\AppData\Local\Programs\Python\Python37-32\lib\site-packages\pygmt\clib\", line 48, in load_libgmt
    ", ".join(lib_fullnames)
pygmt.exceptions.GMTCLibNotFoundError: Error loading the GMT shared library 'gmt.dll, gmt_w64.dll, gmt_w32.dll, c:\programs\gmt6\bin\gmt_w64.dll':

Process finished with exit code 1

Could you guide me to solve it? Thanks in advance

Hi Asril,

Thr error seems to indicate that you installed PyGMT, but not GMT. Maybe try following the instructions at and see if it helps. Or have a look at No module named pygmt (also from someone using PyCharm).

There is no GMT module available in the PyCharm, but there is only pygmt. Should I install other IDEs to have GMT module?

No, you just need to install GMT which is a C library (i.e. non-python). PyGMT is a Pythonic wrapper around this GMT C library.

Do you mean such this installed GMT?


If you use anaconda simply create a new environment by:

conda create --name pygmt python=3.8 pip numpy pandas xarray netcdf4 packaging gmt

which will install GMT. Then follow the instructions given by @weiji14

Thank mgrund. That means I have to install anaconda for running the package

I don’t understand why the recommendation is to install Anaconda (a multi Giga bytes beast) and its GMT. I have the official GMT binaries (Windows) and PyGMT works for me. Never tried from an IDE though.

1 Like

Try Miniconda, it’s only ~55MB. Anaconda is meant for people who just want everything. Using conda is the recommended method for PyGMT as you don’t have to mess with the $PATH variables.

Or you can go with @Joaquim’s suggestion and download GMT at, and set the $GMT_LIBRARY_PATH following

I’m yet to see a such small Conda. Mine has 6.7 GB (???) and recently on Julia for a package that needed netcdf.dll it installed a conda with ~800 MB.

I also don’t understand why one needs to set GMT_LIBRARY_PATH on Windows (we don’t). With a correct GMT installation the GMT bin dir is in the Windows path so the system knows how to find there the gmt dll.

BTW, on Julia I make use of the fact that gmt --show-library tells us where is the GMT shared lib. I use it on *nix to find the lib. I think the same could be adopted by pygmt and hence no more need for a how-to-find-the-gmt-shared-library

good point! @weiji14 ’ s suggestion to use miniconda here is obviously the better way instead installing the whole anaconda content. Miniconda should be less than 100 MB, regardless which OS (

Mine is a miniConda to which I added some packages over the time. But I still think is preferable to install 0 Mb extras when that is possible. A GMT-in-conda is not easily used outside python so often users will end up with two GMT installations.

Yes or you use miniconda if you dont need all the rest which comes along with anaconda as suggested by @weiji14 . However @Joaquim lined out a way how you can do it without having anaconda/miniconda.

Thank for your @weiji14, @Joaquim ,and @mgrund suggestions. Before receiving these messages, I installed the Anaconda and tried to run the same script runned in the Pycharm. Then the same result appeared (as picture) that @Saren experienced and solved. I tried to do what @weiji14 suggested for @Saren that changed from conda : base to kernel. The conda:base can not be clicked on. Could you @weiji14 or @Saren help me how to do that. Many thanks