plotly / plotly_express

Plotly Express - Simple syntax for complex charts. Now integrated into plotly.py!
https://plot.ly/python/plotly-express/
MIT License
5 stars 1 forks source link

DLL Load Fail when using Trendline #39

Open valdezt opened 5 years ago

valdezt commented 5 years ago

Hello,

Working on a Windows 10 machine. I installed plotly_express, nodejs, etc. via conda 4.6.8 (with python 3.7.5 base). The nodejs version I'm working with is 8.10.0 after running into trouble installing the jupyter extension for plotly with the most recent version of npm/nodejs and finding this as a solution.

Running into some trouble trying to use the trendline feature of plotly_express in jupyter lab. I'm not sure this is the right forum because it seems to be an issue with dependencies or perhaps my conda environment but I figured someone here might know better than I do. Here's the code that's causing the error:

px.scatter(tips, x='total_bill', y='tip', trendline="ols")

And here's the error I'm running into:

---------------------------------------------------------------------------
ImportError                               Traceback (most recent call last)
<ipython-input-3-e169d3a4b36f> in <module>
----> 1 px.scatter(tips, x='total_bill', y='tip', trendline="ols")

~\Anaconda3\envs\plotly-express\lib\site-packages\plotly_express\_chart_types.py in scatter(data_frame, x, y, color, symbol, size, hover_name, text, facet_row, facet_col, error_x, error_x_minus, error_y, error_y_minus, animation_frame, animation_group, category_orders, labels, color_discrete_sequence, color_discrete_map, color_continuous_scale, color_continuous_midpoint, symbol_sequence, symbol_map, size_max, marginal_x, marginal_y, trendline, trendline_color_override, log_x, log_y, range_x, range_y, render_mode, title, template, width, height)
     57     In a scatter plot, each row of `data_frame` is represented by a symbol mark in 2D space.
     58     """
---> 59     return make_figure(args=locals(), constructor=go.Scatter)
     60 
     61 

~\Anaconda3\envs\plotly-express\lib\site-packages\plotly_express\_core.py in make_figure(args, constructor, trace_patch, layout_patch)
    722                     mapping_labels[:],
    723                     sizeref,
--> 724                     color_range=color_range if frame_name not in frames else None,
    725                 )
    726             )

~\Anaconda3\envs\plotly-express\lib\site-packages\plotly_express\_core.py in make_trace_kwargs(args, trace_spec, g, mapping_labels, sizeref, color_range)
    145             elif k == "trendline":
    146                 if v in ["ols", "lowess"] and args["x"] and args["y"] and len(g) > 1:
--> 147                     import statsmodels.api as sm
    148 
    149                     if v == "lowess":

~\Anaconda3\envs\plotly-express\lib\site-packages\statsmodels\api.py in <module>
      3 from . import tools
      4 from .tools.tools import add_constant, categorical
----> 5 from . import regression
      6 from .regression.linear_model import OLS, GLS, WLS, GLSAR
      7 from .regression.recursive_ls import RecursiveLS

~\Anaconda3\envs\plotly-express\lib\site-packages\statsmodels\regression\__init__.py in <module>
----> 1 from .linear_model import yule_walker
      2 
      3 from statsmodels import PytestTester
      4 test = PytestTester()
      5 

~\Anaconda3\envs\plotly-express\lib\site-packages\statsmodels\regression\linear_model.py in <module>
     38 import numpy as np
     39 from scipy.linalg import toeplitz
---> 40 from scipy import stats
     41 from scipy import optimize
     42 

~\Anaconda3\envs\plotly-express\lib\site-packages\scipy\stats\__init__.py in <module>
    365 from __future__ import division, print_function, absolute_import
    366 
--> 367 from .stats import *
    368 from .distributions import *
    369 from .morestats import *

~\Anaconda3\envs\plotly-express\lib\site-packages\scipy\stats\stats.py in <module>
    171 from scipy._lib._util import _lazywhere
    172 import scipy.special as special
--> 173 from . import distributions
    174 from . import mstats_basic
    175 from ._stats_mstats_common import _find_repeats, linregress, theilslopes, siegelslopes

~\Anaconda3\envs\plotly-express\lib\site-packages\scipy\stats\distributions.py in <module>
      8 from __future__ import division, print_function, absolute_import
      9 
---> 10 from ._distn_infrastructure import (entropy, rv_discrete, rv_continuous,
     11                                     rv_frozen)
     12 

~\Anaconda3\envs\plotly-express\lib\site-packages\scipy\stats\_distn_infrastructure.py in <module>
     22 
     23 # for root finding for discrete distribution ppf, and max likelihood estimation
---> 24 from scipy import optimize
     25 
     26 # for functions of continuous distributions (e.g. moments, entropy, cdf)

~\Anaconda3\envs\plotly-express\lib\site-packages\scipy\optimize\__init__.py in <module>
    385 
    386 from .optimize import *
--> 387 from ._minimize import *
    388 from ._root import *
    389 from ._root_scalar import *

~\Anaconda3\envs\plotly-express\lib\site-packages\scipy\optimize\_minimize.py in <module>
     28 from ._trustregion_krylov import _minimize_trust_krylov
     29 from ._trustregion_exact import _minimize_trustregion_exact
---> 30 from ._trustregion_constr import _minimize_trustregion_constr
     31 
     32 # constrained minimization

~\Anaconda3\envs\plotly-express\lib\site-packages\scipy\optimize\_trustregion_constr\__init__.py in <module>
      2 
      3 
----> 4 from .minimize_trustregion_constr import _minimize_trustregion_constr
      5 
      6 __all__ = ['_minimize_trustregion_constr']

~\Anaconda3\envs\plotly-express\lib\site-packages\scipy\optimize\_trustregion_constr\minimize_trustregion_constr.py in <module>
      2 import time
      3 import numpy as np
----> 4 from scipy.sparse.linalg import LinearOperator
      5 from .._differentiable_functions import VectorFunction
      6 from .._constraints import (

~\Anaconda3\envs\plotly-express\lib\site-packages\scipy\sparse\linalg\__init__.py in <module>
    115 from .dsolve import *
    116 from .interface import *
--> 117 from .eigen import *
    118 from .matfuncs import *
    119 from ._onenormest import *

~\Anaconda3\envs\plotly-express\lib\site-packages\scipy\sparse\linalg\eigen\__init__.py in <module>
      9 from __future__ import division, print_function, absolute_import
     10 
---> 11 from .arpack import *
     12 from .lobpcg import *
     13 

~\Anaconda3\envs\plotly-express\lib\site-packages\scipy\sparse\linalg\eigen\arpack\__init__.py in <module>
     20 from __future__ import division, print_function, absolute_import
     21 
---> 22 from .arpack import *

~\Anaconda3\envs\plotly-express\lib\site-packages\scipy\sparse\linalg\eigen\arpack\arpack.py in <module>
     43 __all__ = ['eigs', 'eigsh', 'svds', 'ArpackError', 'ArpackNoConvergence']
     44 
---> 45 from . import _arpack
     46 import numpy as np
     47 import warnings

ImportError: DLL load failed: The specified procedure could not be found.

I tried spinning up the conda environment in a cmd window and ran the same command. Everything works fine, so this must be something I'm missing in jupyter. The script I used to set up the conda environment is:

conda create --name plotly-express
activate plotly-express
conda install -c conda-forge nodejs=8.10.0
conda install jupyter ipykernel numpy scipy pandas
conda install -c plotly plotly_express
jupyter labextension install @jupyterlab/plotly-extension
python -m ipykernel install --user --name plotly-express --display-name "Python (plotly_express)"
valdezt commented 5 years ago

Getting the above error in jupyter lab. I just ran this command again in Jupyter notebook and it seems to work fine (albeit with a futurewarning), but jupyter lab keeps giving me issues.