While importing train_test_split from from sklearn.model_selection, why am I getting the error "AttributeError: module 'attr' has no attribute 's'"?

Question:

import numpy as np
import pandas as pd
import matplotlib.pyplot as plt 
import seaborn as sns
import sklearn
from sklearn.model_selection import train_test_split
import statsmodels.api as sm

While running this cell in Jupyter Notebook I am getting the following error:

C:Anacondalibsite-packages_pytest_code__init__.py in <module>
      1 """ python inspection/code generation API """
----> 2 from .code import Code  # noqa
      3 from .code import ExceptionInfo  # noqa
      4 from .code import filter_traceback  # noqa
      5 from .code import Frame  # noqa

C:Anacondalibsite-packages_pytest_codecode.py in <module>
    390 
    391 
--> 392 @attr.s(repr=False)
    393 class ExceptionInfo(Generic[_E]):
    394     """ wraps sys.exc_info() objects and offers

AttributeError: module 'attr' has no attribute 's'

Can somebody explain what is happening?

Asked By: ashish.g

||

Answers:

Enter these commands on the terminal or in a notebook:

pip uninstall attr
pip install attrs

uninstall the attr and reinstall attrs

pip uninstall attr
pip uninstall attrs
pip install attrs
Answered By: teng stone