pyvistaqt icon indicating copy to clipboard operation
pyvistaqt copied to clipboard

black (blank) plot on ubuntu

Open AndrewAnnex opened this issue 4 years ago • 22 comments

on ubuntu, with a recent install of anaconda in a new environment I just get a black screen for the plotting window, if I use the file menu in the background plotter menu to save a screenshot I can view a rendering but otherwise the screen is blank. I installed via the conda-forge, and I can see some differences in the dependencies in the environment yml in this repo and the feedstock, but not sure if that is the issue.

>>> pv.Report()                                                                                                                                            
                                                                                                                                                           
--------------------------------------------------------------------------------                                                                           
  Date: Wed Sep 02 18:32:22 2020 EDT                                                                                                                       
                                                                                                                                                           
                OS : Linux                                                                                                                                 
            CPU(s) : 16                                                                                                                                    
           Machine : x86_64                                                                                                                                
      Architecture : 64bit                                                                                                                                 
               RAM : 62.8 GB                                                                                                                               
       Environment : Python                                                                                                                                
NVIDIA Corporation : GPU Vendor                                                                                                                            
GeForce GTX 1080 Ti/PCIe/SSE2 : GPU Renderer                                                                                                               
4.5.0 NVIDIA 435.21 : GPU Version                                                                                                                          
                                                                                                                                                           
  Python 3.7.8 | packaged by conda-forge | (default, Jul 31 2020, 02:25:08)                                                                                
  [GCC 7.5.0]                                                                                                                                              
                                                                                                                                                           
           pyvista : 0.25.3                                                                                                                                
               vtk : 9.0.1                                                                                                                                 
             numpy : 1.19.1
           imageio : 2.9.0
           appdirs : 1.4.3
            scooby : 0.5.6
            meshio : 4.1.1
        matplotlib : 3.3.1
         pyvistaqt : 0.2.0
             PyQt5 : 5.12.3
           IPython : 7.18.1
             scipy : 1.5.2
              tqdm : 4.48.2

  Intel(R) Math Kernel Library Version 2019.0.5 Product Build 20190808 for
  Intel(R) 64 architecture applications
--------------------------------------------------------------------------------

error when calling disable_eye_dome_lighting()

>>> plotter.disable_eye_dome_lighting()
2020-09-02 18:33:32.815 (  85.569s) [        1750E740]      vtkEDLShading.cxx:97     ERR| vtkEDLShading (0x56159871d580): FrameBufferObject should have been deleted in ReleaseGraphicsResources().
ERROR:root:FrameBufferObject should have been deleted in ReleaseGraphicsResources().
2020-09-02 18:33:32.816 (  85.570s) [        1750E740]      vtkEDLShading.cxx:102    ERR| vtkEDLShading (0x56159871d580): ColorTexture should have been deleted in ReleaseGraphicsResources().
ERROR:root:ColorTexture should have been deleted in ReleaseGraphicsResources().
2020-09-02 18:33:32.816 (  85.570s) [        1750E740]      vtkEDLShading.cxx:107    ERR| vtkEDLShading (0x56159871d580): DepthTexture should have been deleted in ReleaseGraphicsResources().
ERROR:root:DepthTexture should have been deleted in ReleaseGraphicsResources().
2020-09-02 18:33:32.816 (  85.570s) [        1750E740]      vtkEDLShading.cxx:112    ERR| vtkEDLShading (0x56159871d580): FrameBufferObject should have been deleted in ReleaseGraphicsResources().
ERROR:root:FrameBufferObject should have been deleted in ReleaseGraphicsResources().
2020-09-02 18:33:32.816 (  85.570s) [        1750E740]      vtkEDLShading.cxx:117    ERR| vtkEDLShading (0x56159871d580): ColorTexture should have been deleted in ReleaseGraphicsResources().
ERROR:root:ColorTexture should have been deleted in ReleaseGraphicsResources().
2020-09-02 18:33:32.816 (  85.570s) [        1750E740]      vtkEDLShading.cxx:122    ERR| vtkEDLShading (0x56159871d580): FrameBufferObject should have been deleted in ReleaseGraphicsResources().
ERROR:root:FrameBufferObject should have been deleted in ReleaseGraphicsResources().
2020-09-02 18:33:32.817 (  85.570s) [        1750E740]      vtkEDLShading.cxx:127    ERR| vtkEDLShading (0x56159871d580): ColorTexture should have been deleted in ReleaseGraphicsResources().
ERROR:root:ColorTexture should have been deleted in ReleaseGraphicsResources().
2020-09-02 18:33:32.817 (  85.570s) [        1750E740]      vtkEDLShading.cxx:132    ERR| vtkEDLShading (0x56159871d580): ColorTexture should have been deleted in ReleaseGraphicsResources().
ERROR:root:ColorTexture should have been deleted in ReleaseGraphicsResources().

