problems with import mod mechanism with python

NMODL and the Channel Builder.
Post Reply
menica
Posts: 71
Joined: Wed Sep 02, 2015 11:02 am

problems with import mod mechanism with python

Post by menica »

Hi
I installed NEURON+python.
Now, when I compile the folder with the mod mechanisms using mknrndll, the nrnmech.dll file is created but the folder x86_64 is not created.
I think this is the reason why I cannot anymore import cell templete in hoc file from python.
Any suggestion?
Best,
Menica
ted
Site Admin
Posts: 6289
Joined: Wed May 18, 2005 4:50 pm
Location: Yale University School of Medicine
Contact:

Re: problems with import mod mechanism with python

Post by ted »

menica wrote:when I compile the folder with the mod mechanisms using mknrndll, the nrnmech.dll file is created
That is what mknrndll does.
but the folder x86_64 is not created.
mknrndll does not create such a directory. All of the compiled mechanisms are in the nrnmech.dll file. If the nrnmech.dll file is in the current working directory when you start NEURON, it will automatically be loaded when NEURON starts, and a message like this

Code: Select all

loading membrane mechanisms from . . . 
will be printed to NEURON's terminal window.
menica
Posts: 71
Joined: Wed Sep 02, 2015 11:02 am

Re: problems with import mod mechanism with python

Post by menica »

Hi, I am typing in python
neuron.load_mechanisms('path_of_the_folder_where_mod_files_are')
and it returns as error:NEURON mechanisms not found in...
ted
Site Admin
Posts: 6289
Joined: Wed May 18, 2005 4:50 pm
Location: Yale University School of Medicine
Contact:

Re: problems with import mod mechanism with python

Post by ted »

Are you sure that the nrnmech.dll contains compiled mechanisms?
Are you sure that the path you specified is correct?
menica
Posts: 71
Joined: Wed Sep 02, 2015 11:02 am

Re: problems with import mod mechanism with python

Post by menica »

I think it is not created correctly even if when I run the mknrndll it returns :
nrnmech.dll was built successfully
I tried to use the same mechanisms calling them in neuron and indeed they are not compiled well.
The path I am using is correct
ted
Site Admin
Posts: 6289
Joined: Wed May 18, 2005 4:50 pm
Location: Yale University School of Medicine
Contact:

Re: problems with import mod mechanism with python

Post by ted »

menica wrote:I think it is not created correctly even if when I run the mknrndll it returns :
nrnmech.dll was built successfully
What happens when you launch nrngui in the directory where the nrnmech.dll exists? Exactly what does NEURON print to its terminal?
menica
Posts: 71
Joined: Wed Sep 02, 2015 11:02 am

Re: problems with import mod mechanism with python

Post by menica »

I tried to launch a hoc file directly from neuron with a compartment where I inserted the mechanism present in the same directory where the dll file is. On the terminal is printed:

NEURON -- Release 7.4 (1370:16a7055d4a86) 2015-11-09
Duke, Yale, and the BlueBrain Project -- Copyright 1984-2015
See http://www.neuron.yale.edu/neuron/credits

1
c:\nrn\bin\nrniv.exe: syntax error
in C:/Users/domenica.dibenedetto/Desktop/Shared folder-Kuramoto_model_in_NEURON
/GentilettiEtAl2016/simpcell.hoc near line 9
insert ikdrs
^
oc>
ted
Site Admin
Posts: 6289
Joined: Wed May 18, 2005 4:50 pm
Location: Yale University School of Medicine
Contact:

Re: problems with import mod mechanism with python

Post by ted »

First, uninstall the version of NEURON that is currently on that PC. Use the Uninstaller that comes with NEURON.
Download the most recent installer for MSWin
http://www.neuron.yale.edu/ftp/neuron/v ... -setup.exe
and use that to install NEURON.

Second, create a new directory that has a path that is much shorter and has no space characters.
C:/Users/domenica.dibenedetto/Desktop/test
would be good.

Third, create a hoc file called hello.hoc that contains only the following statement
print "hello"
and put it into the new directory.

Finally, use Windows Explorer to navigate to the new directory, and double click on hello.hoc
What does NEURON print to its terminal?
menica
Posts: 71
Joined: Wed Sep 02, 2015 11:02 am

Re: problems with import mod mechanism with python

Post by menica »

Hi,
I installed the new NEURON version and the "hello" is correctly printed.
But I have still the same problem in inserting the mechanisms and in compiling them properly.
When I use neuron with Python (downloaded with anaconda), it is able to import the gui, but I have still the same problem when I want to import the mechanisms.

Best
Menica
ted
Site Admin
Posts: 6289
Joined: Wed May 18, 2005 4:50 pm
Location: Yale University School of Medicine
Contact:

Re: problems with import mod mechanism with python

Post by ted »

menica wrote:I installed the new NEURON version and the "hello" is correctly printed.
In the directory that contains hello.hoc, create a new file called dummy.mod that contains the following

Code: Select all

: dummy.mod
: Makes a function written in C available to hoc
NEURON {
	SUFFIX nothing
}
: call it gcosh to avoid naming conflicts
FUNCTION gcosh(z) {
   gcosh = cosh(z)
}
Now run mknrndll in that directory.

After mknrndll is finished, does the directory contain a nrnmech.dll file?

Use NEURON to execute hello.hoc. Exactly what does NEURON print to its terminal?
menica
Posts: 71
Joined: Wed Sep 02, 2015 11:02 am

Re: problems with import mod mechanism with python

Post by menica »

Hi ,
yest the dll file is created, and when i run hello.hoc with neuron, this is what is printed :

NEURON -- VERSION 7.5 master (deea6c8) 2017-07-09
Duke, Yale, and the BlueBrain Project -- Copyright 1984-2016
See http://neuron.yale.edu/neuron/credits

hello
oc>

but I have still problem when I run .py file importing .mod mechanisms
ted
Site Admin
Posts: 6289
Joined: Wed May 18, 2005 4:50 pm
Location: Yale University School of Medicine
Contact:

Re: problems with import mod mechanism with python

Post by ted »

OK, if there is a nrnmech.dll file in the same directory as hello.hoc, then either the nrnmech.dll file is not being created correctly--exactly as you suspected back on August 4--or maybe NEURON isn't loading the nrnmech.dll file. What version of Windows are you using?
hines
Site Admin
Posts: 1682
Joined: Wed May 18, 2005 3:32 pm

Re: problems with import mod mechanism with python

Post by hines »

Since you now have
NEURON -- VERSION 7.5 master (deea6c8) 2017-07-09
it means your problem cannot be ascribed to a problem recently fixed. Ie.
Date: Sun Apr 30 13:44:48 2017 -0400
Sometimes on mswin nrn_load_dll needs a full path to nrnmech.dll
This has been seen to happen with windows 10 and a recent version of enthought canopy.

Now the full path to the nrnmech.dll is automatically determined and used when nrn_load_dll is executed.

What we were expecting from the last test, is that before "hello" was printed, a line containing the text
"Loading membrane mechanisms from ...." should have been printed. Since nothing like that was printed
there was a very early failure of the default process of finding and loading the nrnmech.dll file. Please run the hello.hoc with neuron again and let
us know what is printed by
nrn_load_dll("nrnmech.dll")
I presume there is in fact a nrnmech.dll file in the same folder as hello.hoc. Can you also copy paste the output that contained the launch command.
menica
Posts: 71
Joined: Wed Sep 02, 2015 11:02 am

Re: problems with import mod mechanism with python

Post by menica »

Hi ,
I have Windows 7.

the dll file is indeed not loaded correctly:

NEURON -- VERSION 7.5 master (deea6c8) 2017-07-09
Duke, Yale, and the BlueBrain Project -- Copyright 1984-2016
See http://neuron.yale.edu/neuron/credits

hello
oc>nrn_load_dll("nrnmech.dll")
0
oc>
Post Reply