Intel MKL Fatal error when executing HOC file

Post Reply
sangwonc
Posts: 10
Joined: Sun Nov 07, 2021 7:13 pm

Intel MKL Fatal error when executing HOC file

Post by sangwonc »

Hi, I hope you are doing well.

I am new to NEURON, and recently, I've run into some problems when trying to execute a HOC file. For some context, I am running NEURON 8.0.0 on macOS BigSur 11.6 on Intel MacBook Pro.

When I tried to execute the following code:
load_file("nrngui.hoc")

// Loads all celltypes from celltypes.txt, etc.
load_file("makecells_Axons.hoc")

// Plot output of CBCs, Aiis, and GCs separately
load_file("plot_Axons_IClamp_Axon.ses")

// Apply stimulation
load_file("Stim_Axon_TimeCourse.hoc")// Loads voltages for each compartment (from running 'interp3') and applies using 'extracellular'
//load_file("Stim_Axon_Auto_Asym.hoc")


I get the following output with an error:
-e
NEURON -- VERSION 8.0.0 release/8.0 (429d11ef3) 2021-04-30
Duke, Yale, and the BlueBrain Project -- Copyright 1984-2021
See http://neuron.yale.edu/neuron/credits

loading membrane mechanisms from /Users/sangwoncha/Downloads/Nrn-3/x86_64/.libs/libnrnmech.so
Additional mechanisms from files
"INaP.mod" "IT.mod" "I_Leak.mod" "Ih.mod" "capump.mod" "spike.mod"
INTEL MKL ERROR: dlopen(/Users/sangwoncha/opt/anaconda3/lib/libmkl_intel_thread.1.dylib, 9): Library not loaded: @rpath/libiomp5.dylib
Referenced from: /Users/sangwoncha/opt/anaconda3/lib/libmkl_intel_thread.1.dylib
Reason: image not found.
Intel MKL FATAL ERROR: Cannot load libmkl_intel_thread.1.dylib.
nrngui exit status was 2
Press return key to exit
It returns "Intel MKL FATAL Error." I looked into this and found a stack overflow thread that addresses the same type of error: https://stackoverflow.com/questions/366 ... mkl-def-so

One of the answers suggested to execute the following lines:
conda install nomkl numpy scipy scikit-learn numexpr
conda remove mkl mkl-service
However, my MacBook could not execute the first line and spat out the following error message:
UnsatisfiableError: The following specifications were found
to be incompatible with the existing python installation in your environment:

Specifications:

