I'm Unable to load matplotlib in Jupyter Notebook but woking fine in python command line shell,
Is there anything I need to configure to make it working?
Following is the error I'm getting in Jupyter Notebook
---------------------------------------------------------------------------
ImportError Traceback (most recent call last)
<ipython-input-1-99ba79ecbbfb> in <module>()
----> 1 from matplotlib import pyplot as plt
ImportError: No module named matplotlib
And in command line I can access it like the following:
Python 3.7.3 (default, Mar 27 2019, 23:47:09)
[Clang 10.0.0 (clang-10001044.4)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> from matplotlib import pyplot as plt
>>>
3 Answers 3
Seems like it's working now I ran the following command as specified here
python3 -m pip install ipykernel
python3 -m ipykernel install --user
Thanks.
Comments
One way is to check if you installed matplotlib
using pip3 (if you used pip3 to install jupyter notebook
, which looks like is your case).
Another way is to add the path of site-wide packages (where of course matplotlib is installed). In your Jupyter notebook console:
import sys
PATH = '/usr/lib64/python3.7/site-packages/'
sys.path.append(PATH)
5 Comments
The version of the notebook server is: 5.7.8 The server is running on this version of Python: Python 2.7.16 (default, Mar 4 2019, 09:01:38) [GCC 4.2.1 Compatible Apple LLVM 10.0.0 (clang-10001145.5)]
, How I can make it working as python3. I created the new book as python3 but still it's executing as python2.7jupyter kernelspec list
Available kernels: python2 /usr/local/share/jupyter/kernels/python2 python3 /usr/local/share/jupyter/kernels/python3
python3 -m pip install --upgrade pip
&& python3 -m pip install jupyter
- including ipython - pip3 install --upgrade pip jupyter ipython
Notebook is launched from another virtual python environment.
You can check paths to python interpreters, that run your notebook and interactive shell:
import sys
print(sys.executable)
I'm sure, they will be different.
1 Comment
/usr/local/opt/python@2/bin/python2.7
but I created this book as python3 also I tried to change it to python3 from the kernel
menu. How i can make it working as python3
https://jupyter.org/install
pip3 install jupyterlab
andpip3 install jupyter