2

Hi I am trying to use plotly while completely offline. This practically means that if any kind of requests need to be made to an internet service, they wont be able to go through:

I am using a very simple import to start my work:

from plotly import __version__
from plotly.offline import download_plotlyjs, init_notebook_mode, plot, iplot

print __version__ # requires version >= 1.9.0

Every time, and no matter what I try, I keep getting the same error message:

---------------------------------------------------------------------------
        ModuleNotFoundError                       Traceback (most recent call last)
<ipython-input-12-dd44b8cf2e22> in <module>
        ----> 1 from plotly import __version__
2 from plotly.offline import download_plotlyjs, init_notebook_mode, plot, iplot
3
4 print(__version__) # requires version >= 1.9.0

~/anaconda3/lib/python3.7/site-packages/plotly/__init__.py in <module>
        29 from __future__ import absolute_import
30
---> 31 from plotly import (plotly, dashboard_objs, graph_objs, grid_objs, tools,
32                     utils, session, offline, colors, io)
33 from plotly.version import __version__

~/anaconda3/lib/python3.7/site-packages/plotly/plotly/__init__.py in <module>
        8
9 """
---> 10 from . plotly import (
     11     sign_in,
     12     update_plot_options,

~/anaconda3/lib/python3.7/site-packages/plotly/plotly/plotly.py in <module>
     29 
     30 from plotly import exceptions, files, session, tools, utils
---> 31 from plotly.api import v1, v2
     32 from plotly.basedatatypes import BaseTraceType, BaseFigure, BaseLayoutType
     33 from plotly.plotly import chunked_requests

~/anaconda3/lib/python3.7/site-packages/plotly/api/v1/__init__.py in <module>
      1 from __future__ import absolute_import
      2 
----> 3 from plotly.api.v1.clientresp import clientresp

~/anaconda3/lib/python3.7/site-packages/plotly/api/v1/clientresp.py in <module>
      7 
      8 from plotly import config, utils, version
----> 9 from plotly.api.v1.utils import request
     10 
     11 

~/anaconda3/lib/python3.7/site-packages/plotly/api/v1/utils.py in <module>
      3 import requests
      4 from requests.exceptions import RequestException
----> 5 from retrying import retry
      6 
      7 from plotly import config, exceptions

ModuleNotFoundError: No module named 'retrying'

I am not sure if there's any reason why I should bother with installing "retrying" or whether there is simply no way to get 'plotly' to work completely offline. At the very least, offline is misleading--they could go with serveless or something instead.

4
  • 1
    The fact that plotly even tries to connect to the internet was a deal-breaker for me. I just want to draw charts! Commented Feb 14, 2019 at 10:33
  • It may or may not be what you want to hear, but perhaps you want to look into some alternatives, e.g. bokeh (to which I am not affiliated in any way.. just a happy user). Commented Feb 14, 2019 at 10:38
  • Bokeh looks interesting as well as seaborn. Thanks for the reference. Commented Feb 15, 2019 at 10:47
  • @agent_C.Hdj, you tried those example? I thought, missing init_notebook_mode(connected=True) may be cause your problem Commented Feb 20, 2019 at 13:50

1 Answer 1

1

Here's a sample on how to use plotly offline.

from plotly.offline import plot as off
import plotly.figure_factory as ff
import plotly.io as pio

table = ff.create_table(df, index=True)
fig = off(table, filename='simple_table')
pio.write_image(table, 'sample.png')

I havent found any plotly features available online which is not available offline also.

PS. This requires plotly-orca I believe. https://github.com/plotly/orca

Check your Plotly version, version 1.9.4+ is needed for offline plotting.

plotly.offline.iplot is for jupyter and plotly.offline.plot is for creating standalone HTML that is saved locally and opened inside your web browser.

Sign up to request clarification or add additional context in comments.

4 Comments

No. This does not work. Problem persists. And I have the latest version installed.
Is there any new error code. Or is it the same error code? Are you using a jupyter notebook? Did you try installing retrying?
Let me try and instal retrying and get back to you.
Yes, retrying is installed and problem persists.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.