0

I'm learning python3 (--version 3.7.3) and I'm using Anaconda 3 (conda --version 4.8.2) on a Windows 10 computer, writing with Sublime Text 3.2.2.

If I can use matplotlib from the command line, and other files with the same import statement worked fine, why would I suddenly keep getting error messages when I try to build my .py file where the first line is

import matplotlib.pyplot as plt

or

from matplotlib import pyplot

My error message is

ModuleNotFoundError: No module named 'matplotlib'

Meanwhile, the same program done interactively while in the SAME directory, no problema. And to make it even weirder, other files in the same folder with the same import statement, worked fine. Now, however, they are giving me the error message.

I've renamed the folder I was saving my files in and renamed or moved files around a bit, but that's pretty much the only change. Would I have to reinstall every time I move a file or rename a folder? Could it be a problem with Sublime, since the command line is working?

Please explain like I'm 5 and in remedial kindergarten.

AMC
  • 2,642
  • 7
  • 13
  • 35
punstress
  • 1,177
  • 2
  • 14
  • 26
  • 1
    Make sure you use the same Python version on the command line and in sublime. – DYZ Mar 07 '20 at 05:19
  • How do I check that? Remember, I'm 5. – punstress Mar 07 '20 at 09:56
  • 1
    Is the file you're trying to run named `matplotlib.py`? – MattDMo Mar 07 '20 at 13:27
  • The file I'm trying to run has had several names but never exactly that. One is matplotlib_trials.py but the others are things like world_population.py, But that is a good question. – punstress Mar 07 '20 at 20:29
  • This sort of problem generally arises when the command that's used at the command line when you're testing and the one that Sublime executes as part of the `sublime-build` file represent different versions of Python, which makes things work in one place and not another. – OdatNurd Mar 07 '20 at 21:10
  • I see, but remember I'm only 5 and I don't know how to correct that. – punstress Mar 08 '20 at 00:41
  • 1
    Does this answer your question? [use conda environment in sublime text 3](https://stackoverflow.com/questions/34865717/use-conda-environment-in-sublime-text-3) – AMC Mar 10 '20 at 23:00

1 Answers1

0

i'm having the same issue with anacodna distribution when trying to use SUblimetext 3. Simple file tst.py 1 code line import matplotlib.pyplot as plt received an error message (C:\Local\Anaconda3\lib\site-packages\numpy_init_.py:138: UserWarning: mkl-service package failed to import, therefore Intel(R) MKL .....) But when using the same tst.py with Spider or JUpeter it works.

Youya
  • 1