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

When running plot() function in a Jupyter Notebook, a greyed out window appears. #383

Open
downiec opened this issue Jan 28, 2019 · 18 comments
Assignees
Labels
low Low Priority bug (but not enhancement)
Milestone

Comments

@downiec
Copy link
Contributor

downiec commented Jan 28, 2019

If vcs.init() is run in a Jupyter notebook, it should automatically detect and have bg=true to avoid the greyed out window when sidecar is used in a Jupyter Notebook.

@doutriaux1 doutriaux1 added this to the 8.1 milestone Jan 28, 2019
@scottwittenburg
Copy link
Collaborator

Do we need to detect that we're running in a Jupyter notebook somehow, or can the default just be bg=True?

@doutriaux1
Copy link
Contributor

no default needs to be bg=False as now. Look for the bit of code I added to detect notebook, for sidecar

@doutriaux1
Copy link
Contributor

Actually the code should already be in place (I thought I did code this): https://github.com/CDAT/vcs/blob/master/vcs/Canvas.py#L931-L935

I wo der why it's not picking it up

@doutriaux1
Copy link
Contributor

@scottwittenburg is it related to the new vtk-cdat ?

@doutriaux1
Copy link
Contributor

I remember seeing a window even with mesalib, maybe it's a similar issue?

@scottwittenburg
Copy link
Collaborator

I think I'll need some instructions on how to reproduce this if I'm to be of any help.

@doutriaux1
Copy link
Contributor

according to @downiec when in a jupyternotebook with the non-mesa env (py3) x=vcs.init();x.plot([1,2,3]) make a window appear

@doutriaux1
Copy link
Contributor

we do not want the window appear, hence bg=True

@downiec
Copy link
Contributor Author

downiec commented Jan 28, 2019

Could it be because my conda environment? I just remembered I'm using the old conda environment because that's the one that's currently working. I'll let you know

@scottwittenburg
Copy link
Collaborator

Sounds good, thanks @downiec.

@downiec
Copy link
Contributor Author

downiec commented Jan 29, 2019

What vcs version do I need? I tried pulling from master and then running python setup.py install, but now I'm getting an error and it won't plot anything.
AttributeError: module 'vtkmodules.all' has no attribute 'vtkRenderingOpenGLPython'

I emailed a screenshot.

@downiec
Copy link
Contributor Author

downiec commented Jan 29, 2019

I noticed if I run this command:
canvas.plot(clt,"default","default",bg=True)
Where I set bg=True, then it works correctly without the error.

@downiec
Copy link
Contributor Author

downiec commented Jan 29, 2019

Strange... if I run the command, initially it will have the error, but if I keep running a few times (without changing the code or parameters), eventually it works correctly. Is it because something needs to be loaded in the back end?

@downiec
Copy link
Contributor Author

downiec commented Jan 29, 2019

One last comment. In the JupyterLab Notebook, first time I run the cell, I get:
AttributeError: module 'vtkmodules.all' has no attribute 'vtkRenderingOpenGLPython'
Second time I run the cell (same exact code, I just run the cell again):
ZeroDivisionError: float division by zero
Third time I run it, it plots without an error.

@scottwittenburg
Copy link
Collaborator

scottwittenburg commented Jan 29, 2019

Sorry @downiec, I saw your email about this before I got here, so I responded there. Basically, the AttributeError: module 'vtkmodules.all' has no attribute 'vtkRenderingOpenGLPython' is the one that matters. Based on the stacktrace in your email, it's clear that's an old version of VTKPlots.py (from before we merged the Context2D work). Since you said you checked out vcs master and installed it using python setup.py install, I wonder if you're hitting something I encounter from time to time now that vcs is egg based. Have a look and see if there are multiple vcs egg files in your environment.
They would be located somewhere like:

${CONDA_HOME}/envs/${JUPYTER_VCDAT_ENV}/lib/python3.6/site-packages/

If you have more than one for vcs, you can move them out of the way (or just delete them all), and then run python setup.py install again from the vcs repository directory.

@downiec
Copy link
Contributor Author

downiec commented Jan 29, 2019

@scottwittenburg Thanks for the response, I went ahead and removed the vcs egg files like you said, and then I ran python setup.py install. That all fixed the error, thanks! Unfortunately it doesn't resolve the greyed out window issue. Basically, if I run the following in a Jupyter Lab Notebook:
canvas.plot(clt,"default","default")
The plot is made, no problem. But then there's also a separate greyed out window that pops up and it can't be closed or minimized etc, it's just there. I tried running:
canvas.plot(clt,"default","default",bg=True)
And the issue still persists, with a greyed out window popping up. The window only goes away when I restart the kernel.

@scottwittenburg
Copy link
Collaborator

@downiec Can you run the following in the same environment you just cleaned up, and see if the window pops up?

import vcs
canvas = vcs.init(bg=1)
canvas.plot([1, 2, 3, 4, 5])
canvas.png("simple.png")

Let me know what happens, thanks.

@downiec
Copy link
Contributor Author

downiec commented Jan 29, 2019

I didn't see anything get plotted, but the grey window pops whether I run the code in a JupyterLab notebook, or I run it from Python in the console. Also a png named 'simple.png' was created.

Also another thing I notice is the grey window usually pops up after the data has been plotted. Sometimes almost a full second after the graph has already been plotted in the sidecar.

@doutriaux1 doutriaux1 modified the milestones: 8.1, 8.2 Mar 27, 2019
@scottwittenburg scottwittenburg added the low Low Priority bug (but not enhancement) label Apr 15, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
low Low Priority bug (but not enhancement)
Projects
None yet
Development

No branches or pull requests

3 participants