Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Offline mode doesn't work with manylinux wheels #808

Closed
VDovidaytis-HORIS opened this issue Jul 7, 2023 · 0 comments
Closed

Offline mode doesn't work with manylinux wheels #808

VDovidaytis-HORIS opened this issue Jul 7, 2023 · 0 comments
Assignees
Labels
ASAP bug Something isn't working

Comments

@VDovidaytis-HORIS
Copy link
Collaborator

Issue description: lets-plot.min.js file is not included in manylinux Python packages. This causes problems with offline usage of the library.

Packages affected: any manylinux wheel package.

Way to reproduce:

from lets_plot import *
LetsPlot.setup_html(offline=True)

Error message:

---------------------------------------------------------------------------
FileNotFoundError                         Traceback (most recent call last)
Cell In[2], line 2
      1 from lets_plot import *
----> 2 LetsPlot.setup_html(offline=True)

File /opt/conda/lib/python3.10/site-packages/lets_plot/__init__.py:100, in LetsPlot.setup_html(cls, isolated_frame, offline, no_js, show_status)
     97 offline = offline if offline is not None else get_global_bool(OFFLINE)
     98 no_js = no_js if no_js is not None else get_global_bool(NO_JS)
--> 100 cfg._setup_html_context(isolated_frame=isolated_frame,
    101                         offline=offline,
    102                         no_js=no_js,
    103                         show_status=show_status)

File /opt/conda/lib/python3.10/site-packages/lets_plot/frontend_context/_configuration.py:67, in _setup_html_context(isolated_frame, offline, no_js, show_status)
     64 else:
     65     ctx = _create_html_frontend_context(isolated_frame, offline=offline)
---> 67 ctx.configure(verbose=show_status)
     68 _frontend_contexts[TEXT_HTML] = ctx

File /opt/conda/lib/python3.10/site-packages/lets_plot/frontend_context/_jupyter_notebook_ctx.py:40, in JupyterNotebookContext.configure(self, verbose)
     37     display_html(self._configure_connected_script(verbose), raw=True)
     38 else:
     39     # noinspection PyTypeChecker
---> 40     display_html(self._configure_embedded_script(verbose), raw=True)

File /opt/conda/lib/python3.10/site-packages/lets_plot/frontend_context/_jupyter_notebook_ctx.py:98, in JupyterNotebookContext._configure_embedded_script(verbose)
     96 js_name = "lets-plot-latest.min.js"
     97 path = os.path.join("package_data", js_name)
---> 98 js_code = pkgutil.get_data("lets_plot", path).decode("utf-8")
     99 success_message = '<div style="color:darkblue;">Lets-Plot JS is embedded.</div>' if verbose else ""
    101 return """
    102     <script type="text/javascript" {data_attr}="{script_kind}">
    103         window.letsPlotCall = function(f) {{f();}};
   (...)
    112     js_name=js_name,
    113     success_message=success_message)

File /opt/conda/lib/python3.10/pkgutil.py:639, in get_data(package, resource)
    637 parts.insert(0, os.path.dirname(mod.__file__))
    638 resource_name = os.path.join(*parts)
--> 639 return loader.get_data(resource_name)

File <frozen importlib._bootstrap_external>:1073, in get_data(self, path)

FileNotFoundError: [Errno 2] No such file or directory: '/opt/conda/lib/python3.10/site-packages/lets_plot/package_data/lets-plot-latest.min.js'
@VDovidaytis-HORIS VDovidaytis-HORIS self-assigned this Jul 7, 2023
@VDovidaytis-HORIS VDovidaytis-HORIS added bug Something isn't working ASAP labels Jul 7, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
ASAP bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant