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

Fix iplot offline #599

Merged
merged 15 commits into from
Nov 22, 2016
Merged

Fix iplot offline #599

merged 15 commits into from
Nov 22, 2016

Conversation

Kully
Copy link
Contributor

@Kully Kully commented Nov 1, 2016

Re iplot issue brought up in #593 (comment)

Fixed by just removing the unnecessary show_link and link_text from the _plot_html() call in this line.

plot() looks fine as it has show_link and link_text in the signature.

@Kully
Copy link
Contributor Author

Kully commented Nov 1, 2016

Tests passed locally but getting strange encoding error on circle. It looks like its in site-packages which I think is core Python. Any thoughts @theengineear ?

cc: @choldgraf

@Kully
Copy link
Contributor Author

Kully commented Nov 1, 2016

The last bit of the error message:

Cleaning up...
Command /home/ubuntu/.pyenv/versions/2.7.8/bin/python -c "import setuptools, tokenize;__file__='/tmp/pip_build_ubuntu/pandas/setup.py';exec(compile(getattr(tokenize, 'open', open)(__file__).read().replace('\r\n', '\n'), __file__, 'exec'))" install --record /tmp/pip-DxAgzf-record/install-record.txt --single-version-externally-managed --compile failed with error code 1 in /tmp/pip_build_ubuntu/pandas
Traceback (most recent call last):
  File "/home/ubuntu/.pyenv/versions/2.7.8/bin/pip", line 11, in <module>
    sys.exit(main())
  File "/home/ubuntu/.pyenv/versions/2.7.8/lib/python2.7/site-packages/pip/__init__.py", line 185, in main
    return command.main(cmd_args)
  File "/home/ubuntu/.pyenv/versions/2.7.8/lib/python2.7/site-packages/pip/basecommand.py", line 161, in main
    text = '\n'.join(complete_log)
UnicodeDecodeError: 'ascii' codec can't decode byte 0xe2 in position 72: ordinal not in range(128)
☁☀☂ setup.sh: ☁☀☂ 39: can't install optional for Python 2.7.8.


bash circle/setup.sh returned exit code 1

Action failed: bash circle/setup.sh

@theengineear
Copy link
Contributor

Hmm. I think the tests need some attention in general. I'll come back to this later in the day and try to fix up our test suite. That is an old pip error I've seen before (not super unicode-friendly). I thought it was related to http://stackoverflow.com/questions/25036897/pip-install-unicodedecodeerror, but i don't know why it would have been in a directory with a unicode-y name.

At any rate, I'll take a look later today.

@theengineear
Copy link
Contributor

Changes look good! I'll try to get a patch in to fix the test suite and we can get this in soon!

@choldgraf
Copy link
Contributor

hey all - shall I take a look at this now to see if it works?

@Kully
Copy link
Contributor Author

Kully commented Nov 2, 2016

hey all - shall I take a look at this now to see if it works?

Go ahead! I just rebuilt the test and it failed again.

@Kully Kully mentioned this pull request Nov 3, 2016
@choldgraf
Copy link
Contributor

ok, will try to spend some time on this over the weekend

On Wed, Nov 2, 2016 at 10:26 AM Adam Kulidjian [email protected]
wrote:

hey all - shall I take a look at this now to see if it works?

Go ahead! I just rebuilt the test and it failed again.


You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
#599 (comment), or mute
the thread
https://github.com/notifications/unsubscribe-auth/ABwSHUOj27e_T7e2zmRVsP5cAayp8xCIks5q6Me4gaJpZM4KmLGE
.

@choldgraf
Copy link
Contributor

I can confirm that iplot now works on this branch. Still slow as heck but it does plot :)

@Kully
Copy link
Contributor Author

Kully commented Nov 10, 2016

I can confirm that iplot now works on this branch. Still slow as heck but it does plot :)

Do you know which PR solved it? I was working on one but the tests were not passing for some reason...

@choldgraf
Copy link
Contributor

I just pulled the code on this PR and tried it out

@Kully
Copy link
Contributor Author

Kully commented Nov 10, 2016

Oh wait, I'm ridiculous. This PR was the PR I was talking about.

Yeah, it works but the tests are still failing for some reason... 😕

@Kully
Copy link
Contributor Author

Kully commented Nov 18, 2016

@choldgraf @theengineear Working on this now.

Finally getting test failures to occur locally - - helpful!

@Kully
Copy link
Contributor Author

Kully commented Nov 21, 2016

Getting there. Cleared up this error which #614 was getting:

screen shot 2016-11-21 at 6 29 20 pm

@Kully
Copy link
Contributor Author

Kully commented Nov 22, 2016

@chriddyp Can I get a 💃 ? Finally we have success.

Who else should I ping in the future? Is one reliable person enough? 😄

@chriddyp
Copy link
Member

Who else should I ping in the future?

Me or @theengineear !

@Kully
Copy link
Contributor Author

Kully commented Nov 22, 2016

Me or @theengineear !

K, sounds good. Let me know if you approve here.

@@ -869,7 +868,7 @@ def _fill_in_response_column_ids(cls, request_columns,
for req_col in request_columns:
for resp_col in response_columns:
if resp_col['name'] == req_col.name:
req_col.id = '{0}/{1}'.format(grid_id, resp_col['uid'])
req_col.id = '{0}:{1}'.format(grid_id, resp_col['uid'])
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So did making plots based off of grid columns just not work before? Can you show me an example where this didn't work before but now, with this fix, it works?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, it wasn't working until I made the switch. Here's one example that didn't work before the change that worked after:

c1 = Column([6, 6, 6, 5], 'pillow')
c2 = Column(['a', 'b', 'c', 'd'], 'couch2')
g = Grid([c1, c2])

py.grid_ops.upload(g, 'pillow_and_couch_grid222', auto_open=False)
url = py.plot([Scatter(xsrc=g[0], ysrc=g[1])], auto_open=False, filename='222pillow222')

I'm curious about something though...when plotly makes the request to V2 for the upload of the grid, prior to that, the local grid has blank ids (eg. grid[0].id returns "" ) and after the request, your local grid has the proper filled in id eg. "AdamKulidjian:1782:u3fg1"

How is my local grid getting updated if only a url after py.upload() is run?

Copy link
Member

@chriddyp chriddyp Nov 22, 2016

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Got it. That's weird, because this definitely worked at some point. Here is the section and example in our docs:
image

If this is the case, then it seems like maybe the plotly backend API changed and stopped allowing IDs in this format.

Copy link
Member

@chriddyp chriddyp Nov 22, 2016

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

How is my local grid getting updated if only a url after py.upload() is run?

py.grid_ops.upload(g) updates the columns in g. Those columns in g have the same reference as c1 and c2, so changing them in g changes c1 and c2` too. See http://nedbatchelder.com/text/names.html for some more info.

The ids themselves are assigned by the plotly server.

@@ -6208,6 +6207,9 @@ def create_dendrogram(X, orientation="bottom", labels=None,
if len(s) != 2:
exceptions.PlotlyError("X should be 2-dimensional array.")

if distfun is None:
distfun = scs.distance.pdist

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

what is the motivation behind this change? It seems like by removing it from the call signature it is less informative to users about what distfun is.

Copy link
Contributor Author

@Kully Kully Nov 22, 2016

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Perhaps, but for some strange reason the tests were failing here when scs() functions were in the calls. By putting them in the body of the functions it cleared up the problem.

I thought it had something to do with the order of the

try:
    import scipy as scp
    _scipy_imported = True
except ImportError:
    _scipy_imported = False

or such but it wasn't related

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Got it. should scs by scp in this case? Also, what happens if a user runs this function but they don't have scipy installed? It's not a required dependency of the plotly package (and it shouldn't be) but folks might be surprised if running the function fails due to a missing module.

What do we do in other parts of the code that use scipy? Do we just let it fail or do we tell users that they need to install scipy?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That's a good question. I feel like the error messages may do that enough. I mean, scipy is pretty commonplace as well. For this commit at least I don't think we should add the error messages, as that may be a big project in all parts of plotly.py

Copy link
Member

@chriddyp chriddyp Nov 22, 2016

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Right. It's just that the error won't be "scipy is not defined" because it won't break on the import scipy step, it'll break on the scs.distance.pdist step which means that the error will probably be scs is not defined which isn't very intuitive or helpful.

Could you try creating a clean virtualenv without scipy and try calling this function and seeing what the error message is? Scipy may be common but Plotly may be the first package and experience that users have in Python and we want to make it as easy as possible for people to get going. We can fix the issue in a separate PR but it'd be nice to know how this will break for our users.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Okay sounds good.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fantastic! It does have a you-need-scipy message in it:

screen shot 2016-11-22 at 4 02 06 pm

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Great, thanks for looking into that!

@chriddyp
Copy link
Member

Just left a couple of questions that I'd like to understand better before we merge. Otherwise looks good!

@Kully
Copy link
Contributor Author

Kully commented Nov 22, 2016

If this is the case, then it seems like maybe the plotly backend API changed and stopped allowing IDs in this format.

That's what I suspected, but wasn't prepared to dig into streambed ;)

@chriddyp
Copy link
Member

OK, this looks good to me. 💃

@Kully Kully merged commit 046ae17 into master Nov 22, 2016
@Kully Kully deleted the fix-iplot-offline branch November 22, 2016 23:50
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.

4 participants