Skip to content

Update scipy to the current latest version to suppress FutureWarning #153

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

Merged
merged 5 commits into from
Nov 1, 2019

Conversation

harupy
Copy link
Contributor

@harupy harupy commented Oct 23, 2019

This PR updates scipy to the current latest version 1.3.1 (release history) to resolve #148.

@harupy harupy changed the title Update scipy to the latest version Update scipy to the current latest version Oct 23, 2019
@emmanuelle
Copy link
Contributor

@nicolaskruchten how can we run the CI file even when the branch is not on plotly.py-docs? I'll look into it, unless you have a quick answer.

@nicolaskruchten
Copy link
Contributor

It's a setting we have to add in CircleCI, I can do it.

@nicolaskruchten
Copy link
Contributor

OK I've checked off this setting, so we need a new commit on this PR to kick off the CI.

@harupy
Copy link
Contributor Author

harupy commented Oct 30, 2019

@nicolaskruchten Thanks! Pushed an empty commit to trigger the CI.

@harupy
Copy link
Contributor Author

harupy commented Oct 30, 2019

The CI fails to build the following pages.

  • creating-and-updating-figures (link)
  • plotly-express (link)

These two pages use px.scatter with the keyword argment trendline which imports statsmodels and causes the error below.

ImportError                               Traceback (most recent call last)
<ipython-input-7-78cbd26bdc21> in <module>
      2 iris = px.data.iris()
      3 fig = px.scatter(iris, x="sepal_width", y="sepal_length", color="species", marginal_y="violin",
----> 4            marginal_x="box", trendline="ols")
      5 fig.show()

/srv/conda/envs/notebook/lib/python3.7/site-packages/plotly/express/_chart_types.py in scatter(data_frame, x, y, color, symbol, size, hover_name, hover_data, custom_data, 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, range_color, color_continuous_midpoint, symbol_sequence, symbol_map, opacity, size_max, marginal_x, marginal_y, trendline, trendline_color_override, log_x, log_y, range_x, range_y, render_mode, title, template, width, height)
     51     In a scatter plot, each row of `data_frame` is represented by a symbol mark in 2D space.
     52     """
---> 53     return make_figure(args=locals(), constructor=go.Scatter)
     54 
     55 

/srv/conda/envs/notebook/lib/python3.7/site-packages/plotly/express/_core.py in make_figure(args, constructor, trace_patch, layout_patch)
   1221 
   1222             patch, fit_results = make_trace_kwargs(
-> 1223                 args, trace_spec, group, mapping_labels.copy(), sizeref
   1224             )
   1225             trace.update(patch)

/srv/conda/envs/notebook/lib/python3.7/site-packages/plotly/express/_core.py in make_trace_kwargs(args, trace_spec, g, mapping_labels, sizeref)
    218             elif k == "trendline":
    219                 if v in ["ols", "lowess"] and args["x"] and args["y"] and len(g) > 1:
--> 220                     import statsmodels.api as sm
    221 
    222                     # sorting is bad but trace_specs with "trendline" have no other attrs

/srv/conda/envs/notebook/lib/python3.7/site-packages/statsmodels/api.py in <module>
     14 from . import robust
     15 from .robust.robust_linear_model import RLM
---> 16 from .discrete.discrete_model import (Poisson, Logit, Probit,
     17                                       MNLogit, NegativeBinomial,
     18                                       GeneralizedPoisson,

/srv/conda/envs/notebook/lib/python3.7/site-packages/statsmodels/discrete/discrete_model.py in <module>
     43 
     44 from statsmodels.base.l1_slsqp import fit_l1_slsqp
---> 45 from statsmodels.distributions import genpoisson_p
     46 
     47 try:

/srv/conda/envs/notebook/lib/python3.7/site-packages/statsmodels/distributions/__init__.py in <module>
      1 from .empirical_distribution import ECDF, monotone_fn_inverter, StepFunction
----> 2 from .edgeworth import ExpandedNormal
      3 from .discrete import genpoisson_p, zipoisson, zigenpoisson, zinegbin

/srv/conda/envs/notebook/lib/python3.7/site-packages/statsmodels/distributions/edgeworth.py in <module>
      5 import numpy as np
      6 from numpy.polynomial.hermite_e import HermiteE
----> 7 from scipy.misc import factorial
      8 from scipy.stats import rv_continuous
      9 import scipy.special as special

ImportError: cannot import name 'factorial' from 'scipy.misc' (/srv/conda/envs/notebook/lib/python3.7/site-packages/scipy/misc/__init__.py)

@harupy
Copy link
Contributor Author

harupy commented Oct 30, 2019

Updating statsmodels should solve this issue (ref) .

@harupy
Copy link
Contributor Author

harupy commented Oct 31, 2019

@harupy
Copy link
Contributor Author

harupy commented Oct 31, 2019

Looks like I misunderstood something. Where can I see the built pages?

@nicolaskruchten
Copy link
Contributor

They get uploaded as artifacts in CI I believe. Thanks for looking into this for us :)

@harupy
Copy link
Contributor Author

harupy commented Oct 31, 2019

The warning disappeared!

Screen Shot 2019-10-31 at 22 07 29

@nicolaskruchten
Copy link
Contributor

OK so this is working now? the built branch only updates once PRs are merged into master :)

@harupy
Copy link
Contributor Author

harupy commented Oct 31, 2019

Yes this is working

@harupy harupy changed the title Update scipy to the current latest version Update scipy to the current latest version to suppress FutureWarning Nov 1, 2019
@harupy
Copy link
Contributor Author

harupy commented Nov 1, 2019

oh, I found another one. This one seems to be from pandas.

https://plot.ly/python/choropleth-maps/#full-county-choropleths

nbconvert doesn't seem to have an option to hide warning messages...

@harupy
Copy link
Contributor Author

harupy commented Nov 1, 2019

One workaround that I came up with is adding the css below to hide div that contains warning messages.

div.output_stderr {
  display: none;
}

@nicolaskruchten nicolaskruchten merged commit cb8580c into plotly:master Nov 1, 2019
@nicolaskruchten
Copy link
Contributor

Thanks for the PR! We should look into that other warning for sure. Really what we should do is have CI grep the HTML output for Warning and fail the build if there is one :)

@harupy harupy deleted the update-scipy branch November 4, 2019 00:28
@harupy harupy mentioned this pull request Nov 4, 2019
12 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

FutureWarning on the doc
3 participants