Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

error when running simplecell code #394

Open
gincru opened this issue Apr 16, 2022 · 8 comments
Open

error when running simplecell code #394

gincru opened this issue Apr 16, 2022 · 8 comments

Comments

@gincru
Copy link

gincru commented Apr 16, 2022

When I ran the code simplecell as is, I encountered errors as follows. Please help.
default_params = {'gnabar_hh': 0.1, 'gkbar_hh': 0.03}
responses = twostep_protocol.run(cell_model=simple_cell, param_values=default_params, sim=nrn)

Errors:
RemoteTraceback Traceback (most recent call last)
RemoteTraceback: Traceback (most recent call last):
File "C:\Users\LENOVO\anaconda3\lib\site-packages\bluepyopt\ephys\protocols.py", line 169, in _run_func
cell_model.instantiate(sim=sim)
File "C:\Users\LENOVO\anaconda3\lib\site-packages\bluepyopt\ephys\models.py", line 241, in instantiate
self.morphology.instantiate(sim=sim, icell=self.icell)
File "C:\Users\LENOVO\anaconda3\lib\site-packages\bluepyopt\ephys\morphologies.py", line 131, in instantiate
imorphology.input(str(self.morphology_path))
RuntimeError: hoc error

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "C:\Users\LENOVO\anaconda3\lib\site-packages\pebble\common.py", line 174, in process_execute
return function(*args, **kwargs)
File "C:\Users\LENOVO\anaconda3\lib\site-packages\bluepyopt\ephys\protocols.py", line 197, in _run_func
raise Exception(
Exception: Traceback (most recent call last):
File "C:\Users\LENOVO\anaconda3\lib\site-packages\bluepyopt\ephys\protocols.py", line 169, in _run_func
cell_model.instantiate(sim=sim)
File "C:\Users\LENOVO\anaconda3\lib\site-packages\bluepyopt\ephys\models.py", line 241, in instantiate
self.morphology.instantiate(sim=sim, icell=self.icell)
File "C:\Users\LENOVO\anaconda3\lib\site-packages\bluepyopt\ephys\morphologies.py", line 131, in instantiate
imorphology.input(str(self.morphology_path))
RuntimeError: hoc error

The above exception was the direct cause of the following exception:

Exception Traceback (most recent call last)
~\AppData\Local\Temp/ipykernel_5464/804922019.py in
1 default_params = {'gnabar_hh': 0.1, 'gkbar_hh': 0.03}
----> 2 responses = twostep_protocol.run(cell_model=simple_cell, param_values=default_params, sim=nrn)

~\anaconda3\lib\site-packages\bluepyopt\ephys\protocols.py in run(self, cell_model, param_values, sim, isolate, timeout)
76 # Try/except added for backward compatibility
77 try:
---> 78 response = protocol.run(
79 cell_model=cell_model,
80 param_values=param_values,

~\anaconda3\lib\site-packages\bluepyopt\ephys\protocols.py in run(self, cell_model, param_values, sim, isolate, timeout)
233 timeout=timeout)
234 try:
--> 235 responses = tasks.result()
236 except TimeoutError:
237 logger.debug('SweepProtocol: task took longer than '

~\anaconda3\lib\concurrent\futures_base.py in result(self, timeout)
443 raise CancelledError()
444 elif self._state == FINISHED:
--> 445 return self.__get_result()
446 else:
447 raise TimeoutError()

~\anaconda3\lib\concurrent\futures_base.py in __get_result(self)
388 if self._exception:
389 try:
--> 390 raise self._exception
391 finally:
392 # Break a reference cycle with the exception in self._exception

Exception: Traceback (most recent call last):
File "C:\Users\LENOVO\anaconda3\lib\site-packages\bluepyopt\ephys\protocols.py", line 169, in _run_func
cell_model.instantiate(sim=sim)
File "C:\Users\LENOVO\anaconda3\lib\site-packages\bluepyopt\ephys\models.py", line 241, in instantiate
self.morphology.instantiate(sim=sim, icell=self.icell)
File "C:\Users\LENOVO\anaconda3\lib\site-packages\bluepyopt\ephys\morphologies.py", line 131, in instantiate
imorphology.input(str(self.morphology_path))
RuntimeError: hoc error

@DrTaDa
Copy link
Contributor

DrTaDa commented Apr 19, 2022

Hello @gincru,
by "the code simplecell", are you referring to the notebook https://github.com/BlueBrain/BluePyOpt/blob/master/examples/simplecell/simplecell.ipynb ?

@gincru
Copy link
Author

gincru commented Apr 19, 2022

Yes. I copied the code into my Jupyter notebook and that is the error after running the lines:

default_params = {'gnabar_hh': 0.1, 'gkbar_hh': 0.03}
responses = twostep_protocol.run(cell_model=simple_cell, param_values=default_params, sim=nrn)

I couldn't then go any further.
Do I need to install BluePyOpt to my computer? I have a Windows system with NEURON 8.0/Python (via Anaconda). NEURON is configured to run with Python support.

@DrTaDa
Copy link
Contributor

DrTaDa commented Apr 19, 2022

Did you also copy in your local working directory the morphology that is used by the notebook (simple.swc) ?

@gincru
Copy link
Author

gincru commented Apr 19, 2022

Yes, the file simple.swc was in the same folder as the Jupyter notebook.

@DrTaDa
Copy link
Contributor

DrTaDa commented Apr 19, 2022

Indeed you do need to install BluePyOpt to execute this code.

With BluePyOpt installed, I was not able to replicate the issue. With it installed, could you check that the following code executes without issue:

import platform
from neuron import h

h.load_file("stdrun.hoc")
h.load_file("import3d.hoc")

morphology_path = "simple.swc"

imorphology = h.Import3d_SWC_read()
imorphology.quiet = 1

if platform.system() == 'Windows':
    h.hoc_stdout('NUL')
else:
    h.hoc_stdout('/dev/null')

imorphology.input(str(morphology_path))
h.hoc_stdout()

morphology_importer = h.Import3d_GUI(imorphology, 0)

@gincru
Copy link
Author

gincru commented Apr 19, 2022

Did you mean install BluePyOpt by pip install? That was part of the code, so yes, I had done that. I was thinking of installing BluePyOpt as an executable program (?). Does this make sense? Anyway, I will try to get the Windows subsystem Linux to see if that might help run the code on my machine.

@gincru
Copy link
Author

gincru commented Apr 19, 2022

I ran !pip install BluePyOpt, then !pip install neuron, and then the code that you gave me above, still on the same Windows system. It resulted in an error message as follows:

NEURON: stdout already switched
near line 0
^
hoc_stdout("NUL")

RuntimeError Traceback (most recent call last)
~\AppData\Local\Temp/ipykernel_16388/292845541.py in
11
12 if platform.system() == 'Windows':
---> 13 h.hoc_stdout('NUL')
14 else:
15 h.hoc_stdout('/dev/null')

RuntimeError: hoc error

@DrTaDa
Copy link
Contributor

DrTaDa commented Apr 19, 2022

You can get this last error if you execute the jupyter cell twice without restarting the jupyter kernel.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants