简体   繁体   中英

AttributeError: module 'dask.array' has no attribute 'lib'

I'm getting the following error when trying to use Plotly in my Jupyter notebook. I'm using Anaconda Navigator to launch my Jupyter Notebook.

AttributeError: module 'dask.array' has no attribute 'lib'

I tried to install dask via the below commands but that didn't resolve the issue.

pip install dask[complete]

pip install "dask[delayed]"

I want to plot some figures using Plotly. This is the code snippet that I want to execute.

import plotly.express as px

# Get histogram of a variable against the target variable
def get_histogram(dataset, variable, target_variable):
   fig = px.histogram(data_frame = dataset, 
                 x = variable, 
                 color = target_variable, 
                 marginal = "box",
                 barmode = "overlay",
                 histnorm = 'density'
                 )  

   fig.update_layout(title_font_color="black",
                legend_title_font_color="green",
                title={
                  'text': variable + " Histogram per " + target_variable,
                  'x':0.5,
                  'xanchor': 'center',
                  'yanchor': 'top'},
                )

   fig.show()

Great if someone could help me to resolve this issue

I recently started getting the same error. What worked for me is downgrading to the previous version of the xarray library. I see the xarray developers recently released a new version.

Downgrading is not a long-term solution, of course, but hopefully they'll find and fix the bug soon. This line will uninstall your current version of xarray (which is probably version 2022.6.0, the most recent one) and replace it with the previous version.

pip install --upgrade xarray==2022.3.0

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM