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

polyscope in jupyter notebooks crashes python #57

Closed
mhogg opened this issue May 6, 2020 · 9 comments
Closed

polyscope in jupyter notebooks crashes python #57

mhogg opened this issue May 6, 2020 · 9 comments
Assignees
Labels

Comments

@mhogg
Copy link

mhogg commented May 6, 2020

Hi,

I just tried polyscope within python on Windows using the ipython terminal, jupyter notebook and jupyter lab. In all cases, polyscope works well and is quite impressive. But when I try to close the polyscope window, it always crashes python. Are there any settings I can change to address this? I am assuming it is related to the opengl backend, yes?

Cheers,
Michael

@nmwsharp
Copy link
Owner

nmwsharp commented May 7, 2020

Hi, thanks for checking out the library and the report!

I've haven't seen this issue on my end, but I'll try to reproduce it. Did you install via pip or conda? Any chance you could collect a stack trace for the crash? (don't actually know how best to get a stack trace on Windows).

I think soon I'll push a new minor version which adds a runtime options to include some debugging checks, which will help us get to the bottom of these issues more quickly.

@nmwsharp nmwsharp added the bug label May 7, 2020
@nmwsharp nmwsharp self-assigned this May 7, 2020
@mhogg
Copy link
Author

mhogg commented May 8, 2020

I installed via pip, but into a conda environment (python 3.7). I may try to uninstall the pip version and use conda instead.

I am not sure how to get a stack trace from within jupyter, but I am happy to help test your new minor release on windows and report back.

@akshayka
Copy link

I just discovered polyscope, and it's really awesome. Great work @nmwsharp!

Unfortunately, I'm running into the same problem that @mhogg hit. When invoking polyscope from a Python shell (or IPython shell, or Jupyter notebook), attempting to close the polyscope GUI (by hitting the 'x' button) crashes the Python process. Specifically, the GUI freezes, I'm forced to force quit it, and Python is killed.

I'm using Ubuntu 20.10, Python 3.8.6.

Here's a minimum-working example.

Python 3.8.6 (default, Sep 25 2020, 09:36:53) 
[GCC 10.2.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import polyscope as ps
>>> import numpy as np
>>> 
>>> try:
...         ps.init()
... except:
...         pass
... 
[polyscope] Backend: openGL3_glfw -- Loaded openGL version: 3.3.0 NVIDIA 450.80.02
>>> # generate some points
>>> points = np.random.rand(100, 3)
>>> 
>>> # visualize!
>>> ps_cloud = ps.register_point_cloud("my points", points)
>>> ps.show()
>>> Killed

Any idea what might be happening? I'm building a library that relies heavily on visualizing point clouds, and I'd love to be able to recommend polyscope to my users. The only thing stopping me is this particular issue.

Thanks again for your awesome work!

@nmwsharp
Copy link
Owner

Ah, thank you for raising this again. I looked in to it before but could not find a solution and eventually got distracted.

I'm not an experienced IPython/Jupyter programmer myself, but I certainly why this is an issue! I will look in to it again and see if I can find some fix or workaround.

I'm a little surprised to hear that this also arises from a plain old Python shell in Ubuntu, since I use Polyscope there fairly often. Note that the current behavior of Polyscope is that the show() function blocks while the GUI is interactive. Then once you close the window the show() function returns and the prompt becomes usable again, and the GUI window sits there unresponsive until you call show() the next time.

Is this what you are seeing? Or is it really that the prompt and GUI window are both simultaneously unresponsive after closing the window? I realize that this behavior is potentially confusing; if this is what's happening perhaps we just need to communicate it more clearly to the user.

@akshayka
Copy link

Thanks for the quick response!

Note that the current behavior of Polyscope is that the show() function blocks while the GUI is interactive. Then once you close the window the show() function returns and the prompt becomes usable again, and the GUI window sits there unresponsive until you call show() the next time.

You're totally right. This is in fact what is happening. The GUI does become unresponsive, and control is returned to the Python/IPython shell.

I guess this is a bit confusing because after a few seconds, a dialog box opens up asking whether I'd like to force quit the GUI.

image

It's the force quit that causes Python to crash. So I suppose the solution is simply to choose "wait" instead.

I realize that this behavior is potentially confusing; if this is what's happening perhaps we just need to communicate it more clearly to the user.

Yes, I think that might be helpful. At least, you'd have fewer people opening issues about this behavior :)

@nmwsharp
Copy link
Owner

Yes, totally agree.

I will see if I can change this behavior in the python bindings, or at least make it more intuitive.

(due to the death of TravisCI, my workflow for deploying Python versions is broken 😢 this may delay the rollout of an updated version while I sort that out on Github Actions or something)

@nmwsharp
Copy link
Owner

nmwsharp commented Jan 6, 2021

Ok. I just pushed some updates that address this in C++ and Python (Python version 0.1.5, already on pip and percolating to conda soon). Now, clicking the close button will actually close the window, so the OS doesn't angry and users get clear visual feedback.

It's still true that when you call polyscope.show(), the function blocks and does not return until you close the GUI. Changing this would require a fundamental architectural change. However, hopefully with GUI closing like a normal window it will be more clear to users.

I also confirmed that Polyscope is usable in Jupyter notebooks in its current form, at least when the kernel is running locally.

I'm closing this as fixed. However, if you still have lingering issues/crashes related to this feel free to reopen.

@nmwsharp nmwsharp closed this as completed Jan 6, 2021
@mhogg
Copy link
Author

mhogg commented Jan 15, 2021

I realize this issue is closed, but just wanted to add that v0.1.6 fixes the issue I had on Windows 10 where Polyscope crashed the Jupyter notebook kernel when its window was closed.

Thanks!

@nmwsharp
Copy link
Owner

Glad to hear it! Please reach out again if you encounter other issues.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants