I am facing this issue in seaborn import:

Viewed 8181

When I try running following line in Jupiter notebook

> import seaborn as sns     

I get this error:

---------------------------------------------------------------------------
ImportError                               Traceback (most recent call last)
<ipython-input-2-ed9806ce3570> in <module>()
----> 1 import seaborn as sns

~/anaconda3/lib/python3.6/site-packages/seaborn/__init__.py in <module>()
      8 from .palettes import *
      9 from .regression import *
---> 10 from .categorical import *
     11 from .distributions import *
     12 from .timeseries import *

~/anaconda3/lib/python3.6/site-packages/seaborn/categorical.py in <module>()
      5 from scipy import stats
      6 import pandas as pd
----> 7 from pandas.core.series import remove_na
      8 import matplotlib as mpl
      9 from matplotlib.collections import PatchCollection

ImportError: cannot import name 'remove_na'

dependency versions are listed below:

Python 3.6.3

conda 4.8.2

numpy 1.18.0

pandas 1.0.1

scipy 1.1.0

matplotlib 3.1.3

What is the issue here?

2 Answers

Okay,

so I still dont know, what was wrong in this, but I did solve the problem.

I simply uninstalled seaborn

pip3 uninstall seaborn

and installed it again

pip3 install seaborn

it worked, no error this time.

But I still dont know, what went wrong first time.

If someone can help please share.

The problem is that seaborn seems to be using a private method from pandas. The issue has been reported to both pandas and seaborn developers (see https://github.com/pandas-dev/pandas/issues/16971 and https://github.com/mwaskom/seaborn/pull/1241) which both published a fix in later versions.

The fixed version is available on pip but not on Ubuntu's packages yet (as of August 2020). However, for those who don't want pip install, the fix is straightforward and can be manually applied (see the pull request above).

Related