AndrewAnnex avatar Sep 02 '20 22:09 AndrewAnnex

I am wondering if this is due to pyqt/pyqt5 as pyqt installs some packages like sip from pypi and not the conda-forge

pyqt5 5.11.x are not available on the forge

AndrewAnnex avatar Sep 03 '20 00:09 AndrewAnnex

Could you try installing vtk==8.1.2? That's been causing some issues and it might be part of the problem. Installing it through vtk should work.

Also, pyqt5==5.11.x has been the most successful for us, so we've gone with that, but you're free to choose a different version.

akaszynski avatar Sep 03 '20 01:09 akaszynski

I’ll try the older vtk but I want to stick with what is available on the conda forge as much as possible so I think I am stuck with 5.12.3 or 5.9.

-Andrew Annex

On Sep 2, 2020, at 9:15 PM, Alex Kaszynski [email protected] wrote:

 Could you try installing vtk==8.1.2? That's been causing some issues and it might be part of the problem. Installing it through vtk should work.

Also, pyqt5==5.11.x has been the most successful for us, so we've gone with that, but you're free to choose a different version.

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub, or unsubscribe.

AndrewAnnex avatar Sep 03 '20 01:09 AndrewAnnex

That might be part of the issue then. I've found pyqt5 to be incredibly finicky version to version, and I think you'll have better luck outside the conda releases. If you're using Ubuntu (as am I), the python wheels tend to be quite stable (at least with the right versions).

akaszynski avatar Sep 03 '20 02:09 akaszynski

@akaszynski I think there is a typo in either the pyvista or pyvistaqt conda forge yamls where "pyqt" and "qt" is being installed along with pyqt5, pyqt5-sip, pyqtchart, pyqtwebengine that are installed by pip in one or the other recipe. I wasn't able to get a working conda environment until I used pip only to install pyvista and pyvistaqt and necessary dependencies (see below), and when I did I didn't see any additional "qt" dependencies from the conda forge in the environment.

creating a new environment and then running "pip install pyqt5==5.11.3 pyvista pyvistaqt vtk==8.1.2" worked for me,

however this issue will need to be fixed because vtk 8.1.2 is not available for python 3.8 or forward

I think some version pinning or TLC for the conda forge feedstocks are needed

AndrewAnnex avatar Sep 03 '20 13:09 AndrewAnnex

@akaszynski I should amend this to say, that in this environment I want to be able to run jupyter which requires qt/pyqt. So although you can get a working environment it would be difficult to resolve a functioning environment without careful editing. The end solution is to fix whatever is wrong with pyvista/pyvistaqt

AndrewAnnex avatar Sep 03 '20 13:09 AndrewAnnex

The environment.yml config file was updated recently so I think it's worth trying again on master(a0babd5ebbe37dea5bd525e6135e1b325106fc8d) @AndrewAnnex. Do not hesitate to let us know how it goes for you.

GuillaumeFavelier avatar Feb 15 '21 10:02 GuillaumeFavelier

@GuillaumeFavelier I am actually still running into this issue, annoyingly I cannot downgrade vtk because 8.2 and 8.1.2 does not support python 3.8 so I am stuck with vtk 9.0.1unless I can safely downgrade the python version

AndrewAnnex avatar Jun 22 '21 13:06 AndrewAnnex

So you upgraded pyvista and pyvistaqt? Can you share a minimal snippet of the code that reproduces the issue?

GuillaumeFavelier avatar Jun 22 '21 13:06 GuillaumeFavelier

code snippet:

import pyvista as pv                         
import pyvistaqt as pvqt                     
p = pvqt.BackgroundPlotter()                 
p.add_mesh(pv.Sphere())                      
p.show() 

as some amount of time has passed here is an updated run of pv.Report:

--------------------------------------------------------------------------------
  Date: Tue Jun 22 09:15:50 2021 EDT

                OS : Linux
            CPU(s) : 16
           Machine : x86_64
      Architecture : 64bit
               RAM : 62.8 GB
       Environment : IPython
        GPU Vendor : NVIDIA Corporation
      GPU Renderer : GeForce GTX 1080 Ti/PCIe/SSE2
       GPU Version : 4.5.0 NVIDIA 460.80

  Python 3.8.5 (default, Sep  4 2020, 07:30:14)  [GCC 7.3.0]

           pyvista : 0.31.2
               vtk : 9.0.1
             numpy : 1.19.5
           imageio : 2.9.0
           appdirs : 1.4.4
            scooby : 0.5.6
            meshio : 4.1.1
        matplotlib : 3.3.0
         pyvistaqt : 0.5.0
             PyQt5 : 5.12.3
           IPython : 7.17.0
          colorcet : 1.0.0
             scipy : 1.6.3
        itkwidgets : 0.32.0
              tqdm : 4.61.1
