lava icon indicating copy to clipboard operation
lava copied to clipboard

tutorial02_process hangs on lif.run command

Open jorchard opened this issue 2 years ago • 6 comments

Objective of issue:

Lava version:

  • [x] 0.3.0 (current version)

I'm submitting a ...

  • [x] bug report

Current behavior:

  • In the tutorial02_process.ipynb notebook, I have no problems until I reach the line
lif.run(condition=RunSteps(num_steps=1), run_cfg=Loihi1SimCfg())

which gives me the error

Traceback (most recent call last):
  File "<string>", line 1, in <module>
  File "/usr/local/opt/[email protected]/Frameworks/Python.framework/Versions/3.8/lib/python3.8/multiprocessing/spawn.py", line 116, in spawn_main
    exitcode = _main(fd, parent_sentinel)
  File "/usr/local/opt/[email protected]/Frameworks/Python.framework/Versions/3.8/lib/python3.8/multiprocessing/spawn.py", line 126, in _main
    self = reduction.pickle.load(from_parent)
AttributeError: Can't get attribute 'PyLifModel' on <module '__main__' (built-in)>

and then hangs.

Expected behavior:

  • Execution should complete (with no output). It should not hang.

Steps to reproduce:

  • On Mac OS 12.3.1, in a terminal window:
source .venv/bin/activate
jupyter notebook

Then I open tutorial02_process.ipynb, and execute the cells, one by one, from the top. They all run fine until it hangs, as described above.

Other information:

For what it's worth, some of the unit tests fail, though I'm not sure they are related.

==== 10 failed, 210 passed, 14 skipped, 2 warnings in 145.32s (0:02:25) =====
...
INTERNALERROR> Traceback (most recent call last):
INTERNALERROR>   File "/Users/jorchard/Dropbox/research/lava/.venv/lib/python3.8/site-packages/coverage/sqldata.py", line 1063, in _connect
INTERNALERROR> sqlite3.OperationalError: unable to open database file
...
INTERNALERROR> coverage.exceptions.DataError: Couldn't use data file '/Users/jorchard/Dropbox/research/lava/.coverage.v1040-wn-rt-b-61-133.campus-dynamic.uwaterloo.ca.95589.702179': unable to open database file

jorchard avatar Apr 26 '22 19:04 jorchard

I'm having exactly the same trouble with Windows system.

Zhang--Ning avatar May 08 '22 05:05 Zhang--Ning

For what it is worth, that line gives me issues when I try to debug the cell in vscode. Running the cell works fine.

You can read more abut it here: https://github.com/microsoft/vscode-jupyter/issues/9886#issuecomment-1120091638

In short, the line starts a new child process and currently vscode notebook debugging does not support attaching to them.

waltergallegog avatar May 12 '22 21:05 waltergallegog

Still having the same issue when running the tutorial in a Jupyter notebook. Works fine if I run it as a Python file. Any progress on fixing this?

stevenabreu7 avatar Jun 24 '22 14:06 stevenabreu7

We are aware that there are issues with running the tutorial under Windows. This is due to a problem in the combination between Windows, Jupyter notebook and the multiprocessing library. We are working on a clean solution, but I was not aware that this issue expands to Mac users.

There is an open pull request with a work-around. Please take a look at #259 , #95 and #148. Alternatively, you should be able to export the notebooks to Python scripts and run them outside of a notebook.

weidel-p avatar Jun 27 '22 11:06 weidel-p