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

This fixes an issue happens in jupyter notebook. #122

Closed

Conversation

amanotk
Copy link
Contributor

@amanotk amanotk commented Sep 25, 2020

The jupyter notebook crashes when the get_y_range
is called in tplot_utilitis.py
The root cause of this issue seems to be a bug in
ipykernel. See for reference:
jupyter/notebook#5757
ipython/ipykernel#540

The is just a workaround working with

  • python-3.7.9
  • jupyter-1.0.0
  • ipython-7.18.1
  • ipykernel-5.3.4
  • tornado-6.0.4

on linux.

I think I don't fully understand the intention of using warnings
in the original implementation. So please fix it as you wish.
I believe we just need to avoid calling warnigns.filterwarning("error")
for workaround.

The jupyter notebook crashes when the get_y_range
is called in tplot_utilitis.py
The root cause of this issue seems to be a bug in
ipykernel. See for reference:
jupyter/notebook#5757
ipython/ipykernel#540

The is just a workaround working with
- python-3.7.9
- jupyter-1.0.0
- ipython-7.18.1
- ipykernel-5.3.4
- tornado-6.0.4
on linux.
@bryan-harter
Copy link
Collaborator

Thanks for catching this! The reason why that warnings stuff is imported is np.nanmin and np.nanmax can print a LOT of warning messages if there are NaNs in the data, which for some datasets there tends to be. Its been a few years since that was inserted there, but I think the original intent behind it was to suppress all those warnings from being printed out.

So that said, I'm not sure why I set it to warnings.filterwarnings("error"), because that turns all warnings into errors. I can see how this might cause problems in jupyter, if there are warnings that are occurring in the background then this would turns them to errors and the whole thing crashes.

I think instead I should have done warnings.filterwarnings("ignore") to temporarily ignore errors from being printed out, and then allow them again after the function finishes.

Let me push up a change where I switch "error" to "ignore", and let me know if you still have the same problem!

@amanotk
Copy link
Contributor Author

amanotk commented Sep 29, 2020

Your solution seems to be working well for me.
I am closing this. Thanks.

@amanotk amanotk closed this Sep 29, 2020
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.

2 participants