I followed the steps described on https://www.pygmt.org/dev/install.html and everything looked right. However, using the prompt I can start python and check pygmt.show_versions() BUT not in jupyter notebook or jupyter lab (see pictures).
On the kernel selection, only Python 3 is available.
Python and Pygmt is correctly installed and “pip install” shows “pygmt 0.3.1”.
What I’m doing wrong ?
You might need to install the
pygmt kernel, see No module named pygmt - VS code, i.e. run this in your command prompt:
conda activate pygmt python -m ipykernel install --user --name pygmt #to install conda env properly jupyter kernelspec list --json #see if kernel is installed
after that, you may need to shutdown jupyter and relaunch it to see the ‘pygmt’ kernel. Let us know if that works.
Voilà ! (Thanks @weiji14)
it worked like a charm, but I had to install the ipykernel. Interestingly I already had it in the base but when I installed pygmt via “conda create --name pygmt --channel conda-forge pygmt”, it just didn’t come with the ipykernel.
So, to recap: [from pygmt install instructions]
- conda config --prepend channels conda-forge
- conda create --name pygmt python=3.9 numpy pandas xarray netcdf4 packaging gmt
- conda activate pygmt
- conda install pygmt
- [if you are paranoic] conda update pygmt
- [in my case] conda install ipykernel
- python -m ipykernel install --user --name pygmt
- jupyter kernelspec list --json [just to test…it worked]