I am currently trying to work basic python - jupyter projects.
I am stuck on following error during matplotlib:
ModuleNotFoundError: No module named 'matplotlib'
I tried to update, reinstall matplotlib aswell in conda and in pip but it still not working.
happy over every constructive feedback
open terminal and change the directory to Scripts folder where python installed. Then type the following command and hit enter
pip install matplotlib
Hope this will solve the issue.
I was facing the exact issue. Turns out it was using the system Python version despite me having activated my virtual environment.
This is what eventually worked.
If you are using a virtual environment which has a name say myvenv, first activate it using command:
source activate myenv
Then install module ipykernel using the command:
pip install ipykernel
Finally run (change myenv in code below to the name of your environment):
ipykernel install --user --name myenv --display-name "Python (myenv)"
Now restart the notebook and it should pick up the Python version on your virtual environment.
Having the same issue, installing matplotlib before to create the virtualenv solved it for me. Then I created the virtual environment and installed matplotlib on it before to start jupyter notebook.
In a Notebook's cell type and execute the code:
import sys
!{sys.executable} -m pip install --user matplotlib
and reload the kernel
(src: http://jakevdp.github.io/blog/2017/12/05/installing-python-packages-from-jupyter/ )
The issue with me was that jupyter was taking python3 for me, you can always check the version of python jupyter is running on by looking on the top right corner (attached screenshot).
When I was doing pip install it was installing the dependencies for python 2.7 which is installed on mac by default. It got solved by doing:
> pip3 install matplotlib
Check the python version:
$python --version
or
$python3 --version
Try installing "matplotlib" using sudo:
For python version 2.7
$sudo pip install matplotlib
or
For python version 3.x
$sudo pip3 install matplotlib
来源:https://stackoverflow.com/questions/42321784/jupyter-modulenotfounderror-no-module-named-matplotlib

