1

Today(Mar 30, 2021) I upgraded matplotlib and seaborn package.

But, after that, I can't import matplotlib and seaborn package.

Whenever I tried importing matplotlib or seaborn, I got error messages like below.

How can I solve this problem?

(I used JupyterLab 3.0)

---------------------------------------------------------------------------
AttributeError                            Traceback (most recent call last)
<ipython-input-33-a0d2faabd9e9> in <module>
----> 1 import matplotlib.pyplot as plt

C:\dev\anaconda3\lib\site-packages\matplotlib\__init__.py in <module>
    819 # triggering resolution of _auto_backend_sentinel.
    820 rcParamsDefault = _rc_params_in_file(
--> 821     cbook._get_data_path("matplotlibrc"),
    822     # Strip leading comment.
    823     transform=lambda line: line[1:] if line.startswith("#") else line,

C:\dev\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'

1 Answer 1

1

These kinds of errors are typical for a version conflict, especially if you recently upgraded.

A common mistake is to just upgrade one package and expect that everything else will continue to work. Certain versions of libraries are only compatible with certain versions of other libraries and so on. Reality is that you have to find a working combination of all the libraries as a whole. From your example it is impossible to know what went wrong, but I would assume that you also have to upgrade the maptplotlib dependencies, and possibly their dependencies too.

If you are not closely familiar with those libraries, it can get tricky to chase this down, so you might be better off by simply reinstalling everything through pip or some other dependency-aware package manager.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.