facultyai / facultyai/lens

Compatibility issue with new version of plotly?

未关闭
#44 3 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看
主要语言
Python
星标
99
派生
8
PR 合并指标
30 天内没有已合并 PR

描述

Hi guys, getting the following error with the explorer module:

```
AttributeError Traceback (most recent call last)
in
----> 1 explorer.correlation_plot()

~/machine_learning/.env/lib/python3.7/site-packages/lens/explorer.py in correlation_plot(self, include, exclude)
311 """
312 fig = plot_correlation(self.summary, include, exclude)
--> 313 self.plot_renderer(fig)
314
315 def correlation(self, include=None, exclude=None):

~/machine_learning/.env/lib/python3.7/site-packages/lens/explorer.py in _render(fig, showlegend)
44 raise ValueError(message)
45 else:
---> 46 if not py.offline.__PLOTLY_OFFLINE_INITIALIZED:
47 py.init_notebook_mode()
48 return py.iplot(fig, **PLOTLY_KWS)

AttributeError: module 'plotly.offline.offline' has no attribute '__PLOTLY_OFFLINE_INITIALIZED'

```

I'm working in a python virtulaenv with the following setup

```
CPython 3.7.3

numpy 1.17.2
pandas 0.25.1
matplotlib 3.1.1
plotly 4.1.1
lens 0.4.5

system : Linux
release : 5.0.0-31-generic
machine : x86_64
interpreter: 64bit
```

I believe the issue to be come from recent updates in the plotly library with the integration of plotly_express js initilization in the python package.

Quickfix that worked was simply removing the if statement in line 46 of explorer.py
```
45 else:
46 if not py.offline.__PLOTLY_OFFLINE_INITIALIZED: # remove
47 py.init_notebook_mode() # unindent
48 return py.iplot(fig, **PLOTLY_KWS)
```

Might be worth a pull request?

贡献指南

这个仓库没有索引到贡献指南

评估

这个 Issue 还没有评估数据。

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。