--------------------------------------------------------------------------------

AndrewAnnex avatar Jun 22 '21 13:06 AndrewAnnex

You can update to the latest dev wheels with pip install vtk==9.0.20210612.dev0. We're working on a few bug fixes regarding these wheels, but it's quite stable outside of Mesa OpenGL in Windows.

akaszynski avatar Jun 22 '21 13:06 akaszynski

@akaszynski yay it works!

Note for others the steps were to:

  1. uninstall pyvista/pyvistaqt/vtk first with mamba/conda
  2. pip install vtk==9.0.20210612.dev0
  3. mamba install pyvista pyvistaqt --no-deps (otherwise it tries to install vtk from conda-forge)

Although my immediate issue is solved, eventually I would like to be able to continue to rely on the conda-forge distribution to make my conda env easier to share. If fixes can't be worked into the feedstock for vtk, maybe the docs for pyvistaqt/pyvista could be updated to include the fix(es) for this issue? I'm not sure how commonly this issue is run into but judging by the repo maybe I just have a strange conda environment

AndrewAnnex avatar Jun 22 '21 13:06 AndrewAnnex

Thanks for posting the steps to your workaround.

maybe the docs for pyvistaqt/pyvista could be updated to include the fix(es) for this issue?

We're going to wait some time until VTK either releases stable wheels or, should that take longer than a month or two, add in notes regarding the workaround you noted.

akaszynski avatar Jun 22 '21 13:06 akaszynski

I encountered same problem, could you please help me? I have: Python 3.8.10 vtk==9.1.0 PyQt5==5.15.6 pyvistaqt==0.7.0 pyvista==0.33.3 I tried the above solutions but didn't help. I cannot find vtk==9.0.20210612.dev0. The strange thing is the above versions work on my Windows system but do not work on Ubuntu. Any idea of why is that?

Xiaoyuew avatar Mar 07 '22 08:03 Xiaoyuew

I solved the black screen problem by cancelling anti-aliasing, but I don't understand why

Xiaoyuew avatar Mar 07 '22 09:03 Xiaoyuew

I solved the black screen problem by cancelling anti-aliasing, but I don't understand why

Thanks for reporting here @Xiaoyuew. We discovered in some cases that anti-aliasing, when not supported by the renderer, produces a black screen. I am not entirely sure of the reason but I have some guesses. Do you use MESA?

One way to know is to look at the GPU Renderer section of python -c "import pyvista; print(pyvista.Report())"

GuillaumeFavelier avatar Mar 07 '22 09:03 GuillaumeFavelier

Yes I use MESA. If it is a problem of GPU I could probably solve it. I will be changing my GPU tomorrow.

Xiaoyuew avatar Mar 07 '22 11:03 Xiaoyuew

I have changed to a NVIDIA card and the anti-aliasing no longer causes black screen. Thank you! @GuillaumeFavelier

Xiaoyuew avatar Mar 08 '22 01:03 Xiaoyuew

@Xiaoyuew Could you elaborate on how you configured pyvista to recognize your NVIDIA card on Ubuntu? I'm in WSL2 and am having some trouble getting it configured. Thanks!

JacobBumgarner avatar Mar 19 '24 01:03 JacobBumgarner

It's some time ago, but I think it is just a matter of GPU driver. If you get the correct driver then pyvista can recognize it. @JacobBumgarner

@Xiaoyuew Could you elaborate on how you configured pyvista to recognize your NVIDIA card on Ubuntu? I'm in WSL2 and am having some trouble getting it configured. Thanks!

Xiaoyuew avatar Mar 27 '24 03:03 Xiaoyuew

I appreciate your response. I'm guessing that I would need to recompile VTK with the appropriate GPU configurations. Does that seem right to you? No worries if you don't remember, I know it's been a long time 😄

Thanks, @Xiaoyuew

JacobBumgarner avatar Mar 28 '24 13:03 JacobBumgarner

No need to recompile. Just download and install the correct GPU driver should be enough. @JacobBumgarner

Xiaoyuew avatar Apr 01 '24 04:04 Xiaoyuew