# Complete question\_Error\_basemap plotting

**URL:** <https://forum.generic-mapping-tools.org/t/complete-question-error-basemap-plotting/861>\
**Category:** PyGMT Q&A\
**Created:** [September 7, 2020, 7:04pm UTC](https://forum.generic-mapping-tools.org/t/complete-question-error-basemap-plotting/861 "2020-09-07T19:04:20Z")\
**Posts on this page:** 14\
**Page:** 1

<div class="post-metadata">

**Author:** ![Asril](https://avatars.discourse-cdn.com/v4/letter/a/9e8a1a/32.png) [@Asril](https://forum.generic-mapping-tools.org/u/Asril)\
**Post date:** [September 7, 2020, 7:04pm UTC](https://forum.generic-mapping-tools.org/t/complete-question-error-basemap-plotting/861/1 "2020-09-07T19:04:20Z")

</div>

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

```python
import pygmt
fig = pygmt.Figure()
fig.basemap(region=[-100, -50, 5, 25], frame=True, projection="M20c")
fig.coast(shorelines=True)
fig.savefig("central-america.png")
fig.show()

```

But the result is getting error. The comment is below

```auto
"C:\Users\HP OMEN\AppData\Local\Programs\Python\Python37-32\python.exe" "C:/Users/HP OMEN/Python Practices/basemap.py"
Traceback (most recent call last):
  File "C:/Users/HP OMEN/Python Practices/basemap.py", line 1, in <module>
    import pygmt
  File "C:\Users\HP OMEN\AppData\Local\Programs\Python\Python37-32\lib\site-packages\pygmt\ __init__.py", line 31, in <module>
    _begin()
  File "C:\Users\HP OMEN\AppData\Local\Programs\Python\Python37-32\lib\site-packages\pygmt\session_management.py", line 16, in begin
    with Session() as lib:
  File "C:\Users\HP OMEN\AppData\Local\Programs\Python\Python37-32\lib\site-packages\pygmt\clib\session.py", line 177, in __enter__
    self.create("pygmt-session")
  File "C:\Users\HP OMEN\AppData\Local\Programs\Python\Python37-32\lib\site-packages\pygmt\clib\session.py", line 328, in create
    restype=ctp.c_void_p,
  File "C:\Users\HP OMEN\AppData\Local\Programs\Python\Python37-32\lib\site-packages\pygmt\clib\session.py", 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\loading.py", 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

---

<div class="post-metadata">

**Author:** ![weiji14](https://yyz1.discourse-cdn.com/flex047/user_avatar/forum.generic-mapping-tools.org/weiji14/32/33_2.png) [@weiji14](https://forum.generic-mapping-tools.org/u/weiji14)\
**Post date:** [September 7, 2020, 7:19pm UTC](https://forum.generic-mapping-tools.org/t/complete-question-error-basemap-plotting/861/2 "2020-09-07T19:19:23Z")

</div>

Hi Asril,

Thr error seems to indicate that you installed PyGMT, but not GMT. Maybe try following the instructions at [https://www.pygmt.org/latest/install.html#installing-gmt-and-other-dependencies](https://www.pygmt.org/latest/install.html#installing-gmt-and-other-dependencies) and see if it helps. Or have a look at [No module named pygmt](https://flint.soest.hawaii.edu/t/no-module-named-pygmt/702) (also from someone using PyCharm).

---

<div class="post-metadata">

**Author:** ![Asril](https://avatars.discourse-cdn.com/v4/letter/a/9e8a1a/32.png) [@Asril](https://forum.generic-mapping-tools.org/u/Asril)\
**Post date:** [September 7, 2020, 7:38pm UTC](https://forum.generic-mapping-tools.org/t/complete-question-error-basemap-plotting/861/3 "2020-09-07T19:38:21Z")

</div>

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

 ![image](https://canada1.discourse-cdn.com/flex047/uploads/gmt/original/1X/10e34197b3543a5c0e24746accb9401d31f93ce0.png)

---

<div class="post-metadata">

**Author:** ![weiji14](https://yyz1.discourse-cdn.com/flex047/user_avatar/forum.generic-mapping-tools.org/weiji14/32/33_2.png) [@weiji14](https://forum.generic-mapping-tools.org/u/weiji14)\
**Post date:** [September 7, 2020, 8:18pm UTC](https://forum.generic-mapping-tools.org/t/complete-question-error-basemap-plotting/861/4 "2020-09-07T20:18:34Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![Asril](https://avatars.discourse-cdn.com/v4/letter/a/9e8a1a/32.png) [@Asril](https://forum.generic-mapping-tools.org/u/Asril)\
**Post date:** [September 8, 2020, 9:56am UTC](https://forum.generic-mapping-tools.org/t/complete-question-error-basemap-plotting/861/5 "2020-09-08T09:56:08Z")

</div>

Do you mean such this installed GMT?

 ![image](https://canada1.discourse-cdn.com/flex047/uploads/gmt/original/1X/5b596c264866ee66c4e27f58df4f4c3f58d624f8.png)

Thanks

---

<div class="post-metadata">

**Author:** ![mgrund](https://yyz1.discourse-cdn.com/flex047/user_avatar/forum.generic-mapping-tools.org/mgrund/32/139_2.png) [@mgrund](https://forum.generic-mapping-tools.org/u/mgrund)\
**Post date:** [September 8, 2020, 12:44pm UTC](https://forum.generic-mapping-tools.org/t/complete-question-error-basemap-plotting/861/6 "2020-09-08T12:44:37Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![Asril](https://avatars.discourse-cdn.com/v4/letter/a/9e8a1a/32.png) [@Asril](https://forum.generic-mapping-tools.org/u/Asril)\
**Post date:** [September 8, 2020, 4:50pm UTC](https://forum.generic-mapping-tools.org/t/complete-question-error-basemap-plotting/861/7 "2020-09-08T16:50:12Z")

</div>

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

---

<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:** [September 8, 2020, 6:15pm UTC](https://forum.generic-mapping-tools.org/t/complete-question-error-basemap-plotting/861/8 "2020-09-08T18:15:01Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![weiji14](https://yyz1.discourse-cdn.com/flex047/user_avatar/forum.generic-mapping-tools.org/weiji14/32/33_2.png) [@weiji14](https://forum.generic-mapping-tools.org/u/weiji14)\
**Post date:** [September 9, 2020, 3:14am UTC](https://forum.generic-mapping-tools.org/t/complete-question-error-basemap-plotting/861/9 "2020-09-09T03:14:17Z")

</div>

Try [Miniconda](https://repo.anaconda.com/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 [https://www.generic-mapping-tools.org/download/](https://www.generic-mapping-tools.org/download/), and set the $GMT\_LIBRARY\_PATH following [https://www.pygmt.org/dev/install.html#finding-the-gmt-shared-library](https://www.pygmt.org/dev/install.html#finding-the-gmt-shared-library).

---

<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:** [September 9, 2020, 8:55am UTC](https://forum.generic-mapping-tools.org/t/complete-question-error-basemap-plotting/861/10 "2020-09-09T08:55:39Z")

</div>

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`

---

<div class="post-metadata">

**Author:** ![mgrund](https://yyz1.discourse-cdn.com/flex047/user_avatar/forum.generic-mapping-tools.org/mgrund/32/139_2.png) [@mgrund](https://forum.generic-mapping-tools.org/u/mgrund)\
**Post date:** [September 9, 2020, 10:50am UTC](https://forum.generic-mapping-tools.org/t/complete-question-error-basemap-plotting/861/11 "2020-09-09T10:50:15Z")

</div>

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 ([https://docs.conda.io/en/latest/miniconda.html](https://docs.conda.io/en/latest/miniconda.html)).

---

<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:** [September 9, 2020, 10:57am UTC](https://forum.generic-mapping-tools.org/t/complete-question-error-basemap-plotting/861/12 "2020-09-09T10:57:04Z")

</div>

Mine is a _mini_Conda 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.

---

<div class="post-metadata">

**Author:** ![mgrund](https://yyz1.discourse-cdn.com/flex047/user_avatar/forum.generic-mapping-tools.org/mgrund/32/139_2.png) [@mgrund](https://forum.generic-mapping-tools.org/u/mgrund)\
**Post date:** [September 9, 2020, 10:57am UTC](https://forum.generic-mapping-tools.org/t/complete-question-error-basemap-plotting/861/13 "2020-09-09T10:57:42Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![Asril](https://avatars.discourse-cdn.com/v4/letter/a/9e8a1a/32.png) [@Asril](https://forum.generic-mapping-tools.org/u/Asril)\
**Post date:** [September 10, 2020, 7:57am UTC](https://forum.generic-mapping-tools.org/t/complete-question-error-basemap-plotting/861/14 "2020-09-10T07:57:15Z")

</div>

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

 ![image](https://canada1.discourse-cdn.com/flex047/uploads/gmt/original/1X/291f840d75a9fa0c110031620d506c1085023b34.png)
