Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Seaborn AttributeError: module 'seaborn' has no attribute 'displot' AND conda Solving environment fail

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.

like image 948
codingknob Avatar asked Oct 22 '20 17:10

codingknob


People also ask

Does module Seaborn have an attribute?

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)

Is it possible to use distplot () in Seaborn?

Bookmark this question. Show activity on this post. 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:

How to troubleshoot Seaborn not installed in Python?

This tutorial shares the exact steps you can use to troubleshoot this error. Since seaborn doesn’t come installed automatically with Python, you’ll need to install it yourself. The easiest way to do so is by using pip, which is a package manager for Python. In most cases, this will fix the error.

Is it possible to run Seaborn jointplot () on Mac?

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)


2 Answers

Try installing with pip:

pip install seaborn==0.11.0

like image 53
flyer2403 Avatar answered Oct 19 '22 15:10

flyer2403


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.

like image 3
Dean Power Avatar answered Oct 19 '22 16:10

Dean Power