I am trying to use Cufflinks within a notebook in JetBrains PyCharm.
An example how to IDE looks like:
I am getting this error:
---------------------------------------------------------------------------
PlotlyRequestError Traceback (most recent call last)
/var/folders/wg/6tjsdnt511s90hqpxtxgkndc0000gn/T/ipykernel_13855/446965294.py in <module>
7 qf.add_bollinger_bands()
8 qf.add_volume()
----> 9 qf.iplot()
10
11 print("All done")
~/Library/Caches/pypoetry/virtualenvs/capitalgram--bm4msE3-py3.8/lib/python3.8/site-packages/cufflinks/quant_figure.py in iplot(self, **kwargs)
1268 return go.Figure(fig)
1269 else:
-> 1270 return pt_iplot(fig, **export_kwargs)
1271
1272 def __getitem__(self,key):
~/Library/Caches/pypoetry/virtualenvs/capitalgram--bm4msE3-py3.8/lib/python3.8/site-packages/cufflinks/plotlytools.py in iplot(figure, validate, sharing, filename, online, asImage, asUrl, asPlot, dimensions, display_image, **kwargs)
1468 return offline.py_offline.iplot(figure, validate=validate, filename=filename, show_link=show_link, link_text=link_text, config=config)
1469 else:
-> 1470 return py.iplot(figure,validate=validate,sharing=sharing,
1471 filename=filename)
1472
~/Library/Caches/pypoetry/virtualenvs/capitalgram--bm4msE3-py3.8/lib/python3.8/site-packages/chart_studio/plotly/plotly.py in iplot(figure_or_data, **plot_options)
133 if "auto_open" not in plot_options:
134 plot_options["auto_open"] = False
--> 135 url = plot(figure_or_data, **plot_options)
136
137 if isinstance(figure_or_data, dict):
~/Library/Caches/pypoetry/virtualenvs/capitalgram--bm4msE3-py3.8/lib/python3.8/site-packages/chart_studio/plotly/plotly.py in plot(figure_or_data, validate, **plot_options)
274 grid_filename = filename + "_grid"
275
--> 276 grid_ops.upload(
277 grid=grid,
278 filename=grid_filename,
~/Library/Caches/pypoetry/virtualenvs/capitalgram--bm4msE3-py3.8/lib/python3.8/site-packages/chart_studio/plotly/plotly.py in upload(cls, grid, filename, world_readable, auto_open, meta)
1085 payload["parent_path"] = parent_path
1086
-> 1087 file_info = _create_or_overwrite_grid(payload)
1088
1089 cols = file_info["cols"]
~/Library/Caches/pypoetry/virtualenvs/capitalgram--bm4msE3-py3.8/lib/python3.8/site-packages/chart_studio/plotly/plotly.py in _create_or_overwrite_grid(data, max_retries)
1548 # Create file
1549 try:
-> 1550 res = api_module.create(data)
1551 except exceptions.PlotlyRequestError as e:
1552 if max_retries > 0 and "already exists" in e.message:
~/Library/Caches/pypoetry/virtualenvs/capitalgram--bm4msE3-py3.8/lib/python3.8/site-packages/chart_studio/api/v2/grids.py in create(body)
16 """
17 url = build_url(RESOURCE)
---> 18 return request("post", url, json=body)
19
20
~/Library/Caches/pypoetry/virtualenvs/capitalgram--bm4msE3-py3.8/lib/python3.8/site-packages/retrying.py in wrapped_f(*args, **kw)
47 @six.wraps(f)
48 def wrapped_f(*args, **kw):
---> 49 return Retrying(*dargs, **dkw).call(f, *args, **kw)
50
51 return wrapped_f
~/Library/Caches/pypoetry/virtualenvs/capitalgram--bm4msE3-py3.8/lib/python3.8/site-packages/retrying.py in call(self, fn, *args, **kwargs)
204
205 if not self.should_reject(attempt):
--> 206 return attempt.get(self._wrap_exception)
207
208 delay_since_first_attempt_ms = int(round(time.time() * 1000)) - start_time
~/Library/Caches/pypoetry/virtualenvs/capitalgram--bm4msE3-py3.8/lib/python3.8/site-packages/retrying.py in get(self, wrap_exception)
245 raise RetryError(self)
246 else:
--> 247 six.reraise(self.value[0], self.value[1], self.value[2])
248 else:
249 return self.value
~/Library/Caches/pypoetry/virtualenvs/capitalgram--bm4msE3-py3.8/lib/python3.8/site-packages/six.py in reraise(tp, value, tb)
717 if value.__traceback__ is not tb:
718 raise value.with_traceback(tb)
--> 719 raise value
720 finally:
721 value = None
~/Library/Caches/pypoetry/virtualenvs/capitalgram--bm4msE3-py3.8/lib/python3.8/site-packages/retrying.py in call(self, fn, *args, **kwargs)
198 while True:
199 try:
--> 200 attempt = Attempt(fn(*args, **kwargs), attempt_number, False)
201 except:
202 tb = sys.exc_info()
~/Library/Caches/pypoetry/virtualenvs/capitalgram--bm4msE3-py3.8/lib/python3.8/site-packages/chart_studio/api/v2/utils.py in request(method, url, **kwargs)
178 content = response.content if response else "No content"
179 raise exceptions.PlotlyRequestError(message, status_code, content)
--> 180 validate_response(response)
181 return response
~/Library/Caches/pypoetry/virtualenvs/capitalgram--bm4msE3-py3.8/lib/python3.8/site-packages/chart_studio/api/v2/utils.py in validate_response(response)
80 message = content if content else "No Content"
81
---> 82 raise exceptions.PlotlyRequestError(message, status_code, content)
83
84
PlotlyRequestError: Authentication credentials were not provided.
Looks like it is an issue with some sort of Plotly online functionality. I have found some solutions for this on Internet like:
import plotly.plotly as py
import plotly.graph_objs as go
# these two lines allow your code to show up in a notebook
from plotly.offline import init_notebook_mode, iplot
init_notebook_mode()
And then calling iplot like this:
plotly.offline.iplot(...)
But I have no idea how to apply these in the Cufflinks context.
Is there a way to force Cufflinks to use offline Plotly mode?
I am trying to use Cufflinks within a notebook in JetBrains PyCharm.
An example how to IDE looks like:
I am getting this error:
Looks like it is an issue with some sort of Plotly online functionality. I have found some solutions for this on Internet like:
But I have no idea how to apply these in the Cufflinks context.
Is there a way to force Cufflinks to use offline Plotly mode?