BluePyOpt icon indicating copy to clipboard operation
BluePyOpt copied to clipboard

error when running simplecell code

Open gincru opened this issue 3 years ago • 8 comments

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

gincru avatar Apr 16 '22 10:04 gincru

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

DrTaDa avatar Apr 19 '22 08:04 DrTaDa

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.

gincru avatar Apr 19 '22 09:04 gincru

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

DrTaDa avatar Apr 19 '22 09:04 DrTaDa

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

gincru avatar Apr 19 '22 10:04 gincru

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)

DrTaDa avatar Apr 19 '22 12:04 DrTaDa

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 avatar Apr 19 '22 13:04 gincru

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

gincru avatar Apr 19 '22 13:04 gincru

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

DrTaDa avatar Apr 19 '22 13:04 DrTaDa