'ModuleNotFoundError: No module named 'matplotlib.colors',

When I try to launch jupyter notebook, I get this from anaconda prompt enter image description here

after launching jupyter notebook, I get this on anaconda prompt before jupyter notebook opens in browser enter image description here

after running the following import code:

    import pandas as pd
    import numpy as np
    import seaborn as sn
    from sklearn import datasets
    from sklearn import metrics
    from sklearn import tree
    from sklearn.tree import DecisionTreeClassifier
    from sklearn.tree import DecisionTreeRegressor
    from sklearn.model_selection import train_test_split
    import matplotlib.pyplot as plt
    from sklearn.preprocessing import LabelEncoder
    from sklearn.tree import export_graphviz

i get the following error:

ModuleNotFoundError                       Traceback (most recent call last)
~\AppData\Local\Temp\ipykernel_6884\4230379327.py in <module>
      4 import pandas as pd
      5 import numpy as np
----> 6 import seaborn as sn
      7 from sklearn import datasets
      8 from sklearn import metrics

~\Anaconda3\lib\site-packages\seaborn\__init__.py in <module>
      1 # Import seaborn objects
----> 2 from .rcmod import *  # noqa: F401,F403
      3 from .utils import *  # noqa: F401,F403
      4 from .palettes import *  # noqa: F401,F403
      5 from .relational import *  # noqa: F401,F403

~\Anaconda3\lib\site-packages\seaborn\rcmod.py in <module>
      5 import matplotlib as mpl
      6 from cycler import cycler
----> 7 from . import palettes
      8 
      9 

~\Anaconda3\lib\site-packages\seaborn\palettes.py in <module>
      7 from .external import husl
      8 
----> 9 from .utils import desaturate, get_color_cycle
     10 from .colors import xkcd_rgb, crayons
     11 

~\Anaconda3\lib\site-packages\seaborn\utils.py in <module>
     11 import pandas as pd
     12 import matplotlib as mpl
---> 13 import matplotlib.colors as mplcol
     14 import matplotlib.pyplot as plt
     15 from matplotlib.cbook import normalize_kwargs

ModuleNotFoundError: No module named 'matplotlib.colors'

when i comment the line giving the above error #import seaborn as sn i get the following error:

ImportError                               Traceback (most recent call last)
~\AppData\Local\Temp\ipykernel_6884\1207372402.py in <module>
      8 from sklearn import metrics
      9 from sklearn import tree
---> 10 from sklearn.tree import DecisionTreeClassifier
     11 from sklearn.tree import DecisionTreeRegressor
     12 from sklearn.model_selection import train_test_split

ImportError: cannot import name 'DecisionTreeClassifier' from 'sklearn.tree' (unknown location)

when I run pip list, it shows that I have both seaborn 0.11.2 and scikitlearn 1.0.2 installed. what could be wrong and how do i fix this?



Solution 1:[1]

Depends on the country, Service Agreement, Business type and capabilities, onboarding a Stripe custom Connect account requires you (platform) to gather information from the users for verification purpose.

You can view the requirements on this page

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 qichuan