NEURON and MATLAB on Mac

Post Reply
neuromau
Posts: 95
Joined: Mon Apr 20, 2009 7:02 pm

NEURON and MATLAB on Mac

Post by neuromau » Thu Sep 17, 2015 12:25 pm

Hello, I have just started using a Mac with Yosemite 10.10.5, but I am having a little NEURON trouble (or maybe it's actually MATLAB trouble?).

I installed NEURON 7.4 and it is working fine. But then when I try to run it from MATLAB 2015a using a system call (which I can do just fine in Linux or Windows), I am having trouble. Here's what happens:
NEURON -- Release 7.4 (1341:2ccabed20677) 2ccabed20677
Duke, Yale, and the BlueBrain Project -- Copyright 1984-2015
See http://www.neuron.yale.edu/neuron/credits

oc>load_file("nrngui.hoc")

nrniv: Couldn't find: nrngui.hoc

near line 1

load_file("nrngui.hoc")

^

0
Even though I can see it exists at /Applications/NEURON-7.4/nrn/share/nrn/lib/hoc/nrngui.hoc and invoking NEURON from Mac's Terminal works just fine and gives no error. If I define the whole path to the file, I get a Python error (I didn't think I was invoking Python, though I did do the standard Mac install which I guess installs NEURON with Python?):
oc>load_file("/Applications/NEURON-7.4/nrn/share/nrn/lib/hoc/nrngui.hoc")

first instance of j

first instance of itmp

first instance of using_cvode_

first instance of movie_frame_dur_

first instance of realtime

first instance of running_

first instance of rtstart

first instance of stdrun_quiet

first instance of screen_update_invl

first instance of tstop

first instance of steps_per_ms

first instance of nstep_steprun

first instance of runStopAt

first instance of runStopIn

first instance of global_ra

first instance of mapped_nrnmainmenu_

first instance of v_init

first instance of n_graph_lists

first instance of i

first instance of eventslow

first instance of eventcount

first instance of cnt

Traceback (most recent call last):

File "<string>", line 1, in <module>

ImportError: No module named neuron

1
Here are my current environmental variables (I've tried a lot of combinations of these, but apparently just not the right one):
>> disp(getenv('PATH'))
/usr/local/bin:/usr/local/bin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/opt/X11/bin:/Library/TeX/texbin:/Applications/NEURON-7.4/nrn/x86_64/bin:/Applications/NEURON-7.4/nrn/x86_64/bin
>> disp(getenv('PYTHONPATH'))
/System/Library/Frameworks/Python.framework/Versions/2.7/lib
>> disp(getenv('PYTHONHOME'))
/System/Library/Frameworks/Python.framework/Versions/2.7
>> disp(getenv('NEURONHOME'))
/Applications/NEURON-7.4/nrn/x86_64/bin
>> disp(getenv('N'))
/Applications/NEURON-7.4/nrn/x86_64/bin
And here is a bash script I call when issuing system commands from MATLAB or launching Mac's Terminal:

Code: Select all

export PATH=/usr/local/bin:$PATH:/Applications/NEURON-7.4/nrn/x86_64/bin
export PYTHONPATH=/System/Library/Frameworks/Python.framework/Versions/2.7/lib
export PYTHONHOME=/System/Library/Frameworks/Python.framework/Versions/2.7
export NEURONHOME=/Applications/NEURON-7.4/nrn/x86_64/bin
export N=/Applications/NEURON-7.4/nrn/x86_64/bin

hines
Site Admin
Posts: 1527
Joined: Wed May 18, 2005 3:32 pm

Re: NEURON and MATLAB on Mac

Post by hines » Thu Sep 17, 2015 4:29 pm

The NEURONHOME environment variable is incorrect. If it exists at all, it should be /Applications/NEURON-7.4/nrn/share/nrn
At any rate, without that variable, what is the result, after a launch, of the hoc function
print neuronhome()

I believe this is irrelevant, but if you launch python and wish to import neuron they your PYTHONPATH should also contain
/Applications/NEURON-7.4/nrn/lib/python
but check to see if that is lib64 or lib.
You might try unsetting the NEUROHOME, PYTHONPATH, and PYTHONHOME variables and see what is suggested by executing
nrnpyenv.sh

neuromau
Posts: 95
Joined: Mon Apr 20, 2009 7:02 pm

Re: NEURON and MATLAB on Mac

Post by neuromau » Tue Sep 22, 2015 10:26 am

The NEURONHOME environment variable is incorrect. If it exists at all, it should be /Applications/NEURON-7.4/nrn/share/nrn
That was it, everything works fine after setting NEURONHOME correctly!
At any rate, without that variable, what is the result, after a launch, of the hoc function
print neuronhome()
This turns up blank if I have not set NEURONHOME environmental variable

Thank you for the PYTHONPATH info. I have added that to my variable as I will want to experiment with python and NEURON soon.

Thank you, Michael!

Post Reply