brainrender icon indicating copy to clipboard operation
brainrender copied to clipboard

Segmentation fault on example

Open AntonioST opened this issue 2 years ago • 4 comments

Describe the bug Get a Segmentation fault (core dumped) or terminated by signal SIGSEGV (Address boundary error) when run an example with python. However, if I try is new conda environment to reproduce the error, I got un-stopped process, then I need to kill it.

To Reproduce First tell us which version of brainrender and vedo you're using and something about your system (e.g. OS etc).

$ uname -srm
Linux 5.16.14-arch1-1 x86_64
# Name                    Version                   Build  Channel
python                    3.8.12               h12debd9_0
brainrender               2.0.4.7                  pypi_0    pypi
vedo                      2021.0.5                 pypi_0    pypi

Then tell us the steps to reproduce the behavior:

  1. cd examples
  2. python add_cells.py
  3. wait it opened, then press 'q' or click close to exit
  4. See error or process is not stopped.

Expected behavior

exit with code 0

AntonioST avatar Mar 20 '22 16:03 AntonioST

Hi,

I've never seen this error before. Given that you don't get it with a fresh environment I think it might be something wrong with your steup. If you crate a new python 3.7 environment and just install brainrender?

FedeClaudi avatar Mar 20 '22 18:03 FedeClaudi

It seems no more SIGSEGV in python 3.7.11 , but there are others problems happened when I create a fresh environment:

  1. If I install brainrender by pip install brainrender. I got vedo installed with version 2022.1.0. If I ran the example, I got this error:
╭─────────────────────────────── Traceback (most recent call last) ────────────────────────────────╮
│                                                                                                  │
│ .../brainrender/examples/add_cells.py:29 in <module>           │
│                                                                                                  │
│   26 │   return np.vstack(random.choices(ipts, k=N))                                             │
│   27                                                                                             │
│   28                                                                                             │
│ ❱ 29 scene = Scene(title="Labelled cells")                                                       │
│   30                                                                                             │
│   31 # Get a numpy array with (fake) coordinates of some labelled cells                          │
│   32 mos = scene.add_brain_region("MOs", alpha=0.15)                                             │
│.../.conda/envs/test/lib/python3.7/site-packages/brainrender/scene.py:50 in __init__   │
│                                                                                                  │
│    47 │   │   logger.debug(                                                                      │
│    48 │   │   │   f"Creating scene with parameters: root: {root}, atlas_name: '{atlas_name}'',   │
│    49 │   │   )                                                                                  │
│ ❱  50 │   │   JupyterMixIn.__init__(self)                                                        │
│    51 │   │                                                                                      │
│    52 │   │   self.actors = []  # stores all actors in the scene                                 │
│    53 │   │   self.labels = []  # stores all `labels` actors in scene                            │
│                                                                                                  │
│ .../.conda/envs/test/lib/python3.7/site-packages/brainrender/_jupyter.py:12 in         │
│ __init__                                                                                         │
│                                                                                                  │
│    9 class JupyterMixIn:  # pragma: no cover                                                     │
│   10 │   def __init__(self):  # pragma: no cover                                                 │
│   11 │   │   # keep track if we are in a jupyter notebook                                        │
│ ❱ 12 │   │   if vedo.settings.notebookBackend == "k3d":                                          │
│   13 │   │   │   self.backend = "k3d"                                                            │
│   14 │   │   elif vedo.settings.notebookBackend == "itkwidgets":                                 │
│   15 │   │   │   self.backend = "itkwidgets"                                                     │
│                                                                                                  │
│ .../.conda/envs/test/lib/python3.7/site-packages/vedo/utils.py:238 in __getattr__      │
│                                                                                                  │
│    235 │   │   │   │   self[k] = dotdict(v)                                                      │
│    236 │                                                                                         │
│    237 │   def __getattr__(self, k):                                                             │
│ ❱  238 │   │   return self[k]                                                                    │
│    239 │                                                                                         │
│    240 │   def __setattr__(self, k, v):                                                          │
│    241 │   │   if self.warn_on_setting:                                                          │
╰──────────────────────────────────────────────────────────────────────────────────────────────────╯
KeyError: 'notebookBackend'
Exception ignored in: <function Scene.__del__ at 0x7facc1d818c0>
Traceback (most recent call last):
  File ".../.conda/envs/test/lib/python3.7/site-packages/brainrender/scene.py", line 102, in __del__
    self.close()
  File ".../.conda/envs/test/lib/python3.7/site-packages/brainrender/render.py", line 281, in close
    self.plotter.close()
AttributeError: 'NoneType' object has no attribute 'close'

I need to downgrade vedo to 2021.0.5.

  1. If I retested the same steps but with the python 3.8.11 . I got error
Traceback (most recent call last):
  File "add_cells.py", line 4, in <module>
    from brainrender import Scene
ModuleNotFoundError: No module named 'brainrender'

If I installed from source code python setup.py install, I got the an un-stopped process.

AntonioST avatar Mar 21 '22 23:03 AntonioST

hi, is this still an issue?

FedeClaudi avatar Jul 04 '22 08:07 FedeClaudi

Yes, I got un-stopped process after I typed q to close the window.

# Name                    Version                   Build  Channel
python                    3.8.13               h12debd9_0
brainrender               2.0.5.3                  pypi_0    pypi
vedo                      2021.0.5                 pypi_0    pypi

AntonioST avatar Jul 15 '22 13:07 AntonioST

Thanks a lot for reporting this @AntonioST ! I believe this is fixed now - at least on the current development branch mega-fix (we're planning a new release very soon) - so I will close. Note that we now support Python 3.9, 3.10 and 3.11 (as per NEP 29)

If you have time to double-check and report back here, that would be great.

alessandrofelder avatar Nov 28 '23 16:11 alessandrofelder