Open mmrahn opened 5 years ago
Is there a reason that nobody responds to this issue? Am I the only one having it?
It's quite possible, I have not encountered this. Feel free to submit a fix, let me know if you need any help.
@mmrahn I can't reproduce with plotly 3.4.2 and 0.14.1, python3.7
I had this
I also had this, used the same hacky solution.
Cufflinks 0.14.6, plotly 3.7.0, python 3.6.6
I had this too but its quite random.
Have you solved it yet?
+1. Non-random. Consistently reproducible.
hello, thank you very much
I do it, but it does not work.
Do you konw why?
If you're still seeing this issue, please post the versions of Cufflinks and Plotly that you have installed :)
(and note that as of right now, the latest versions are Cufflinks==0.17 and Plotly==4.2.1 :)
thank you. My versions are Cufflinks==0.17 and Plotly==4.2.1 It still does not work.o(╥﹏╥)o
------------------ 原始邮件 ------------------ 发件人: "Nicolas Kruchten"<notifications@github.com>; 发送时间: 2019年11月3日(星期天) 凌晨2:27 收件人: "santosjorge/cufflinks"<cufflinks@noreply.github.com>; 抄送: "1016550222"<1016550222@qq.com>;"Comment"<comment@noreply.github.com>; 主题: Re: [santosjorge/cufflinks] iplot raises AttributeError: module 'plotly.offline' has no attribute '__PLOTLY_OFFLINE_INITIALIZED' (#151)
(and note that as of right now, the latest versions are Cufflinks==0.17 and Plotly==4.2.1 :)
— You are receiving this because you commented. Reply to this email directly, view it on GitHub, or unsubscribe.
Can you share some specific code that you're running that triggers this bug?
import pandas as pd import cufflinks as cf import numpy as np
cf.set_config_file(offline=True)
cf.datagen.lines(1,500).ta_plot(study='sma',periods=[13,21,55]) D:\Anaconda3\python.exe D:/pythonproject/untitled/1111.py Traceback (most recent call last): File "D:/pythonproject/untitled/1111.py", line 7, in <module> cf.datagen.lines(1,500).ta_plot(study='sma',periods=[13,21,55]) File "D:\Anaconda3\lib\site-packages\cufflinks\plotlytools.py", line 1656, in _ta_plot return iplot(figure,sharing=sharing,filename=filename) File "D:\Anaconda3\lib\site-packages\cufflinks\plotlytools.py", line 1460, in iplot if offline.is_offline() and not online: File "D:\Anaconda3\lib\site-packages\cufflinks\offline.py", line 38, in is_offline return py_offline.PLOTLY_OFFLINE_INITIALIZED AttributeError: module 'plotly.offline' has no attribute 'PLOTLY_OFFLINE_INITIALIZED' 进程已结束,退出代码 1
------------------ 原始邮件 ------------------ 发件人: "Nicolas Kruchten"<notifications@github.com>; 发送时间: 2019年11月3日(星期天) 上午9:57 收件人: "santosjorge/cufflinks"<cufflinks@noreply.github.com>; 抄送: "1016550222"<1016550222@qq.com>;"Comment"<comment@noreply.github.com>; 主题: Re: [santosjorge/cufflinks] iplot raises AttributeError: module 'plotly.offline' has no attribute '__PLOTLY_OFFLINE_INITIALIZED' (#151)
Can you share some specific code that you're running that triggers this bug?
— You are receiving this because you commented. Reply to this email directly, view it on GitHub, or unsubscribe.
Hmm, that's interesting. If you add cf.go_offline()
instead of cf.set_config_file(offline=True)
does this still happen?
In fact, it still does not work.o(╥﹏╥)o
------------------ 原始邮件 ------------------ 发件人: "Nicolas Kruchten"<notifications@github.com>; 发送时间: 2019年11月3日(星期天) 晚上10:59 收件人: "santosjorge/cufflinks"<cufflinks@noreply.github.com>; 抄送: "刘铭基"<1016550222@qq.com>;"Comment"<comment@noreply.github.com>; 主题: Re: [santosjorge/cufflinks] iplot raises AttributeError: module 'plotly.offline' has no attribute '__PLOTLY_OFFLINE_INITIALIZED' (#151)
Hmm, that's interesting. If you add cf.go_offline() instead of cf.set_config_file(offline=True) does this still happen?
— You are receiving this because you commented. Reply to this email directly, view it on GitHub, or unsubscribe.
You get the same error or a different one? "it does not work" isn't sufficient information for me to help you :)
yes, the same error import pandas as pd import cufflinks as cf import numpy as np cf.go_offline()
cf.datagen.lines(1,500).ta_plot(study='sma',periods=[13,21,55]) D:\Anaconda3\python.exe D:/pythonproject/untitled/1111.py Traceback (most recent call last): File "D:/pythonproject/untitled/1111.py", line 6, in <module> cf.datagen.lines(1,500).ta_plot(study='sma',periods=[13,21,55]) File "D:\Anaconda3\lib\site-packages\cufflinks\plotlytools.py", line 1656, in _ta_plot return iplot(figure,sharing=sharing,filename=filename) File "D:\Anaconda3\lib\site-packages\cufflinks\plotlytools.py", line 1460, in iplot if offline.is_offline() and not online: File "D:\Anaconda3\lib\site-packages\cufflinks\offline.py", line 38, in is_offline return py_offline.PLOTLY_OFFLINE_INITIALIZED AttributeError: module 'plotly.offline' has no attribute 'PLOTLY_OFFLINE_INITIALIZED' 进程已结束,退出代码 1
------------------ 原始邮件 ------------------ 发件人: "Nicolas Kruchten"<notifications@github.com>; 发送时间: 2019年11月3日(星期天) 晚上11:05 收件人: "santosjorge/cufflinks"<cufflinks@noreply.github.com>; 抄送: "刘铭基"<1016550222@qq.com>;"Comment"<comment@noreply.github.com>; 主题: Re: [santosjorge/cufflinks] iplot raises AttributeError: module 'plotly.offline' has no attribute '__PLOTLY_OFFLINE_INITIALIZED' (#151)
You get the same error or a different one? "it does not work" isn't sufficient information for me to help you :)
— You are receiving this because you commented. Reply to this email directly, view it on GitHub, or unsubscribe.
Hmm. I wonder if you don't have multiple versions of plotly
installed, one with conda
and one with pip
perhaps? Could you try uninstalling with both tools and reinstalling with just one?
Thank you very much!
I will have a try and apply to you.
------------------ 原始邮件 ------------------ 发件人: "Nicolas Kruchten"<notifications@github.com>; 发送时间: 2019年11月3日(星期天) 晚上11:10 收件人: "santosjorge/cufflinks"<cufflinks@noreply.github.com>; 抄送: "刘铭基"<1016550222@qq.com>;"Comment"<comment@noreply.github.com>; 主题: Re: [santosjorge/cufflinks] iplot raises AttributeError: module 'plotly.offline' has no attribute '__PLOTLY_OFFLINE_INITIALIZED' (#151)
Hmm. I wonder if you don't have multiple versions of plotly installed, one with conda and one with pip perhaps? Could you try uninstalling with both tools and reinstalling with just one?
— You are receiving this because you commented. Reply to this email directly, view it on GitHub, or unsubscribe.
if you run with ipython, the error will gone. i mean run script in comand "ipython script.py"
Thank you! But, it still does not work. o(╥﹏╥)o
------------------ 原始邮件 ------------------ 发件人: "gaizoule"<notifications@github.com>; 发送时间: 2019年11月18日(星期一) 下午2:54 收件人: "santosjorge/cufflinks"<cufflinks@noreply.github.com>; 抄送: "刘铭基"<1016550222@qq.com>; "Comment"<comment@noreply.github.com>; 主题: Re: [santosjorge/cufflinks] iplot raises AttributeError: module 'plotly.offline' has no attribute '__PLOTLY_OFFLINE_INITIALIZED' (#151)
if you run with ipython, the error will gone. i mean run script in comand "ipython script.py"
— You are receiving this because you commented. Reply to this email directly, view it on GitHub, or unsubscribe.
I also get the same problem as @DesmondLMJ
Still the same problem with:
cufflinks 0.17.3 Productivity Tools for Plotly + Pandas
plotly 4.6.0 An open-source, interactive graphing library for Python
You can get away with it by hacking the missing attribute in:
setattr(plotly.offline, "__PLOTLY_OFFLINE_INITIALIZED", True)
I did it at module scope after the cufflinks
and plotly
imports.
Thank you very much!
发自我的iPhone
------------------ Original ------------------ From: Damien Levac <notifications@github.com> Date: Thu,Apr 9,2020 11:30 PM To: santosjorge/cufflinks <cufflinks@noreply.github.com> Cc: DesmondLiu <1016550222@qq.com>, Mention <mention@noreply.github.com> Subject: Re: [santosjorge/cufflinks] iplot raises AttributeError: module 'plotly.offline' has no attribute '__PLOTLY_OFFLINE_INITIALIZED' (#151)
Still the same problem with:
cufflinks 0.17.3 Productivity Tools for Plotly + Pandas plotly 4.6.0 An open-source, interactive graphing library for Python
You can get away with it by hacking the missing attribute in:
setattr(plotly.offline, "__PLOTLY_OFFLINE_INITIALIZED", True)
I did it at module scope after the cufflinks and plotly imports.
— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub, or unsubscribe.
Eventually, I gave up using cufflinks on the PyCharm.
All is well on the Jupter notebook.
I decided to write the code on PyCharm and look at the diagram on the Jupter notebook.
Thank you all for your help and efforts!
Eventually, I gave up using cufflinks on the PyCharm.
All is well on the Jupter notebook.
I decided to write the code on PyCharm and look at the diagram on the Jupter notebook.
Thank you all for your help and efforts!
![]()
I'm having the same issue on Visual Studio Code 1.44.2
I feel sorry about that.
发自我的iPhone
------------------ Original ------------------ From: Orlando <notifications@github.com> Date: Thu,May 7,2020 4:41 AM To: santosjorge/cufflinks <cufflinks@noreply.github.com> Cc: DesmondLiu <1016550222@qq.com>, Mention <mention@noreply.github.com> Subject: Re: [santosjorge/cufflinks] iplot raises AttributeError: module 'plotly.offline' has no attribute '__PLOTLY_OFFLINE_INITIALIZED' (#151)
Still the same problem with:
cufflinks 0.17.3 Productivity Tools for Plotly + Pandas
plotly 4.6.0 An open-source, interactive graphing library for Python
You can get away with it by hacking the missing attribute in:
setattr(plotly.offline, "__PLOTLY_OFFLINE_INITIALIZED", True)
I did it at module scope after the
cufflinks
andplotly
imports.
Thanks, this workaround worked for me, using VS code.
>>> plotly.__version__
'4.9.0'
>>> cf.__version__
'0.17.3'
Without the line above, both running cf.set_config_file(offline=True)
& cf.go_offline()
gave me AttributeError: module 'plotly.offline' has no attribute '__PLOTLY_OFFLINE_INITIALIZED'
Complete code as follows
import pandas as pd
import cufflinks as cf
import numpy as np
import plotly
# setattr(plotly.offline, "__PLOTLY_OFFLINE_INITIALIZED", True)
cf.set_config_file(offline=True)
# cf.go_offline()
cf.datagen.lines(1, 500).ta_plot(study="sma", periods=[13, 21, 55])
I've also run into this issue now:
$ python --version
Python 3.9.0
$ pip list pandas
Package Version
------------------- -------
...
cufflinks 0.17.3
ipython 7.19.0
ipython-genutils 0.2.0
ipywidgets 7.6.3
numpy 1.19.4
pandas 1.1.5
plotly 4.14.1
...
import pandas as pd
import psycopg2
from plotly.subplots import make_subplots
from plotly import graph_objects as go
from plotly import express as px
import cufflinks as cf
cf.set_config_file(offline=True, sharing='public')
pd.set_option("display.max_rows", None)
pd.set_option("display.max_columns", None)
pd.set_option("display.width", None)
pd.set_option("display.max_colwidth", None)
# ...
Error:
Traceback (most recent call last):
File "/Users/jcope/Workspace/github.com/redhat-et/caliper/python/plotter/main.py", line 44, in <module>
df_mem.iplot()
File "/Users/jcope/Workspace/github.com/redhat-et/caliper/venv/lib/python3.9/site-packages/cufflinks/plotlytools.py", line 1216, in _iplot
return iplot(figure,validate=validate,sharing=sharing,filename=filename,
File "/Users/jcope/Workspace/github.com/redhat-et/caliper/venv/lib/python3.9/site-packages/cufflinks/plotlytools.py", line 1429, in iplot
if not offline.is_offline() or online:
File "/Users/jcope/Workspace/github.com/redhat-et/caliper/venv/lib/python3.9/site-packages/cufflinks/offline.py", line 38, in is_offline
return py_offline.__PLOTLY_OFFLINE_INITIALIZED
AttributeError: module 'plotly.offline' has no attribute '__PLOTLY_OFFLINE_INITIALIZED'
Getting same error AttributeError: module 'plotly.offline' has no attribute '__PLOTLY_OFFLINE_INITIALIZED'
Hi, Hit this first time going through the tutorial today.
(cufflinks-venv) root@smet52eldom9:/export/cufflinks# python
Python 3.7.9 (default, Oct 6 2020, 03:10:59)
[GCC 9.3.0] on sunos5
Type "help", "copyright", "credits" or "license" for more information.
>>>
>>> import cufflinks as cf
>>> import numpy as np
>>> import pandas as pd
>>> cf.set_config_file(world_readable=True,theme='pearl')
>>> df=pd.DataFrame(np.random.randn(100,5),index=pd.date_range('1/1/15',periods=100),
... columns=['IBM','MSFT','GOOG','VERZ','APPL'])
>>> df=df.cumsum()
>>> df.iplot(filename='Tutorial 1')
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/export/cufflinks/cufflinks-venv/lib/python3.7/site-packages/cufflinks/plotlytools.py", line 1218, in _iplot
dimensions=dimensions,display_image=kwargs.get('display_image',True))
File "/export/cufflinks/cufflinks-venv/lib/python3.7/site-packages/cufflinks/plotlytools.py", line 1429, in iplot
if not offline.is_offline() or online:
File "/export/cufflinks/cufflinks-venv/lib/python3.7/site-packages/cufflinks/offline.py", line 40, in is_offline
return py_offline.__PLOTLY_OFFLINE_INITIALIZED
AttributeError: module 'plotly.offline' has no attribute '__PLOTLY_OFFLINE_INITIALIZED'
>>> import plotly
>>> plotly.__version__
'4.14.3'
>>> cf.__version__
'0.17.3'
>>>
I'm not familiar with cufflinks or the intention of ofline mode but the indentation in go_offline() looks wrong to me. We only set py_offline.PLOTLY_OFFLINE_INITIALIZED if we are ran from ipython. It seems like we should do this regardless so I've taken a different approach in fixing this and changed the indentation so go_offline() will always set py_offline.PLOTLY_OFFLINE_INITIALIZED to True:
index 54c57bc..7ffd727 100644
--- a/cufflinks/offline.py
+++ b/cufflinks/offline.py
@@ -29,7 +29,7 @@ def go_offline(connected=None):
except TypeError:
#For older versions of plotly
py_offline.init_notebook_mode()
- py_offline.__PLOTLY_OFFLINE_INITIALIZED=True
+ py_offline.__PLOTLY_OFFLINE_INITIALIZED=True
def go_online():
py_offline.__PLOTLY_OFFLINE_INITIALIZED=False
If that seems reasonable I'll do the pull request.
AttributeError: module 'plotly.offline' has no attribute '__PLOTLY_OFFLINE_INITIALIZED' Same in PyCharm and there's no solution for the moment... I have a look at many forums everywhere but nobody knows how to solve it, yet
Hi, Hit this first time going through the tutorial today.
(cufflinks-venv) root@smet52eldom9:/export/cufflinks# python Python 3.7.9 (default, Oct 6 2020, 03:10:59) [GCC 9.3.0] on sunos5 Type "help", "copyright", "credits" or "license" for more information. >>> >>> import cufflinks as cf >>> import numpy as np >>> import pandas as pd >>> cf.set_config_file(world_readable=True,theme='pearl') >>> df=pd.DataFrame(np.random.randn(100,5),index=pd.date_range('1/1/15',periods=100), ... columns=['IBM','MSFT','GOOG','VERZ','APPL']) >>> df=df.cumsum() >>> df.iplot(filename='Tutorial 1') Traceback (most recent call last): File "<stdin>", line 1, in <module> File "/export/cufflinks/cufflinks-venv/lib/python3.7/site-packages/cufflinks/plotlytools.py", line 1218, in _iplot dimensions=dimensions,display_image=kwargs.get('display_image',True)) File "/export/cufflinks/cufflinks-venv/lib/python3.7/site-packages/cufflinks/plotlytools.py", line 1429, in iplot if not offline.is_offline() or online: File "/export/cufflinks/cufflinks-venv/lib/python3.7/site-packages/cufflinks/offline.py", line 40, in is_offline return py_offline.__PLOTLY_OFFLINE_INITIALIZED AttributeError: module 'plotly.offline' has no attribute '__PLOTLY_OFFLINE_INITIALIZED' >>> import plotly >>> plotly.__version__ '4.14.3' >>> cf.__version__ '0.17.3' >>>
I'm not familiar with cufflinks or the intention of ofline mode but the indentation in go_offline() looks wrong to me. We only set py_offline.PLOTLY_OFFLINE_INITIALIZED if we are ran from ipython. It seems like we should do this regardless so I've taken a different approach in fixing this and changed the indentation so go_offline() will always set py_offline.PLOTLY_OFFLINE_INITIALIZED to True:
index 54c57bc..7ffd727 100644 --- a/cufflinks/offline.py +++ b/cufflinks/offline.py @@ -29,7 +29,7 @@ def go_offline(connected=None): except TypeError: #For older versions of plotly py_offline.init_notebook_mode() - py_offline.__PLOTLY_OFFLINE_INITIALIZED=True + py_offline.__PLOTLY_OFFLINE_INITIALIZED=True def go_online(): py_offline.__PLOTLY_OFFLINE_INITIALIZED=False
If that seems reasonable I'll do the pull request.
Yes this fixed the said problem for me. The newest cufflinks still has this error in it.
I think you should do a pull request, this worked for me, and it seems to be what the code was supposed to do to begin with.
Try it: from plotly.offline import download_plotlyjs,init_notebook_mode,plot,iplot init_notebook_mode(connected=True) cf.go_offline()
Minimal code example:
This raises
AttributeError: module 'plotly.offline' has no attribute '__PLOTLY_OFFLINE_INITIALIZED'
. Using cufflinks 0.14.5 and plotly 3.3.0 (on Windows 10).Can be solved (in a hacky way) by changing
plotly.offline.__init__
to