Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

import pygmt raises ModuleNotFoundError in Jupyter #2113

Closed
jason996cj opened this issue Sep 8, 2022 · 13 comments · Fixed by #2153
Closed

import pygmt raises ModuleNotFoundError in Jupyter #2113

jason996cj opened this issue Sep 8, 2022 · 13 comments · Fixed by #2153
Labels
documentation Improvements or additions to documentation help wanted Helping hands are appreciated
Milestone

Comments

@jason996cj
Copy link

jason996cj commented Sep 8, 2022

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 !

@jason996cj jason996cj added the bug Something isn't working label Sep 8, 2022
@welcome
Copy link

welcome bot commented Sep 8, 2022

👋 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.

@seisman seisman added the question Further information is requested label Sep 8, 2022
@seisman seisman added this to the 0.8.0 milestone Sep 8, 2022
@seisman seisman removed the bug Something isn't working label Sep 8, 2022
@seisman seisman removed this from the 0.8.0 milestone Sep 8, 2022
@seisman
Copy link
Member

seisman commented Sep 8, 2022

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"

@jason996cj
Copy link
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

@seisman
Copy link
Member

seisman commented Sep 8, 2022

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

@jason996cj
Copy link
Author

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

@weiji14
Copy link
Member

weiji14 commented Sep 8, 2022

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

@jason996cj
Copy link
Author

It's solved, thanks so much!

屏幕截图 2022-09-08 203132

@weiji14
Copy link
Member

weiji14 commented Sep 8, 2022

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.

@weiji14 weiji14 added documentation Improvements or additions to documentation help wanted Helping hands are appreciated labels Sep 8, 2022
@seisman
Copy link
Member

seisman commented Sep 8, 2022

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.

@weiji14
Copy link
Member

weiji14 commented Sep 8, 2022

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.

@jason996cj
Copy link
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.

@jason996cj
Copy link
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.

@jason996cj
Copy link
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

@seisman seisman added this to the 0.8.0 milestone Sep 9, 2022
@seisman seisman removed the question Further information is requested label Sep 9, 2022
@seisman seisman changed the title pygmt ModuleNotFoundError. import pygmt raises ModuleNotFoundError in Jupyter Oct 9, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
documentation Improvements or additions to documentation help wanted Helping hands are appreciated
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants