I get the following error when I want to import matplotlib.pyplot on the Visual Studio's jupyter-notebook.
---------------------------------------------------------------------------
AttributeError Traceback (most recent call last)
in
----> 1 import matplotlib.pyplot as plt
~/miniconda3/envs/firstSteps/lib/python3.8/site-packages/matplotlib/__init__.py in
903 # triggering resolution of _auto_backend_sentinel.
904 rcParamsDefault = _rc_params_in_file(
--> 905 cbook._get_data_path("matplotlibrc"),
906 # Strip leading comment.
907 transform=lambda line: line[1:] if line.startswith("#") else line,
~/.local/lib/python3.8/site-packages/matplotlib/cbook/__init__.py in _get_data_path(*args)
AttributeError: module 'matplotlib' has no attribute 'get_data_path'
But I don't have this error if I try the same code on the navigator's jupyter-notebook. So I don't understand why I get this error since both notebook are running under the same kernel which have the matplotlib 3.3.1 version installed on.
I would be grateful if someone can give me any enlightenment. :)
I had the same problem because I was using the wrong python kernel. I had that problem when using the standard python kernel, but not when using a virtual env (which is what I usually use).
I had this same problem and solve it by using the following sequence \
conda
environment. so, activate the environment by conda activate env-name
python
command and check weather matplotib has installed by\import matplotlib
code .
command to open VScode in this directory.this won't happen in the pip
environment usually, because VScode does not activate two channels [pip, conda] or conda environment automatically most of the times.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With