Another problem using Modelview

Post Reply
catharina
Posts: 13
Joined: Tue May 30, 2017 9:42 am

Another problem using Modelview

Post by catharina »

Hello,

since updating spyder to the newest version using 'conda update spyder', the NEURON Gui crashes and gets stuck whenever I try to open the ModelView. This happens using the nrngui -python from the command line and also when I use spyder to run python files with neuron using spyder. This also happens when trying to load the modelview hoc file manually. Then it just says 'hoc error'.
The error message I get using the gui ModelView is:

Code: Select all

oc>/usr/local/nrn/x86_64/bin/nrniv: syntax error
 in mview/ppanal.hoc near line 148
 				for is=0, size-1 {
           ^
        xopen("mview/ppan...")
      xopen("mview.hoc")
    execute1("{xopen("mv...")
  load_file("mview.hoc", "ModelView")
/usr/local/nrn/x86_64/bin/nrniv: mview undefined function
 in mview/ppanal.hoc near line 1
 {mview()}
          ^
        mview()
      execute("mview()")
Also whenever I try to close the gui using the quit button, the (spyder) kernel crashes. Also when I try it from the command line without spyder the gui gets stuck completely and when i quit it with Cltr+D, this error message appears:

Code: Select all

sqlite3.ProgrammingError: SQLite objects created in a thread can only be used in that same thread.The object was created in thread id 139692449322752 and this is thread id 139692316354304
I have tried to reset my packages back using conda --revisions but the problem didn't resolve. Then I have also tried to update all packages including spyder and scipy to the newest versions. But i can't figure out how to fix it.

I am using NEURON 7.4 on a Ubuntu 16.04 machine.

It would be very nice if someone could give me advice how to fix this!

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

Re: Another problem using Modelview

Post by ted »

Uninstall 7.4, then install the latest alpha version or compile from the repository's latest source code.
catharina
Posts: 13
Joined: Tue May 30, 2017 9:42 am

Re: Another problem using Modelview

Post by catharina »

I have now installed NEURON 7.5. It did go almost smoothly and the Modelview error does resolve!

However the error when using the quit button of the gui still occurs whenever the gui is opened with Ipython but not when opened with python.
catharina
Posts: 13
Joined: Tue May 30, 2017 9:42 am

Re: Another problem using Modelview

Post by catharina »

I think I was too fast to conclude that the Modelview problem is resolved.

It still occurs! But kind of unregularly, so I cannot always reproduce it after closing all windows and starting fresh.

It occurs using Spyder 3.2, IPython 5.4, Python 2.7.13 (All installed via Anaconda). It does occur when running a python file using python with neuron as package and also when using nrngui -python.

Thats the error message I get using spyder:

Code: Select all

Exception in thread Thread-5:
Traceback (most recent call last):
  File "/home/catharina/anaconda2/lib/python2.7/threading.py", line 801, in __bootstrap_inner
    self.run()
  File "/home/catharina/anaconda2/lib/python2.7/site-packages/neuron/gui.py", line 37, in run
    self.fun()
  File "/home/catharina/anaconda2/lib/python2.7/site-packages/neuron/gui.py", line 15, in process_events
    h.doNotify()
RuntimeError: hoc error
Any ideas how I can solve this?
catharina
Posts: 13
Joined: Tue May 30, 2017 9:42 am

Re: Another problem using Modelview

Post by catharina »

So for example when I download this model: https://senselab.med.yale.edu/modeldb/S ... tml#tabs-1

I get the first error message I have posted when running it using 'nrngui mosinit.hoc' and trying to open the ModelView.

And when loading it manually into a python file, running it and then trying to open the ModelView, I receive the second error message I have posted.
hines
Site Admin
Posts: 1682
Joined: Wed May 18, 2005 3:32 pm

Re: Another problem using Modelview

Post by hines »

Code: Select all

            for is=0, size-1 {
           ^
This syntax error in nrn/share/nrn/lib/hoc/mview/ppanal.hoc line 148 is an artifact of 'is' being a POINT_PROCESS of is.mod and the mistake in the ModelView mk_ppmech() implementation of not declaring it as a local variable.
The work around is either to add 'is' to the local list so that the line looks like

Code: Select all

proc mk_pmech() {local i, j, icol, itype, ntype, is
Or change the POINT_PROCESS is name in is.mod to another name (as well as all the usage lines in the code).
This is the second time in as many weeks that this namespace pollution problem has come up. Unfortunately it is not easy to change the hoc parser to resolve the ambiguity automatically via namespace priority. All I can do is look through
the hoc library templates to make names less likely to conflict with names of mechanisms or point processes and make sure that anything that can be a local variable is declared local.

Anyway, let me know if you still have problems with Spyder or h.quit() after avoiding this error and I will look further into those problems specifically.
catharina
Posts: 13
Joined: Tue May 30, 2017 9:42 am

Re: Another problem using Modelview

Post by catharina »

Thank you very much for your help! I have renamed the is.mod file and now the ModelView works fine! I am very pleased.

The quit() issue is still there but it doesn't bother me as much. I just have to remember not to use it because sometimes its not only the gui that gets stuck but also my computer. Btw, this error occurs whenever the neuron gui is used together with ipython (using spyder and also using linux command line).

Best regards, Catharina
hines
Site Admin
Posts: 1682
Joined: Wed May 18, 2005 3:32 pm

Re: Another problem using Modelview

Post by hines »

I've pushed a changset to http://github.com/nrnhines/nrn that avoids the hoc quit() function from calling Py_Finalize() when the thread is not the main thread. That seems to fix
the problem though I'm not completely satisfied and would rather figure out a way of having the gui thread request that call from the main thread. The operating system should reclaim all the memory resources
and close files when the hoc quit finally calls exit(0).
Post Reply