pangeo-data / pangeo-cloud-federation

Deployment automation for Pangeo JupyterHubs on AWS, Google, and Azure
https://pangeo.io/cloud.html
58 stars 32 forks source link

Dependency problem with pyvista for 3D visualization #943

Open jbusecke opened 3 years ago

jbusecke commented 3 years ago

Our group wants to use pyvista for some 3D visualizations on the pangeo google cloud but we are running into some dependency issues.

I tried to install pyvista using mamba in the command line.

mamba install pyvista

But when I try to import it I end up with this error:

import pyvista
---------------------------------------------------------------------------
ImportError                               Traceback (most recent call last)
<ipython-input-2-f7165b0393f4> in <module>
----> 1 from pyvista import examples
      2 examples.plot_wave()

/srv/conda/envs/notebook/lib/python3.8/site-packages/pyvista/__init__.py in <module>
      5 
      6 from pyvista._version import __version__
----> 7 from pyvista.plotting import *
      8 from pyvista.utilities import *
      9 from pyvista.core import *

/srv/conda/envs/notebook/lib/python3.8/site-packages/pyvista/plotting/__init__.py in <module>
      4                      string_to_rgb, PARAVIEW_BACKGROUND)
      5 from .export_vtkjs import export_plotter_vtkjs, get_vtkjs_url
----> 6 from .helpers import plot, plot_arrows, plot_compare_four, plot_itk
      7 from .itkplotter import PlotterITK
      8 from .plotting import BasePlotter, Plotter, close_all

/srv/conda/envs/notebook/lib/python3.8/site-packages/pyvista/plotting/helpers.py in <module>
      5 
      6 import pyvista
----> 7 from pyvista.utilities import is_pyvista_dataset, assert_empty_kwargs
      8 from .plotting import Plotter
      9 from .theme import rcParams

/srv/conda/envs/notebook/lib/python3.8/site-packages/pyvista/utilities/__init__.py in <module>
      1 """Utilities routines."""
----> 2 from .errors import (GPUInfo, Observer, Report,
      3                      assert_empty_kwargs, get_gpu_info, send_errors_to_logging,
      4                      set_error_output_file, check_valid_vector)
      5 from .features import *

/srv/conda/envs/notebook/lib/python3.8/site-packages/pyvista/utilities/errors.py in <module>
     10 
     11 import pyvista
---> 12 from pyvista import _vtk
     13 
     14 def set_error_output_file(filename):

/srv/conda/envs/notebook/lib/python3.8/site-packages/pyvista/_vtk.py in <module>
     38     from vtkmodules.vtkRenderingVolume import (vtkFixedPointVolumeRayCastMapper,
     39                                                vtkGPUVolumeRayCastMapper)
---> 40     from vtkmodules.vtkRenderingVolumeOpenGL2 import (vtkOpenGLGPUVolumeRayCastMapper,
     41                                                       vtkSmartVolumeMapper)
     42     from vtkmodules.vtkRenderingOpenGL2 import (vtkOpenGLHardwareSelector,

ImportError: libGL.so.1: cannot open shared object file: No such file or directory

I realize that a full install of pyvista is probably making the notebook image huge, but is there a way to install those dependencies, so that users can install a running pyvista version?

I found this issue (https://github.com/conda-forge/pygridgen-feedstock/issues/10#issuecomment-365914605) raised by @rsignell-usgs, but I wasn't able to use apt due to a permission error:

apt install libgl1-mesa-glx
E: Could not open lock file /var/lib/dpkg/lock-frontend - open (13: Permission denied)
E: Unable to acquire the dpkg frontend lock (/var/lib/dpkg/lock-frontend), are you root?

Any help with this would be greatly appreciated.

jbusecke commented 3 years ago

I just tried it on the AWS deployment and the issue is the same, just FYI.

scottyhq commented 3 years ago

@jbusecke if you need to install ubuntu packages via apt with root permissions you have to build a new image, so you can either create a PR editing this file:

https://github.com/pangeo-data/pangeo-docker-images/blob/master/pangeo-notebook/apt.txt

As you mention we'd want to be wary of additions with very complex dependencies and large size.

Another thing you can try is creating a binder-enabled repo to try things out, at some point there will probably be a 'bring-your-own conda environment or full docker image' capability on the hubs... https://github.com/pangeo-data/pangeo-binder-template

jbusecke commented 3 years ago

Another thing you can try is creating a binder-enabled repo to try things out, at some point there will probably be a 'bring-your-own conda environment or full docker image' capability on the hubs... https://github.com/pangeo-data/pangeo-binder-template

Oh that's a great idea! Ill explore that first and see how it goes!

benbovy commented 2 years ago

Looks like this is fixed in pyvista 0.34.1. This version will hopefully be available soon on conda-forge (https://github.com/conda-forge/pyvista-feedstock/pull/59).

EDIT: nope, there are still imports like here that will fail.