Issue
I was trying to upgrade matplotlib with pip, only to encounter this error:
Collecting matplotlib
Downloading matplotlib-3.4.2-cp38-cp38-win_amd64.whl (7.1 MB)
|████████████████████████████████| 7.1 MB 3.2 MB/s
Requirement already satisfied, skipping upgrade: pyparsing>=2.2.1 in c:\users\mccom\anaconda3\lib\site-packages (from matplotlib) (2.4.7)
Requirement already satisfied, skipping upgrade: cycler>=0.10 in c:\users\mccom\anaconda3\lib\site-packages (from matplotlib) (0.10.0)
Requirement already satisfied, skipping upgrade: python-dateutil>=2.7 in c:\users\mccom\anaconda3\lib\site-packages (from matplotlib) (2.8.1)
Requirement already satisfied, skipping upgrade: kiwisolver>=1.0.1 in c:\users\mccom\anaconda3\lib\site-packages (from matplotlib) (1.3.0)
Requirement already satisfied, skipping upgrade: pillow>=6.2.0 in c:\users\mccom\anaconda3\lib\site-packages (from matplotlib) (8.0.1)
Requirement already satisfied, skipping upgrade: numpy>=1.16 in c:\users\mccom\anaconda3\lib\site-packages (from matplotlib) (1.19.2)
Requirement already satisfied, skipping upgrade: six in c:\users\mccom\anaconda3\lib\site-packages (from cycler>=0.10->matplotlib) (1.15.0)
Installing collected packages: matplotlib
Attempting uninstall: matplotlib
Found existing installation: matplotlib 3.3.2
Uninstalling matplotlib-3.3.2:
ERROR: Could not install packages due to an EnvironmentError: [WinError 5] Access is denied: 'c:\\users\\mccom\\anaconda3\\lib\\site-packages\\matplotlib\\backends\\_backend_agg.cp38-win_amd64.pyd'
Consider using the `--user` option or check the permissions.
So it uninstalled without upgrading. I went to reinstall: which went well (output for reference)
(base) C:\Users\mccom>pip install matplotlib
Collecting matplotlib
Using cached matplotlib-3.4.2-cp38-cp38-win_amd64.whl (7.1 MB)
Requirement already satisfied: pyparsing>=2.2.1 in c:\users\mccom\anaconda3\lib\site-packages (from matplotlib) (2.4.7)
Requirement already satisfied: cycler>=0.10 in c:\users\mccom\anaconda3\lib\site-packages (from matplotlib) (0.10.0)
Requirement already satisfied: kiwisolver>=1.0.1 in c:\users\mccom\anaconda3\lib\site-packages (from matplotlib) (1.3.0)
Requirement already satisfied: pillow>=6.2.0 in c:\users\mccom\anaconda3\lib\site-packages (from matplotlib) (8.0.1)
Requirement already satisfied: python-dateutil>=2.7 in c:\users\mccom\anaconda3\lib\site-packages (from matplotlib) (2.8.1)
Requirement already satisfied: numpy>=1.16 in c:\users\mccom\anaconda3\lib\site-packages (from matplotlib) (1.19.2)
Requirement already satisfied: six in c:\users\mccom\anaconda3\lib\site-packages (from cycler>=0.10->matplotlib) (1.15.0)
Installing collected packages: matplotlib
Successfully installed matplotlib-3.4.2
However when I try to load in Jupyter notebook I get:
---------------------------------------------------------------------------
AttributeError Traceback (most recent call last)
<ipython-input-7-0484cd13f94d> in <module>
----> 1 import matplotlib
~\Anaconda3\lib\site-packages\matplotlib\__init__.py in <module>
821 # triggering resolution of _auto_backend_sentinel.
822 rcParamsDefault = _rc_params_in_file(
--> 823 cbook._get_data_path("matplotlibrc"),
824 # Strip leading comment.
825 transform=lambda line: line[1:] if line.startswith("#") else line,
~\Anaconda3\lib\site-packages\matplotlib\cbook\__init__.py in _get_data_path(*args)
478 if opened:
479 with fh:
--> 480 yield fh
481 else:
482 yield fh
AttributeError: module 'matplotlib' has no attribute 'get_data_path'
Solution
I feel stupid.
I went ahead and uninstalled it and then did
pip install matplotlib --user
. Will keep this up if anyone else has trouble.
Answered By - Kbbm
0 comments:
Post a Comment
Note: Only a member of this blog may post a comment.