facultyai / facultyai/lens

Compatibility issue with new version of plotly?

Open
#44 3 comments 0 reactions 0 assignees View on GitHub
Dominant language
Python
Stars
99
Forks
8
PR merge metrics
No merged PRs in 30d

Description

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?

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.