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

ε祈祈猫儿з 提交于 2021-01-27 07:33:16

问题


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?

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.


回答1:


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.




回答2:


use

pip install seaborn=0.11.0

that's how I solve the same problem like yours



来源:https://stackoverflow.com/questions/64487685/seaborn-attributeerror-module-seaborn-has-no-attribute-displot-and-conda-so

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!