-
Notifications
You must be signed in to change notification settings - Fork 63
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
Fatal exception using pynapple in IPython console #318
Comments
Hi The function count is compiled with numba under the hood. It might be an issue with numba here but not sure. If you are comfortable with it, you can try to disable the compiling of the count function with the following steps:
If it works, there might be an incompatibility with numba with something else. If it doesn't work, you can paste the error here. |
Hello do you have any update about this issue? |
Hi, I've run into a similar error. I figured I'd post it here rather than start a new thread given the similarity. I'm running in a custom environment with Jupyter Notebook in VSCode. Intermittently my kernal crashes with an ExitCode: 3221225477 and the Reason: is blank. I peppered my code with print statements and found that it happens most frequently with count() but I've also had it happen during compute_perievent(). I've noticed it's more likely to happen when I run subsequent views of the same data. For example, if I run my analysis aligned to trial start and then to trial end it's more likely to crash when I examine the trial end alignment. I've commented out line 120 from _jitted_functions.py and can confirm that count() still kills the kernal sometimes. edit: updated to reflect I have had the kernal die since commenting out the jit decorator |
Hi Gabriel, are you on windows too? Does it happen too when you are outside vscode? Like in a simple terminal. |
I am on windows. I haven't tried running outside of vscode. I'm new to python and don't know how to do it any other way. |
If you have installed anaconda, you should be able to open a terminal by typing It is a very weird error and we suspect it's windows specific. Pynapple is tested against all OS but clearly it's something that escape the tests. |
Hi, |
@gviejo is your recommendation to use ipython to test if vscode is a issue or jupyter? My processing pipeline is currently in a jupyter notebook. I could try running it in Spyder notebook if the concern is that vscode is doing something wonky. Otherwise I could probably shove it all into a .py file to run with ipython. Side note, last night I changed almost all my .count() calls to .count().to_numpy() and everything seems to be substantially more stable now. Since then my kernal has only died during .compute_perievent() calls, which are comparatively rare to how frequently it was crashing on .count() |
Yes i would try only a py file first. |
No, I'm using code from the lab that pulls from the kilosort outputs and creates a TsGroup from that. |
@gviejo at this point I've had the chance to run multiple instances of both the .ipynb version of my code in vscode, and the .py copy in ipython. I've had my vscode kernal crash a handful of times, every time at .compute_perievent(), while the ipython version hasn't crashed once. I even copied 10x calls of my code where I call .compute_perievent() to try to up the chances of the issue arising and it hasn't crashed once. |
Thanks for testing it. Could you post your vscode version, your python version, the version of the packages you used, the way you installed your environment and if possible a minimal script around compute_perievent? |
vscode version: 1.94.2 I created the environment following the lab instructions here: https://github.com/dbheadley/mimo_pack, with additional conda installs of Nemos and sklearn. As for the specific code, the spiking data is read in as a TsGroup using the as_pynapple function defined in loadphy.py (https://github.com/dbheadley/mimo_pack/tree/main/mimo_pack/fileio). My compute_perievents() call is the first line in a function that gets passed the spks object as_pynapple returns, as well as event timestamps and the relative time windows. Here's a snippet
Installed packages (copied from conda list): |
@gviejo was there anything in my environment that stood out as problematic? Quick update, I'm happy to report I haven't had issues lately. I moved most of my code out of jupyter notebooks and into dedicated .py files. I also started working from pickled data files rather than compiling from .bin each time. Not sure if it was either, or a combination of the two, but things are seemingly stable now. |
Hi,
I'm running scripts that use pynapple through an IPython console in the Spyder IDE and I keep running into the following error:
Windows fatal exception: access violation
Thread 0x00005968 (most recent call first):
File "C:\Users\Cam\miniconda3\envs\pynapple\lib\site-packages\zmq\utils\garbage.py", line 47 in run
File "C:\Users\Cam\miniconda3\envs\pynapple\lib\threading.py", line 932 in _bootstrap_inner
File "C:\Users\Cam\miniconda3\envs\pynapple\lib\threading.py", line 890 in _bootstrap
Main thread:
Current thread 0x000037a0 (most recent call first):
File "C:\Users\Cam\miniconda3\envs\pynapple\lib\site-packages\pynapple\core_core_functions.py", line 33 in _count
File "C:\Users\Cam\miniconda3\envs\pynapple\lib\site-packages\pynapple\core\ts_group.py", line 704 in count
File "c:\users\cam\documents\python scripts\ephys analysis\be05_behavior_spiking_analysis.py", line 1845 in
File "C:\Users\Cam\miniconda3\envs\pynapple\lib\site-packages\spyder_kernels\py3compat.py", line 356 in compat_exec
File "C:\Users\Cam\miniconda3\envs\pynapple\lib\site-packages\spyder_kernels\customize\spydercustomize.py", line 473 in exec_code
File "C:\Users\Cam\miniconda3\envs\pynapple\lib\site-packages\spyder_kernels\customize\spydercustomize.py", line 740 in _exec_cell
File "C:\Users\Cam\miniconda3\envs\pynapple\lib\site-packages\spyder_kernels\customize\spydercustomize.py", line 689 in runcell
File "C:\Users\Cam\AppData\Local\Temp\ipykernel_20848\4094378172.py", line 1 in
This results in the kernel crashing and restarting. The first section with the garbage collection thread is not always present, so I don't think that has anything to do with it. It looks to me like the issue happens when the count function is called? It doesn't happen every time I use count, but invariably occurs when I'm running loops that involve shuffling unit activity and running count hundreds of times. I tried deleting the pynapple environment and making it again from scratch but it didn't help. I'm using the latest version of pynapple. Any ideas?
The text was updated successfully, but these errors were encountered: