NEURON Python segmentation fault on OSX

Anything that doesn't fit elsewhere.
Post Reply
rgerkin
Posts: 10
Joined: Fri Oct 06, 2017 11:38 am

NEURON Python segmentation fault on OSX

Post by rgerkin »

On OSX (fresh installation of NEURON 7.5 but similar results with 7.4), but not on Linux, I observe the following problem with a python file LEMS_2007One_nrn.py (source here https://gist.github.com/rgerkin/e4867fb ... e9e2f88d2e)

Code: Select all

import LEMS_2007One_nrn # runs fine
however...

Code: Select all

def foo():
  import LEMS_2007One_nrn
foo() # produces a segmentation fault.
I imagine it has something to do with the function exiting and not cleaning up memory allocated by the import, which was properly cleaned up when the import was done outside a function. I don't have this problem in Linux, only in OSX. However, it is preventing me from doing NEURON-related development on my Mac. The LEMS_2007One_nrn.py file was auto-generated from a LEMS file by jNeuroML using the NEURON export feature.
hines
Site Admin
Posts: 1682
Joined: Wed May 18, 2005 3:32 pm

Re: NEURON Python segmentation fault on OSX

Post by hines »

I'm afraid I am not able to reproduce the error on my mac air Sierra 10.12.8
However, there could be a problem with line 24
h.load_file("nrngui.hoc")
as graphics on a python launch requires that graphics be in a separate thread. So instead use
from neuron import gui
That is even more important when running on mswin.
Not exactly a bug, but I do not recommend doing a lot of hoc statements from within python that create variable names in hoc as it can pollute the hoc namespace.
Stay in the python world as much as possible and use h mostly to make method calls.

What python are you using.
Post Reply