Seaborn AttributeError: module 'seaborn' has no attribute 'displot' AND conda Solving environment fail
Solution 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.
Solution 2
Try installing with pip:
pip install seaborn==0.11.0
codingknob
Updated on June 30, 2021Comments
-
codingknob almost 3 years
As per seaborn documentation here
seaborn.distplot()
has been deprecated with the forward going supported plots being:seaborn.displot()
andseaborn.histplot()
.However, when I try to use either of
displot()
orhistplot()
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 usingconda 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.-
Equinox over 3 yearsYou have 0.10 latest is 0.11.
conda update seaborn --yes
-
codingknob over 3 yearsI tried yet still having problems. See updated post for details please.
-
codingknob over 3 yearsSeems there is a problem with
conda
. -
Grayrigel over 3 yearsI am a bit confused. what plot are you trying to make?
Distplot
obvious need a column name. Also,displot
andhistplot
are introduced in 0.11.0, so you can't use them0.10.0
.distplot
should work fine if you continue to use0.10.0
. See this answer if you want help plotting a distplot. -
codingknob over 3 yearsI was trying to use
displot
andhistplot
but @venky__ pointed out that I needed0.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 intoconda
problems trying to install a specific package. I just now got it to work by doing aconda 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 over 3 yearsSee updated post. I am trying to install v0.11.0 but having problems.
-
pnv about 2 yearsSeaborn gets installed, however the above issue still persists.