21

As per seaborn documentation here seaborn.distplot() has been deprecated with the forward going supported plots being: seaborn.displot() and seaborn.histplot().

However, when I try to use either of displot() or histplot() I get the following Attribute error:

AttributeError: module 'seaborn' has no attribute 'displot'

Note I can succesfully run seaborn.jointplot() and various others.

I found this SO post Module Seaborn has no attribute '' but that doesn't seem to be the solution to my issue.

I have seaborn version 0.10.1 installed on my MacOS version 10.15.5 (19F101)

I had seaborn 0.9.0 earlier today and was having the same problem so I deleted my Anaconda distribution using the App Cleaner & Uninstaller app and re-installed. Now I have seaborn version 0.10.1.

Shouldn't a fresh install of Anaconda take care of all dependencies and requirements?

See below screenshot of Attribute error. Any ideas what is going on?

Attribute Error

UPDATE:

It seems the above plots are only recently available starting in seaborn 0.11.0. So I am trying to install the new seaborn via: conda install seaborn==0.11.0 but it seems something is wrong with conda and or the channels. It tries to solve the environment but its in a never ending loop. I kill the process and try again and same thing.

(base)MacBook-Air:$ conda install seaborn==0.11.0
Collecting package metadata (current_repodata.json): done
Solving environment: failed with initial frozen solve. Retrying with flexible solve.
Solving environment: / 

Note: conda update seaborn --yes complained with the following (below) so I am installing a specific version using conda install seaborn==0.11.0 but as explained above that never returns from the death loop.

Updating seaborn is constricted by 

anaconda -> requires seaborn==0.10.1=py_0
If you are sure you want an update of your package either try `conda update --all` or install a specific version of the package you want using `conda install <pkg>=<version>`

## Package Plan ##

  environment location: /Users/User1/opt/anaconda3

  added / updated specs:
    - seaborn


The following packages will be downloaded:

    package                    |            build
    ---------------------------|-----------------
    conda-4.9.0                |           py38_0         2.9 MB
    conda-package-handling-1.7.2|   py38h22f3db7_0         1.5 MB
    ------------------------------------------------------------
                                           Total:         4.4 MB

The following packages will be UPDATED:

  conda                                        4.8.3-py38_0 --> 4.9.0-py38_0
  conda-package-han~                   1.6.1-py38h1de35cc_0 --> 1.7.2-py38h22f3db7_0



Downloading and Extracting Packages
conda-package-handli | 1.5 MB    | ###################################################################################################################################################################### | 100% 
conda-4.9.0          | 2.9 MB    | ###################################################################################################################################################################### | 100% 
Preparing transaction: done
Verifying transaction: done
Executing transaction: done

UPDATE2:

I was able to install seaborn 0.11.0 only by using conda update --all. Trying to install the individual package resulted in a Solving environment forever loop. No idea why that is.

codingknob
  • 11,108
  • 25
  • 89
  • 126
  • 1
    You have 0.10 latest is 0.11. `conda update seaborn --yes` – Equinox Oct 22 '20 at 17:52
  • I tried yet still having problems. See updated post for details please. – codingknob Oct 22 '20 at 18:16
  • Seems there is a problem with ```conda```. – codingknob Oct 22 '20 at 18:52
  • I am a bit confused. what plot are you trying to make? `Distplot` obvious need a column name. Also, `displot` and `histplot` are introduced in 0.11.0, so you can't use them `0.10.0`. `distplot` should work fine if you continue to use `0.10.0`. See [this](https://stackoverflow.com/questions/64467644/add-density-curve-on-the-histogram/64470007#64470007) answer if you want help plotting a distplot. – Grayrigel Oct 22 '20 at 18:58
  • I was trying to use ```displot``` and ```histplot``` but @venky__ pointed out that I needed ```0.11.0```. So now I have been trying to install that version of Seaborn but now as you see in my updated section of the post am running into ```conda``` problems trying to install a specific package. I just now got it to work by doing a ```conda update ---all```. Otherwise trying to install a specific package was not working. ```Conda``` is too flakey. I get many mysterious problems like this all the time. – codingknob Oct 22 '20 at 19:10

3 Answers3

3

displot() has been introduced in Seaborn v0.11.0, see the changelog: https://seaborn.pydata.org/whatsnew.htmlhttps://seaborn.pydata.org/whatsnew.htmlhttps://seaborn.pydata.org/whatsnew.html

From your code, you are importing v0.10.1.

deanpwr
  • 191
  • 9
3

Try installing with pip:

pip install seaborn==0.11.0

flyer2403
  • 961
  • 7
  • 7
1

Just run the following code inside of a Jupyter notebook

%pip install seaborn==0.11.0
uguros
  • 356
  • 2
  • 6
  • 19