Skip to content

import pygmt raises ModuleNotFoundError in Jupyter #2113

Closed

Description

@jason996cj

Hello, thank you and your team for a job well done !My PYGMT does not work properly. Modulenotfounderror will appear when it is called after installation. However, when I go to PIP or Conda to install it, it says that it has been installed.
And I'm using windows 10 professional, cpu is 11th Gen Inter i7-11700. python software I'm using conda 4.14.0 platform, current python version is 3.9.12. GMT version installed on computer is 6.4.0, pygmt installed during debugging is latest version v0.7.0. During debugging I have used python 3.10, 3.8, 3.7 and other virtual environments, none of them will make pygmt work.

I failed to solve the problem by following some solutions on the Internet, so I had to turn to your development team for help, thank you!
my email: [email protected] ,looking forward to your reply or email !

Activity

  1. added
    bug
    on Sep 8, 2022
  2. welcome commented on Sep 8, 2022

    @welcome

    👋 Thanks for opening your first issue here! Please make sure you filled out the template with as much detail as possible. You might also want to take a look at our contributing guidelines and code of conduct.

  3. added
    question
    on Sep 8, 2022
  4. added this to the 0.8.0 milestone on Sep 8, 2022
  5. removed
    bug
    on Sep 8, 2022
  6. removed this from the 0.8.0 milestone on Sep 8, 2022
  7. seisman commented on Sep 8, 2022

    @seisman
    Member

    Please provide more information so that we can help you:

    1. How do you install Python?
    2. How do you install PyGMT and GMT?
    3. Please post the full error messages when your python raises "ModuleNotFoundError"
  8. jason996cj commented on Sep 8, 2022

    @jason996cj
    Author

    Hello Professor Tian, my situation is as follows.

    1. python 3.9.12 installed with anaconda 4.14.0.
    2. pygmt installed with the 6.4.0 installer downloaded from the gmt website; then pygmt installed with the “conda install --channel conda-forge pygmt” statement.
    3. The error message says “ModuleNotFoundError: No module named 'pygmt'”, but checking the package will find that pygmt is already installed, and the error message is as shown.
      屏幕截图 2022-09-08 195505
  9. seisman commented on Sep 8, 2022

    @seisman
    Member

    Did you restart the kernel or Jupyter after installing pygmt? If not, you should try it.

  10. jason996cj commented on Sep 8, 2022

    @jason996cj
    Author

    Yes, I've restart them. I've restart and reinstalled many times.

  11. weiji14 commented on Sep 8, 2022

    @weiji14
    Member

    Try following https://forum.generic-mapping-tools.org/t/weird-jupyter-vs-command-prompt/1644/2. Specifically

    conda activate pygmt
    python -m ipykernel install --user --name pygmt  #to install conda env properly
    jupyter kernelspec list --json

    You'll then need to restart your Jupyter, open your notebook and select the 'pygmt' kernel. See e.g. https://forum.generic-mapping-tools.org/t/no-module-named-pygmt-vs-code/1231/9

  12. jason996cj commented on Sep 8, 2022

    @jason996cj
    Author

    It's solved, thanks so much!

    屏幕截图 2022-09-08 203132

  13. weiji14 commented on Sep 8, 2022

    @weiji14
    Member

    Cool, I'm starting to think these instructions should go into the installation page as we've seen this ModuleNotFoundError pop up 5 or more times already. Let's close this issue once we've added the documentation.

  14. added
    documentation
    help wanted
    on Sep 8, 2022
  15. seisman commented on Sep 8, 2022

    @seisman
    Member

    Cool, I'm starting to think these instructions should go into the installation page as we've seen this ModuleNotFoundError pop up 5 or more times already. Let's close this issue once we've added the documentation.

    I've never had any problems like this on Linux and macOS.

  16. weiji14 commented on Sep 8, 2022

    @weiji14
    Member

    Looking at the forum posts, it seems to be mostly Anaconda Windows users? Maybe something different in the setup. Still, the instructions also work for Linux/macOS so won't hurt I guess.

  17. jason996cj commented on Sep 8, 2022

    @jason996cj
    Author

    Cool, I'm starting to think these instructions should go into the installation page as we've seen this ModuleNotFoundError pop up 5 or more times already. Let's close this issue once we've added the documentation.

    I've never had any problems like this on Linux and macOS.

    I ran into the same problem on my m1 Macbook this past July, but I didn't try to ask anyone else about it at the time, and I thought it might be a problem with the installation rules for the new version of anaconda.

  18. jason996cj commented on Sep 8, 2022

    @jason996cj
    Author

    Looking at the forum posts, it seems to be mostly Anaconda Windows users? Maybe something different in the setup. Still, the instructions also work for Linux/macOS so won't hurt I guess.

    Tomorrow I'll try this method to solve the same problem on my Macbook, maybe the problem is in the anconda.

  19. jason996cj commented on Sep 8, 2022

    @jason996cj
    Author

    Cool, I'm starting to think these instructions should go into the installation page as we've seen this ModuleNotFoundError pop up 5 or more times already. Let's close this issue once we've added the documentation.

    I've never had any problems like this on Linux and macOS.

    I still decided to test it before going to bed so I brought the Mac back to my dorm room and it installed in one go with no errors.
    Professor Tian, I'm sorry for my misremembering, I solemnly apologize for that, I think it was something else that failed me in July.
    Probably the same as what @weiji14 said: (Maybe something different in the setup. Still, the instructions also work for Linux/macOS so won't hurt.).

    截屏2022-09-09 00 15 41

  20. added this to the 0.8.0 milestone on Sep 9, 2022
  21. removed
    question
    on Sep 9, 2022
  22. changed the title [-]pygmt ModuleNotFoundError.[/-] [+]import pygmt raises ModuleNotFoundError in Jupyter[/+] on Oct 9, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    documentationhelp wanted

    Type

    No type

    Projects

    No projects

      Milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions