# pyGMT doesn't run on Pycharm but Jupyter

**URL:** <https://forum.generic-mapping-tools.org/t/pygmt-doesnt-run-on-pycharm-but-jupyter/1450>\
**Category:** PyGMT Q&A\
**Created:** [March 9, 2021, 11:25am UTC](https://forum.generic-mapping-tools.org/t/pygmt-doesnt-run-on-pycharm-but-jupyter/1450 "2021-03-09T11:25:31Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![zersorger](https://yyz1.discourse-cdn.com/flex047/user_avatar/forum.generic-mapping-tools.org/zersorger/32/1050_2.png) [@zersorger](https://forum.generic-mapping-tools.org/u/zersorger)\
**Post date:** [March 9, 2021, 11:25am UTC](https://forum.generic-mapping-tools.org/t/pygmt-doesnt-run-on-pycharm-but-jupyter/1450/1 "2021-03-09T11:25:31Z")

</div>

Hello everyone,

I’m not very familiar with Python, only used it sporadically with obspy. Recently in one of my master’s courses we learned about GMT and did a map on a chosen area, we used the non-python version of GMT. It wasn’t until now that I found out about pyGMT and therefore wanted to test it since I’m now more familiar with Python. Unfortunately I can’t get it to run on Pycharm, although I followed all instructions. I always get the error that pygmt modul is not found, but when I list all modules, it’s there…and I activated the environment.  
Furthermore, I never used Jupyter before, just tested it and started it from Pycharm and pygmt works there…  
Is there something I’m missing to get it to run on Pycharm?

Best wishes,  
Henning

---

<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:** [March 9, 2021, 9:32pm UTC](https://forum.generic-mapping-tools.org/t/pygmt-doesnt-run-on-pycharm-but-jupyter/1450/2 "2021-03-09T21:32:37Z")

</div>

Hi @zersorger, welcome to the community! Could you copy and paste the error message you are getting (or a screenshot) so we can help debug this? You’ve probably had a search for other related issues already, but just in case:

- [No module named pygmt - VS code](https://flint.soest.hawaii.edu/t/no-module-named-pygmt-vs-code/1231)
- [No module named pygmt in Spyder](https://flint.soest.hawaii.edu/t/no-module-named-pygmt-in-spyder/702/3)

It’s strange that PyGMT works in Jupyter for you but not in PyCharm. I realize that @Asril had the same problem at [Complete question\_Error\_basemap plotting](https://flint.soest.hawaii.edu/t/complete-question-error-basemap-plotting/861/14) and may be able to help too. If possible, double check that you activated the ‘pygmt’ conda environment properly (try [https://www.jetbrains.com/help/pycharm/conda-support-creating-conda-virtual-environment.html](https://www.jetbrains.com/help/pycharm/conda-support-creating-conda-virtual-environment.html) perhaps?) and report back.

---

<div class="post-metadata">

**Author:** ![zersorger](https://yyz1.discourse-cdn.com/flex047/user_avatar/forum.generic-mapping-tools.org/zersorger/32/1050_2.png) [@zersorger](https://forum.generic-mapping-tools.org/u/zersorger)\
**Post date:** [March 10, 2021, 12:20pm UTC](https://forum.generic-mapping-tools.org/t/pygmt-doesnt-run-on-pycharm-but-jupyter/1450/3 "2021-03-10T12:20:15Z")

</div>

Thanks very much @weiji14.

I dind’t change anything but deinstalled and reinstalled pygmt and restarted. But seems like overnight it started working (although I also de- and reinstalled it several times before…)!

---

<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:** [March 12, 2021, 2:42am UTC](https://forum.generic-mapping-tools.org/t/pygmt-doesnt-run-on-pycharm-but-jupyter/1450/4 "2021-03-12T02:42:40Z")

</div>

Great, glad to hear you solved it!

If you have some spare time, could you share the steps you did or some screenshots of how you set up PyCharm with PyGMT? It might be helpful to someone else using PyCharm in the future to know what settings to change in order for the code to run properly.

---

<div class="post-metadata">

**Author:** ![eva1234](https://avatars.discourse-cdn.com/v4/letter/e/c6cbf5/32.png) [@eva1234](https://forum.generic-mapping-tools.org/u/eva1234)\
**Post date:** [January 30, 2024, 8:24am UTC](https://forum.generic-mapping-tools.org/t/pygmt-doesnt-run-on-pycharm-but-jupyter/1450/5 "2024-01-30T08:24:20Z")

</div>

Hello  
I am having similar problems: not able to make pyGMT work on PyCharm. I see you were missing some screenshots last time, so I am going to provide it:) I am not an expert with Python or Pycharm, so excuse trivialities…

1. installing, following help ([Path variables | PyCharm Documentation](https://www.jetbrains.com/help/pycharm/absolute-path-variables.html)):  
Press Ctrl+Alt+S to open the IDE settings and then select Appearance & Behavior | Path Variables.

 ![Screenshot from 2024-01-30 09-18-07](https://canada1.discourse-cdn.com/flex047/uploads/gmt/original/2X/2/26657e7bb6da9e95a5e6ab7047db1742995853b2.png)

1. successfully installed:  

2. pygmt.exceptions.GMTCLibNotFoundError: Error loading GMT shared library at ‘libgmt.so’.  
libgmt.so: cannot open shared object file: No such file or directory  

I see its a pretty old conversation…but maybe still someone can help me (or others;) with it. Thanks Eva

---

<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:** [February 1, 2024, 11:33pm UTC](https://forum.generic-mapping-tools.org/t/pygmt-doesnt-run-on-pycharm-but-jupyter/1450/6 "2024-02-01T23:33:20Z")

</div>

Hi Eva,

Thanks for posting the screenshots 😉 The `GMTCLibNotFoundError: Error loading GMT shared library at ‘libgmt.so’` you’re getting is likely because you have not installed the GMT C library (which is what PyGMT is wrapping around). I’d recommend you follow [https://www.jetbrains.com/help/pycharm/conda-support-creating-conda-virtual-environment.html](https://www.jetbrains.com/help/pycharm/conda-support-creating-conda-virtual-environment.html) to set up a **conda** environment instead of a standard **virtualenv** (venv) if possible.
