No module named pygmt - VS code

Right, you’ll need to install the pygmt kernel then. Run these commands in your anaconda 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

The output should of jupyter kernelspec list --json should include a section that looks like this:

    "pygmt": {
      "resource_dir": "/home/username/.local/share/jupyter/kernels/pygmt",
      "spec": {
        "argv": [
          "/home/username/miniconda3/envs/pygmt/bin/python",
          "-m",
          "ipykernel_launcher",
          "-f",
          "{connection_file}"
        ],
        "env": {},
        "display_name": "pygmt",
        "language": "python",
        "interrupt_mode": "signal",
        "metadata": {}
      }
    },

After this, if you re-launch jupyter, there should be a pygmt kernel you can connect to. Let me know if that works.

1 Like