- alabaster -> python[version='>=2.7,<2.8.0a0|>=3.6,<3.7.0a0|>=3.7,<3.8.0a0|>=3.5,<3.6.0a0']
- anaconda==2021.05 -> python[version='3.7.10|3.9.4|3.8.8',build='h88f2d9e_5|h88f2d9e_0']
- appdirs -> python[version='>=2.7,<2.8.0a0|>=3.5,<3.6.0a0|>=3.6,<3.7.0a0|>=3.7,<3.8.0a0']
- argon2-cffi -> python[version='>=2.7,<2.8.0a0|>=3.5,<3.6.0a0']
- astroid -> python[version='>=3.10,<3.11.0a0']
- atomicwrites -> python[version='>=2.7,<2.8.0a0|>=3.6,<3.7.0a0|>=3.7,<3.8.0a0|>=3.5,<3.6.0a0']
- attrs -> python[version='>=2.7,<2.8.0a0|>=3.6,<3.7.0a0|>=3.7,<3.8.0a0|>=3.5,<3.6.0a0']
- autopep8 -> python[version='>=2.7,<2.8.0a0|>=3.6,<3.7.0a0|>=3.7,<3.8.0a0|>=3.5,<3.6.0a0']
- backports -> python[version='>=2.7,<2.8.0a0|>=3.5,<3.6.0a0|>=3.7,<3.8.0a0|>=3.6,<3.7.0a0']
- backports.functools_lru_cache -> python[version='>=2.7,<2.8.0a0']
- bkcharts -> python[version='>=3.7.1,<3.8.0a0']
- brotlipy -> python[version='>=2.7,<2.8.0a0|>=3.5,<3.6.0a0']
- clyent -> python[version='>=3.10,<3.11.0a0']
- colorama -> python[version='>=2.7,<2.8.0a0|>=3.6,<3.7.0a0|>=3.7,<3.8.0a0|>=3.5,<3.6.0a0']
- conda-verify -> python[version='>=2.7,<2.8.0a0|>=3.6,<3.7.0a0|>=3.7,<3.8.0a0|>=3.5,<3.6.0a0']
- contextlib2 -> python[version='>=2.7,<2.8.0a0|>=3.5,<3.6.0a0|>=3.6,<3.7.0a0|>=3.7,<3.8.0a0']
- cython -> python[version='>=3.10,<3.11.0a0']
- defusedxml -> python[version='>=2.7,<2.8.0a0|>=3.5,<3.6.0a0|>=3.6,<3.7.0a0|>=3.7,<3.8.0a0']
- flake8 -> python[version='>=3.10,<3.11.0a0|>=3.9,<3.10.0a0']
- gevent -> python[version='>=3.10,<3.11.0a0']
- glob2 -> python[version='>=2.7,<2.8.0a0|>=3.7,<3.8.0a0|>=3.6,<3.7.0a0|>=3.5,<3.6.0a0']
- h5py -> python[version='<3']
- html5lib -> python[version='>=2.7,<2.8.0a0|>=3.5,<3.6.0a0|>=3.7,<3.8.0a0|>=3.6,<3.7.0a0']
- imageio -> python[version='>=3.9,<3.10.0a0']
- imagesize -> python[version='>=2.7,<2.8.0a0|>=3.5,<3.6.0a0|>=3.6,<3.7.0a0|>=3.7,<3.8.0a0']
- ipywidgets -> python[version='>=2.7,<2.8.0a0|>=3.6,<3.7.0a0|>=3.7,<3.8.0a0|>=3.5,<3.6.0a0']
- isort -> python[version='>=3.10,<3.11.0a0|>=3.9,<3.10.0a0']
- jdcal -> python[version='>=2.7,<2.8.0a0|>=3.5,<3.6.0a0|>=3.7,<3.8.0a0|>=3.6,<3.7.0a0']
- jsonschema -> python[version='>=3.10,<3.11.0a0']
- mock -> python[version='>=3.9,<3.10.0a0']
- more-itertools -> python[version='>=3.9,<3.10.0a0']
- nose -> python[version='>=3.10,<3.11.0a0|>=3.9,<3.10.0a0']
- numba -> python[version='3.4.*|>=3.10,<3.11.0a0']
- olefile -> python[version='>=2.7,<2.8.0a0|>=3.5,<3.6.0a0|>=3.6,<3.7.0a0|>=3.7,<3.8.0a0']
- path -> python[version='>=2.7,<2.8.0a0']
- pickleshare -> python[version='>=3.9,<3.10.0a0']
- prometheus_client -> python[version='>=2.7,<2.8.0a0|>=3.7,<3.8.0a0|>=3.6,<3.7.0a0|>=3.5,<3.6.0a0']
- pycparser -> python[version='>=2.7,<2.8.0a0|>=3.6,<3.7.0a0|>=3.5,<3.6.0a0|>=3.7,<3.8.0a0']
- pyflakes -> python[version='>=3.10,<3.11.0a0|>=3.9,<3.10.0a0']
- pyopenssl -> python[version='>=3.9,<3.10.0a0']
- pyrsistent -> python[version='>=3.5,<3.6.0a0']
- python-dateutil -> python[version='>=2.7,<2.8.0a0|>=3.6,<3.7.0a0|>=3.7,<3.8.0a0|>=3.5,<3.6.0a0']
- pytz -> python[version='>=2.7,<2.8.0a0|>=3.6,<3.7.0a0|>=3.7,<3.8.0a0|>=3.5,<3.6.0a0']
- qtpy -> python[version='>=2.7,<2.8.0a0|>=3.6,<3.7.0a0|>=3.7,<3.8.0a0|>=3.5,<3.6.0a0']
- rope -> python[version='>=2.7,<2.8.0a0|>=3.6,<3.7.0a0|>=3.7,<3.8.0a0|>=3.5,<3.6.0a0']
- singledispatch -> python[version='>=3.9,<3.10.0a0']
- sniffio -> python[version='>=3,<3.7']
- snowballstemmer -> python[version='>=2.7,<2.8.0a0|>=3.5,<3.6.0a0|>=3.6,<3.7.0a0|>=3.7,<3.8.0a0']
- sortedcollections -> python[version='>=2.7,<2.8.0a0|>=3.6,<3.7.0a0|>=3.7,<3.8.0a0|>=3.5,<3.6.0a0']
- sphinxcontrib-websupport -> python[version='>=2.7,<2.8.0a0|>=3.5,<3.6.0a0|>=3.6,<3.7.0a0|>=3.7,<3.8.0a0']
- statsmodels -> python[version='>=3.7.1,<3.8.0a0']
- sympy -> python[version='>=3.10,<3.11.0a0']
- tblib -> python[version='>=2.7,<2.8.0a0|>=3.5,<3.6.0a0|>=3.6,<3.7.0a0|>=3.7,<3.8.0a0']
- tifffile -> python[version='>=2.7,<2.8.0a0|>=3.9,<3.10.0a0|>=3.5,<3.6.0a0']
- tornado -> python[version='>=3.10,<3.11.0a0']
- typing_extensions -> python[version='>=3.9,<3.10.0a0']
- watchdog -> python[version='>=3.5,<3.6.0a0']
- wheel -> python[version='>=3.10,<3.11.0a0|>=3.9,<3.10.0a0']
- wurlitzer -> python[version='<3.4']
- xlrd -> python[version='>=2.7,<2.8.0a0|>=3.6,<3.7.0a0|>=3.7,<3.8.0a0|>=3.5,<3.6.0a0']
- xlsxwriter -> python[version='>=2.7,<2.8.0a0|>=3.7,<3.8.0a0|>=3.6,<3.7.0a0|>=3.5,<3.6.0a0']
- xmltodict -> python[version='>=2.7,<2.8.0a0|>=3.5,<3.6.0a0|>=3.6,<3.7.0a0|>=3.7,<3.8.0a0']
- yapf -> python[version='>=2.7,<2.8.0a0|>=3.7,<3.8.0a0|>=3.6,<3.7.0a0|>=3.5,<3.6.0a0']
- zict -> python[version='>=2.7,<2.8.0a0|>=3.6,<3.7.0a0|>=3.7,<3.8.0a0|>=3.5,<3.6.0a0']
- zope.event -> python[version='>=3.10,<3.11.0a0|>=3.5,<3.6.0a0']
- zope.interface -> python[version='>=3.10,<3.11.0a0']

Your python: python=3.8

If python is on the left-most side of the chain, that's the version you've asked for.
When python appears to the right, that indicates that the thing on the left is somehow
not available for the python version you are constrained to. Note that conda will not
change your python version to a different minor version unless you explicitly specify
that.

The following specifications were found to be incompatible with each other:

Output in format: Requested package -> Available versions

Package openssl conflicts for:
sphinxcontrib-qthelp -> python[version='>=3.5'] -> openssl[version='1.0.*|>=1.0.2m,<1.0.3a|>=1.0.2n,<1.0.3a|>=1.0.2o,<1.0.3a|>=1.1.1a,<1.1.2a|>=1.1.1b,<1.1.2a|>=1.1.1c,<1.1.2a|>=1.1.1d,<1.1.2a|>=1.1.1e,<1.1.2a|>=1.1.1g,<1.1.2a|>=1.1.1h,<1.1.2a|>=1.1.1i,<1.1.2a|>=1.1.1j,<1.1.2a|>=1.1.1k,<1.1.2a|>=1.1.1l,<1.1.2a|>=1.0.2l,<1.0.3a|>=1.0.2p,<1.0.3a']
iniconfig -> python -> openssl[version='1.0.*|>=1.0.2m,<1.0.3a|>=1.0.2n,<1.0.3a|>=1.0.2o,<1.0.3a|>=1.1.1a,<1.1.2a|>=1.1.1b,<1.1.2a|>=1.1.1c,<1.1.2a|>=1.1.1d,<1.1.2a|>=1.1.1e,<1.1.2a|>=1.1.1g,<1.1.2a|>=1.1.1h,<1.1.2a|>=1.1.1i,<1.1.2a|>=1.1.1j,<1.1.2a|>=1.1.1k,<1.1.2a|>=1.1.1l,<1.1.2a|>=1.0.2l,<1.0.3a|>=1.0.2p,<1.0.3a']
flask -> python[version='>=3.6'] -> openssl[version='1.0.*|>=1.0.2m,<1.0.3a|>=1.0.2n,<1.0.3a|>=1.0.2o,<1.0.3a|>=1.1.1a,<1.1.2a|>=1.1.1b,<1.1.2a|>=1.1.1c,<1.1.2a|>=1.1.1d,<1.1.2a|>=1.1.1e,<1.1.2a|>=1.1.1g,<1.1.2a|>=1.1.1h,<1.1.2a|>=1.1.1i,<1.1.2a|>=1.1.1j,<1.1.2a|>=1.1.1k,<1.1.2a|>=1.1.1l,<1.1.2a|>=1.0.2l,<1.0.3a|>=1.0.2p,<1.0.3a']
backports.weakref -> python -> openssl[version='1.0.*|>=1.0.2m,<1.0.3a|>=1.0.2n,<1.0.3a|>=1.0.2o,<1.0.3a|>=1.1.1a,<1.1.2a|>=1.1.1b,<1.1.2a|>=1.1.1c,<1.1.2a|>=1.1.1d,<1.1.2a|>=1.1.1e,<1.1.2a|>=1.1.1g,<1.1.2a|>=1.1.1h,<1.1.2a|>=1.1.1i,<1.1.2a|>=1.1.1j,<1.1.2a|>=1.1.1k,<1.1.2a|>=1.1.1l,<1.1.2a|>=1.0.2l,<1.0.3a|>=1.0.2p,<1.0.3a']
testpath -> python[version='>=3.6'] -> openssl[version='1.0.*|>=1.0.2m,<1.0.3a|>=1.0.2n,<1.0.3a|
and goes on to list various elements of my environment that is incompatible with 'nomkl.' One of the answers to the stack overflow thread linked above suggest that the problem lies with Anaconda. None of my lab members encountered this problem before and therefore was not able to help. At this point, being completely new to this kind of stuff, I feel very lost and have no idea what I am doing. Any input/help in troubleshooting this would be appreciated.

P.S. Since I am new to using command-line interface and NEURON, I hope that you understand that I may get some of the terminology mixed up here and there. I will try my best to follow along and provide any information on my end that may be helpful in addressing this issue.
hines
Site Admin
Posts: 1636
Joined: Wed May 18, 2005 3:32 pm

Re: Intel MKL Fatal error when executing HOC file

Post by hines »

This may take a few back and forth questions/answers. From a terminal window, what is the output of
which nrniv
lipo -arches /Applications/NEURON/bin/nrniv
/Applications/NEURON/bin/nrniv -nopython
sangwonc
Posts: 10
Joined: Sun Nov 07, 2021 7:13 pm

Re: Intel MKL Fatal error when executing HOC file

Post by sangwonc »

Hello,

This is the output:
(base) sangwoncha@Sangwons-MacBook-Pro ~ % which nrniv
/Applications/NEURON/x86_64/bin/nrniv
(base) sangwoncha@Sangwons-MacBook-Pro ~ % lipo -arches /Applications/NEURON/bin/nrniv
fatal error: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/lipo: unknown flag: -arches
(base) sangwoncha@Sangwons-MacBook-Pro ~ % /Applications/NEURON/bin/nrniv -nopython
NEURON -- VERSION 8.0.0 release/8.0 (429d11ef3) 2021-04-30
Duke, Yale, and the BlueBrain Project -- Copyright 1984-2021
See http://neuron.yale.edu/neuron/credits
hines
Site Admin
Posts: 1636
Joined: Wed May 18, 2005 3:32 pm

Re: Intel MKL Fatal error when executing HOC file

Post by hines »

lipo -arches /Applications/NEURON/bin/nrniv
Sorry about the typo. I meant

Code: Select all

lipo -archs /Applications/NEURON/bin/nrniv
But no matter, from your other comments, I already know it will be x86_64 and not arm64.
To see if your installation of Python or NEURON or the combination is to blame, try executing the code from your first message with the '-nopython' arg to nrniv. i.e. in a terminal,

Code: Select all

nrniv -nopython file.hoc
(where file.hoc is the name of the file you used).

Also, If you don't see any graphics pop up, is there an error message for

Code: Select all

idraw
and let me know the output of

Code: Select all

otool -L /Applications/NEURON/bin/idraw
sangwonc
Posts: 10
Joined: Sun Nov 07, 2021 7:13 pm

Re: Intel MKL Fatal error when executing HOC file

Post by sangwonc »

Hello,

The output to nrniv -nopython file.hoc was the following:
(base) sangwoncha@Sangwons-MacBook-Pro Nrn-3 % nrniv -nopython init_Axon_TimeCourse.hoc
NEURON -- VERSION 8.0.0 release/8.0 (429d11ef3) 2021-04-30
Duke, Yale, and the BlueBrain Project -- Copyright 1984-2021
See http://neuron.yale.edu/neuron/credits

loading membrane mechanisms from x86_64/.libs/libnrnmech.so
Additional mechanisms from files
"INaP.mod" "IT.mod" "I_Leak.mod" "Ih.mod" "capump.mod" "spike.mod"
1
1
GC: 10 Cell: 0
40
1
1
1
1
1
1
1
1
*************** Axon Cell ***************
------------------- Frequency 1Hz ------------------------
vfiles/Axon/Threshold18/Axoncell281008V-1.v
RUNNING ...
Fstim = 0 Hz
Writing output for
0
1
Graphics popped up and yielded output according to the code contained in the file. There was no error message for 'idraw,' and a window for InterViews drawing editor was produced. The output for 'otool -L /Applications/NEURON/bin/idraw' was:
(base) sangwoncha@Sangwons-MacBook-Pro ~ % otool -L /Applications/NEURON/bin/idraw
/Applications/NEURON/bin/idraw:
/usr/X11/lib/libSM.6.dylib (compatibility version 7.0.0, current version 7.1.0)
/usr/X11/lib/libICE.6.dylib (compatibility version 10.0.0, current version 10.0.0)
/usr/X11/lib/libX11.6.dylib (compatibility version 10.0.0, current version 10.0.0)
/usr/X11/lib/libXext.6.dylib (compatibility version 11.0.0, current version 11.0.0)
/usr/lib/libSystem.B.dylib (compatibility version 1.0.0, current version 1292.60.1)
/usr/lib/libc++.1.dylib (compatibility version 1.0.0, current version 904.4.0)
Thank you.
hines
Site Admin
Posts: 1636
Joined: Wed May 18, 2005 3:32 pm

Re: Intel MKL Fatal error when executing HOC file

Post by hines »

Ok. So NEURON without Python seems to be working correctly. If that is sufficient functionality for you, we can close the issue. However, if you do wish to combine the functionality of Python and NEURON, we can continue the diagnosis. The next step would be to launch python and see if you can import neuron and run your file. I.e.

Code: Select all

python # or whatever you need to type to start python, e.g. python3
from neuron import h, gui
h.load_file("init_Axon_TimeCourse.hoc")
sangwonc
Posts: 10
Joined: Sun Nov 07, 2021 7:13 pm

Re: Intel MKL Fatal error when executing HOC file

Post by sangwonc »

Hello,

When I executed the code you provided through Terminal, it works - the graphics pop up and output is produced. However, when I execute the same code (contained in a .py file) and drag it over to the 'nrngui' icon and drop it, it produces the error:
-e
NEURON -- VERSION 8.0.0 release/8.0 (429d11ef3) 2021-04-30
Duke, Yale, and the BlueBrain Project -- Copyright 1984-2021
See http://neuron.yale.edu/neuron/credits

loading membrane mechanisms from /Users/sangwoncha/Downloads/Nrn-3/x86_64/.libs/libnrnmech.so
Additional mechanisms from files
"INaP.mod" "IT.mod" "I_Leak.mod" "Ih.mod" "capump.mod" "spike.mod"
INTEL MKL ERROR: dlopen(/Users/sangwoncha/opt/anaconda3/lib/libmkl_intel_thread.1.dylib, 9): Library not loaded: @rpath/libiomp5.dylib
Referenced from: /Users/sangwoncha/opt/anaconda3/lib/libmkl_intel_thread.1.dylib
Reason: image not found.
Intel MKL FATAL ERROR: Cannot load libmkl_intel_thread.1.dylib.
nrngui exit status was 2
Press return key to exit
But since I know how to execute the code, but in a different way, I think further pursuing a solution to this issue is not necessary. I will post on the forum once I have anymore questions. Thank you so much for your help!
hines
Site Admin
Posts: 1636
Joined: Wed May 18, 2005 3:32 pm

Re: Intel MKL Fatal error when executing HOC file

Post by hines »

INTEL MKL ERROR
I don't have an answer to that problem. I suspect that launching your Python sets up a more elaborate environment for finding modules and libraries
than launching nrniv is able to do just from PYTHONHOME and dynamically loading the Python library. I had forgotten to ask what is output when you

Code: Select all

nrnpyenv.sh
I suspect that you could get nrniv to work with
a more elaborate PYTHONPATH that you could form from

Code: Select all

python
import sys
print("export PYTHONPATH={}".format(":".join(sys.path)))
Then, after copy/paste of the export line that is printed, there is a chance that

Code: Select all

nrniv -python
would work.
Post Reply