Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
555 views
in Technique[技术] by (71.8m points)

python - 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.

question from:https://stackoverflow.com/questions/65849194/why-i-got-an-error-in-displot-function-in-python

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

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.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...