I use JetBrains DataSpell for Jupyter. I use conda interpreter (Python 3.10) and I have installed matplotlib, but when I run this code:
import matplotlib.pyplot as plt
I got this error:
ModuleNotFoundError: No module named 'matplotlib'
The strangest thing is that when I start writing "import matpl..." my kernel prompts me "matplotlib" and see class "pyplot" also. So my kernel sees this library while writing code...
I got installed matplotlib 3.5.2 version
installed package
Related
I just installed matplotlib onto my Windows computer using Pip and entering the following into the command prompt:
pip install matplotlib
Everything has been installed correctly from the looks of it, but after opening up VSCode, the following line gives me a problem still:
import matplotlib.pyplot as plt
Every time I try to run my program I get this printed to the console:
ModuleNotFoundError: No module named 'matplotlib'
Not sure what to do here as I thought I had matplotlib installed correctly.
I tried to use torch in spyder but I got error ModuleNotFoundError: No module named 'torch' so I tried use pip module not in cmd but in spyder itself following
import pip
pip.main(["install","torch"])
but got ModuleNotFoundError: No module named 'pip' and I know I had successfully used it in spyder before but recent automatic spyder updates probably have caused this error so I tried to install pip in my all python environments in cmd with cd {environment_path}but the pip was installed there. I also used python -m ensurepip in all environments but I still get ModuleNotFoundError: No module named 'pip'.
seems the problem is caused by reseting spyder(maybe there other causes) changing different python interpreters (environments) also is no help!! and installing or reinstalling with windows installer solved problem for me.
update: after restarting again many modules like 'pip', 'torch' and 'keyboard' are not recognized and reinstalling is no answer(no difference between installing for 'this user' or 'all users').
I installed matplotlib on Anaconda Prompt with conda install -c conda-forge matplotlib.
However, when I run import matplotlib.pyplot as plt on Spyder 4.1.5 (with Python 3.7), I got an error message:
ModuleNotFoundError: No module named 'matplotlib.pyplot'
Before getting this error message, I installed matplotlib_scalebar with conda install -c conda-forge matplotlib-scalebar. I had no issue importing matplotlib.pyplot before this, and I suspect that installing this might have caused the problem.
Under C:\ProgramData\Anaconda3\Lib\site-packages, I have folders with the following names:
matplotlib
matplotlib-3.0.2.dist-info
matplotlib-3.3.2.dist-info
I'm not sure if having different folders (3.0.2 and 3.3.2) is an issue here.
How can I fix this No module issue?
I wrote the following python line import scipy.io then I went to that folder's location in the cmd:
C:\Users\me\PycharmProjects\test>
and typed pip install scipy apparently it installed the dependencies then I went back to pycharm, ran my code and got error
ModuleNotFoundError: No module named 'scipy'
I'm just starting off with python I'm on windows 10.
PyCharm has a GUI for managing which python installation you use and packages installed:
https://www.jetbrains.com/help/pycharm/installing-uninstalling-and-upgrading-packages.html
I have installed ipython 3.0.0-b1 on Mac OS 10.7.5 (in /usr/local/bin/ipython2), and matplotlib, using pip.
If I use python (which runs version 2.7.3), import matplotlib works fine.
If I use ipython2, then import matplotlib complains:
ImportError: No module named matplotlib
How can I get ipython to find my installed packages? Thanks!