# No module named pygmt in Spyder

**URL:** https://forum.generic-mapping-tools.org/t/no-module-named-pygmt-in-spyder/702
**Category:** PyGMT Q&A
**Created:** [July 23, 2020, 5:23pm UTC](https://forum.generic-mapping-tools.org/t/no-module-named-pygmt-in-spyder/702 "2020-07-23T17:23:16Z")
**Posts on this page:** 5
**Page:** 1

<div class="post-metadata">

### Author: ![Saren](https://avatars.discourse-cdn.com/v4/letter/s/f05b48/32.png) [@Saren](https://forum.generic-mapping-tools.org/u/Saren)
#### Post date: [July 23, 2020, 5:23pm UTC](https://forum.generic-mapping-tools.org/t/no-module-named-pygmt-in-spyder/702/1 "2020-07-23T17:23:17Z")

</div>

Hello! I’m new to both python and gmt. I installed pygmt with anaconda following all instructions but when I try to import pygmt I get an error “no module named pygmt” … During the installation everything went fine, can anyone help me with this issue? Thank you.

---

<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: [July 23, 2020, 6:40pm UTC](https://forum.generic-mapping-tools.org/t/no-module-named-pygmt-in-spyder/702/2 "2020-07-23T18:40:59Z")

</div>

Hi @Saren, welcome! Could you run us through the commands you used to arrive at the error? It might be that you need to do `conda activate pygmt` (or the name of your conda environment) first. If you copy and paste the full error mesage, or show us a screenshot of what’s happening, that will help us to help you better!

---

<div class="post-metadata">

### Author: ![Saren](https://avatars.discourse-cdn.com/v4/letter/s/f05b48/32.png) [@Saren](https://forum.generic-mapping-tools.org/u/Saren)
#### Post date: [July 23, 2020, 7:36pm UTC](https://forum.generic-mapping-tools.org/t/no-module-named-pygmt-in-spyder/702/3 "2020-07-23T19:36:53Z")

</div>

![error](https://canada1.discourse-cdn.com/flex047/uploads/gmt/original/1X/86472fc352d81833c3fc91dbceb11f2c388191bb.png)  
Hi! Thanks for your quick answer! I attached a screenshot of the error. I’m using spyder and I realised it was using pythong 3.7 instead of python 3.8, so I tried to import gmt in jupyter but the error is the same as you can see in the other picture ![jupyter](https://canada1.discourse-cdn.com/flex047/uploads/gmt/original/1X/6b980725aba602d0508fd2928a9d32a5d916ea8f.png). I tried a solution from github dated 2017 and it still doesn’t work… I installed anaconda two months ago,I updated it and tried to install gmt again but it still doesn’t work…

---

<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: [July 24, 2020, 12:03am UTC](https://forum.generic-mapping-tools.org/t/no-module-named-pygmt-in-spyder/702/4 "2020-07-24T00:03:12Z")

</div>

Ok, in Spyder on your bottom right, notice the “conda: base (Python 3.7.6)”? I’m not sure if you can click on it, but you’ll probably need to find a way to change it to “conda: pygmt (Python 3.8.X)”. This will make sure you’re using the `'pygmt'` [conda environment](https://docs.conda.io/projects/conda/en/latest/user-guide/tasks/manage-environments.html) instead of the regular `'base'` one.

In Jupyter notebook, you can click on `Kernel-> Change Kernel -> pygmt` to change the python kernel being used:

 ![Change kernel in Jupyter Notebook](https://canada1.discourse-cdn.com/flex047/uploads/gmt/original/1X/3f87f22672612c066906880758a5b9526055c8bd.png)

Note that I’m assuming you’ve followed the instructions at [Installing — PyGMT](https://www.pygmt.org/latest/install.html) to install `gmt` and `pygmt` into a python virtual environment called “pygmt” (Let me know if this is confusing). You could also type `conda env list` in the terminal to see if that’s the name you used.

Also, just a heads up that running `pygmt.test()` might give you some errors (see [https://flint.soest.hawaii.edu/t/about-pygmt-test/598](https://flint.soest.hawaii.edu/t/about-pygmt-test/598)), don’t worry, that’s expected for now. Let me know if that helps 😄

---

<div class="post-metadata">

### Author: ![Saren](https://avatars.discourse-cdn.com/v4/letter/s/f05b48/32.png) [@Saren](https://forum.generic-mapping-tools.org/u/Saren)
#### Post date: [July 24, 2020, 9:53am UTC](https://forum.generic-mapping-tools.org/t/no-module-named-pygmt-in-spyder/702/5 "2020-07-24T09:53:08Z")

</div>

Thank you so much, you were right I wasn’t in the right environment: it turns out that to change environment with spyder you need to launch it from the anaconda prompt windows otherwise it can’t connect to the gmt kernel. Problem solved 😅! Thank you again for your time 😉
