JetBrains / lets-plot

Multiplatform plotting library based on the Grammar of Graphics
https://lets-plot.org
MIT License
1.5k stars 47 forks source link

DLL load failed while importing lets_plot_kotlin_bridge #118

Closed zwyber closed 4 years ago

zwyber commented 4 years ago

I greatly appreciate the effort to make a nice ggplot-like plotting library for Python! However, when installing and importing I got an ImportError: ImportError: DLL load failed while importing lets_plot_kotlin_bridge: The specified module could not be found.

Environment:

Results in an import error, full error is in the attached with the issue

zwyber commented 4 years ago

ImportError                               Traceback (most recent call last)
<ipython-input-1-29fbef30cdcb> in <module>
----> 1 from lets_plot import *

[PATH_TO_VENV]venv\lib\site-packages\lets_plot\__init__.py in <module>
     11 from .plot import *
     12 from ._global_settings import LetsPlotSettings
---> 13 from .frontend_context import *
     14 
     15 __all__ = (plot.__all__ +

[PATH_TO_VENV]venv\lib\site-packages\lets_plot\frontend_context\__init__.py in <module>
      4 #
      5 
----> 6 from ._configuration import *
      7 
      8 __all__ = _configuration.__all__

[PATH_TO_VENV]venv\lib\site-packages\lets_plot\frontend_context\_configuration.py in <module>
      6 
      7 from ._frontend_ctx import FrontendContext
----> 8 from ._html_contexts import _create_html_frontend_context, _use_isolated_frame
      9 from .._global_settings import get_global_bool
     10 from ..plot.core import PlotSpec

[PATH_TO_VENV]venv\lib\site-packages\lets_plot\frontend_context\_html_contexts.py in <module>
      5 
      6 from ._frontend_ctx import FrontendContext
----> 7 from ._jupyter_notebook_ctx import JupyterNotebookContext
      8 from ._static_html_page_ctx import StaticHtmlPageContext
      9 from .._global_settings import has_global_value, get_global_bool, HTML_ISOLATED_FRAME

[PATH_TO_VENV]venv\lib\site-packages\lets_plot\frontend_context\_jupyter_notebook_ctx.py in <module>
     13 
     14 from ._frontend_ctx import FrontendContext
---> 15 from .. import _kbridge as kbr
     16 from .._global_settings import get_global_str, has_global_value, is_production
     17 from .._version import __version__

[PATH_TO_VENV]venv\lib\site-packages\lets_plot\_kbridge.py in <module>
      5 from typing import Dict
      6 
----> 7 import lets_plot_kotlin_bridge
      8 
      9 from ._type_utils import standardize_dict

ImportError: DLL load failed while importing lets_plot_kotlin_bridge: The specified module could not be found.```
VDovidaytis-HORIS commented 4 years ago

Thank you for reporting this issue!

I suppose that you don't have any MinGW support on your Windows machine.

Could you try these steps, please:

Then try to import and use lets-plot.

VDovidaytis-HORIS commented 4 years ago

Added installation procedure to the README_PYTHON.md file for Windows users:

120

VDovidaytis-HORIS commented 4 years ago

@zwyber have you tried the steps I mentioned above? Did it help in your problem?

zwyber commented 4 years ago

Hi @VDovidaytis-HORIS , apologies for the late response! It was a busy week, I only had some time now to tinker with Python.

Indeed I had no MinGW on my laptop. I can confirm the steps you mentioned fixes the problem! The setup instructions are clear.

Remains a bit odd why the package can install with a missing MinGW toolchain without throwing an error during install. If possible, it would be nice to have the package fail to install without MinGW. Otherwise the current instructions are sufficiently clear!

Thank you for for the solution!

PS: Since I am familiar with R and the ggplot2 package, I tried ggsave() out of habit. I noticed it was not implemented in lets-plot, instead using the export module. If you want to make the transition from R even smoother, you may want to consider adding a ggsave() wrapper :)

alshan commented 4 years ago

@zwyber thanx for the feedback, I've created an issue regarding ggsave wrapper: https://github.com/JetBrains/lets-plot/issues/122

Although we can only support device="svg" at this time.