gempy icon indicating copy to clipboard operation
gempy copied to clipboard

kernel issue when plot3d

Open chandpes opened this issue 2 years ago • 20 comments

Describe the bug When running gempy on Jupyter notebook , it doesn't plot 3d or 2d plot somehow. I have tried the same code on MS EDGE, Mozilla, and Chrome but issue is still the same could suggest my to resolve this issue.

To Reproduce I have attached the screenshot of the issue.

Expected behavior A clear and concise description of what you expected to happen.

Screenshots image

Desktop (please complete the following information):

  • OS: (e.g. iOS) - Windows
  • GemPy Version 2.2.8
    • if installed via pip: provide GemPy version (e.g. 2.0.1)
    • if cloned from GitHub: provide Git commit id (e.g. 839bf85f)
  • Jupyter Version (if applicable) 3.7.8

Additional context Add any other context about the problem @here.

chandpes avatar Mar 08 '22 16:03 chandpes

Hi @chandpes

the 3D plot should open in a python window outside of your jupyter notebook. From the screenshot you provided, I cannot diagnose any error. For the plot_2d, did you add a magic function for matplotlib to plot in the notebook, e.g. %matplotlib inline ?

Best Jan

Japhiolite avatar Mar 08 '22 18:03 Japhiolite

Hi Jan, Yes, I have added %matplotlib inline Still it doesn’t work.

Thanks & regards Subhash Chandra

On 9 Mar 2022, at 2:38 am, Jan Niederau @.***> wrote:

 Hi @chandpes

the 3D plot should open in a python window outside of your jupyter notebook. From the screenshot you provided, I cannot diagnose any error. For the plot_2d, did you add a magic function for matplotlib to plot in the notebook, e.g. %matplotlib inline ?

Best Jan

— Reply to this email directly, view it on GitHub, or unsubscribe. Triage notifications on the go with GitHub Mobile for iOS or Android. You are receiving this because you were mentioned.

chandpes avatar Mar 08 '22 23:03 chandpes

Hi @chandpes without further information, I cannot diagnose any error, as your screenshot does not show an error at all.

Japhiolite avatar Mar 10 '22 17:03 Japhiolite

I'm trying to run this example and it happens with me too. Kernel dies after running plot_2d function, and then can't run plot_3d. image

This is the output after trying plot_2d

image

I have imported all these libraries, including %matplotlib inline


import gempy as gp
import numpy as np
import pandas as pd
import matplotlib.pyplot as plt
import os

np.random.seed(1515)
pd.set_option('precision',2)

%matplotlib inline

Desktop (please complete the following information):

  • OS: (e.g. iOS) - Pop OS 21.10 (Linux - Ubuntu based)
  • GemPy Version 2.2.10 installed via pip
  • Jupyter Version (if applicable) 3.2.4

rodreras avatar Mar 11 '22 20:03 rodreras

I ran the tutorial in the python shell, and I had the same error after plotting the 2D image. The message was this:

libGL error: MESA-LOADER: failed to open iris: /usr/lib/dri/iris_dri.so: não é possível abrir arquivo compartilhado: Arquivo ou diretório inexistente (search paths /usr/lib/x86_64-linux-gnu/dri:\$${ORIGIN}/dri:/usr/lib/dri, suffix _dri)
libGL error: failed to load driver: iris
libGL error: MESA-LOADER: failed to open iris: /usr/lib/dri/iris_dri.so: não é possível abrir arquivo compartilhado: Arquivo ou diretório inexistente (search paths /usr/lib/x86_64-linux-gnu/dri:\$${ORIGIN}/dri:/usr/lib/dri, suffix _dri)
libGL error: failed to load driver: iris
libGL error: MESA-LOADER: failed to open swrast: /usr/lib/dri/swrast_dri.so: não é possível abrir arquivo compartilhado: Arquivo ou diretório inexistente (search paths /usr/lib/x86_64-linux-gnu/dri:\$${ORIGIN}/dri:/usr/lib/dri, suffix _dri)
libGL error: failed to load driver: swrast
2022-03-11 17:40:45.959 (   3,022s) [        11FA3300]vtkXOpenGLRenderWindow.:651    ERR| vtkXOpenGLRenderWindow (0x55568290e930): Cannot create GLX context.  Aborting.
ERROR:root:Cannot create GLX context.  Aborting.
Fatal Python error: Aborted

Current thread 0x00007f0911fa3300 (most recent call first):
  File "/home/rodrigo/anaconda3/envs/geospatial/lib/python3.8/site-packages/pyvista/plotting/plotting.py", line 1192 in render
  File "/home/rodrigo/anaconda3/envs/geospatial/lib/python3.8/site-packages/pyvista/plotting/plotting.py", line 4844 in show
  File "/home/rodrigo/anaconda3/envs/geospatial/lib/python3.8/site-packages/gempy/plot/plot_api.py", line 353 in plot_3d
  File "geomodel.py", line 53 in <module>
Abortado (imagem do núcleo gravada)

rodreras avatar Mar 11 '22 20:03 rodreras

@rodreras can you check if pyvista is working and you're able to visualize one of their examples? To me, it currently looks like a libgl problem in your case.

Japhiolite avatar Mar 11 '22 21:03 Japhiolite

Hi @rodreras Are there any updates? did you try running pyvista?

Japhiolite avatar Mar 15 '22 14:03 Japhiolite

Hi @rodreras Are there any updates? did you try running pyvista?

Hey! I was out on a field work. Today as soon as I get back to the office I'll try running it.

rodreras avatar Mar 15 '22 14:03 rodreras

I have the same issue here running the Docker image (leguark/gempy). I would love to get started with this beautiful package ;-)

snakesonabrain avatar Mar 22 '22 15:03 snakesonabrain

Do you also get the GLX error @snakesonabrain ?

@rodreras any progress with running PyVista examples ?

Japhiolite avatar Mar 22 '22 15:03 Japhiolite

Do you also get the GLX error @snakesonabrain ?

@rodreras any progress with running PyVista examples ?

No, just a Kernel Died dialog

snakesonabrain avatar Mar 22 '22 15:03 snakesonabrain

Do you also get the GLX error @snakesonabrain ?

@rodreras any progress with running PyVista examples ?

I'm on my way back to the office right now. I'm going to try installing in a separated environment. I think you might be right about the pyvista lib. Last week I tried running the examples, but I had issues.

rodreras avatar Mar 22 '22 15:03 rodreras

Do you also get the GLX error @snakesonabrain ? @rodreras any progress with running PyVista examples ?

No, just a Kernel Died dialog

Does 2D plotting work, or does the kernel also die using 2d plots?

Japhiolite avatar Mar 22 '22 15:03 Japhiolite

Do you also get the GLX error @snakesonabrain ? @rodreras any progress with running PyVista examples ?

No, just a Kernel Died dialog

Does 2D plotting work, or does the kernel also die using 2d plots?

Just the 3D, 2D plots work just fine

snakesonabrain avatar Mar 22 '22 15:03 snakesonabrain

@snakesonabrain thanks for the quick reply. Do you run your model code in a notebook? If so, and if you use the magic function %matplotlib inline in the beginning, could you change that to %matplotlib qt5 and see, if the kernel/notebook survives that or dies after you run the cell?

Japhiolite avatar Mar 22 '22 15:03 Japhiolite

I am running notebooks. When I use the %matplotlib qt5 command, I get another error: Cannot load backend 'Qt5Agg' which requires the 'qt5' interactive framework, as 'headless' is currently running

snakesonabrain avatar Mar 22 '22 15:03 snakesonabrain

I am running notebooks. When I use the %matplotlib qt5 command, I get another error: Cannot load backend 'Qt5Agg' which requires the 'qt5' interactive framework, as 'headless' is currently running

Alright, then in your case this could be the source of error. We need qt5, i.e. pyqt5 for the 3D plots.

Japhiolite avatar Mar 22 '22 15:03 Japhiolite

In case you run it on windows and use conda, you could use this yml to create an environment which should work for gempy https://github.com/Japhiolite/environments/blob/master/environment_gempy_windows.yml

Japhiolite avatar Mar 22 '22 16:03 Japhiolite

Tried to create the conda environment from the .yml file on both Mac and Windows but got errors during the Theano function compilation on both platforms. On Windows, the error message is this:

Error: invalid register for .seh_savexmm\r. ', '[Elemwise{lt,no_inplace}(<TensorType(float64, matrix)>, <TensorType(float64, (True, True))>)]

The idea of working with Docker images is probably a more robust solution but then the issue with plotting using the pyqt5 backend needs to be resolved.

snakesonabrain avatar Mar 22 '22 17:03 snakesonabrain

I assume, your theano installation isn't working as intended. In your conda environment, make sure to have installed theano via conda on windows. Theano requires a couple of other libraries. From the theano installation: conda install numpy scipy mkl-service libpython <m2w64-toolchain> pytest <sphinx> <pydot-ng> <git>

Japhiolite avatar Mar 22 '22 20:03 Japhiolite