Skip to content
This repository was archived by the owner on Feb 26, 2025. It is now read-only.
This repository was archived by the owner on Feb 26, 2025. It is now read-only.

error when running simplecell code #394

Open

Description

@gincru

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

Activity

  1. DrTaDa commented on Apr 19, 2022

    @DrTaDa
    Contributor

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

  2. gincru commented on Apr 19, 2022

    @gincru
    Author

    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.

  3. DrTaDa commented on Apr 19, 2022

    @DrTaDa
    Contributor

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

  4. gincru commented on Apr 19, 2022

    @gincru
    Author

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

  5. DrTaDa commented on Apr 19, 2022

    @DrTaDa
    Contributor

    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)
    
  6. gincru commented on Apr 19, 2022

    @gincru
    Author

    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.

  7. gincru commented on Apr 19, 2022

    @gincru
    Author

    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

  8. DrTaDa commented on Apr 19, 2022

    @DrTaDa
    Contributor

    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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions