Open cameron-woodard opened 3 months ago
Hi Ok it's a weird error. Does it happen if you call it outside spyder?
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:
git clone git@github.com:pynapple-org/pynapple.git
cd pynapple
Make sure you are in the right conda environment
pip install -e .
Open ~/pynapple/pynapple/core/_jitted_functions.py
amd comment line 120.
Call again your scripts
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 anaconda powershell
. Then activate your environment with conda activate your_env_name
. After that, you can type ipython
and you should have ipython ready. If not you can still install it with pip install ipython
. Within ipython, you can run your script with run yourscript.py
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, Sorry for taking so long to respond. Back when I first ran into this issue, I tried commenting out the line in jitted_functions and this didn't seem to help - I was still was getting the error. However, now going back to test it again, I can't seem to replicate the error, regardless of whether the line in _jitted_functions.py is commented out or not. It's possible that I updated Spyder or some other dependent packages in the environment that resolved this. Thanks for your feedback and suggestions regardless.
@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. It seems to me that the program is trying to access some files that don't exist at time of execution. When loading your data are you using NWB or not?
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 python version 3.10.14
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
def EDM_Preprocess_Ensemble(data, event_times, window=(-3,3), bin_size=0.025, *args, **kwargs): print('Computing Peri-Event') perievent = nap.compute_perievent(data, event_times, window)
Installed packages (copied from conda list):
aiohappyeyeballs 2.4.3 pypi_0 pypi
aiohttp 3.10.10 pypi_0 pypi
aiosignal 1.3.1 pypi_0 pypi
alabaster 1.0.0 pypi_0 pypi
anyio 4.4.0 pypi_0 pypi
argon2-cffi 23.1.0 pypi_0 pypi
argon2-cffi-bindings 21.2.0 pypi_0 pypi
arrow 1.3.0 py310haa95532_0
astroid 3.3.5 pypi_0 pypi
asttokens 2.4.1 pypi_0 pypi
async-lru 2.0.4 pypi_0 pypi
async-timeout 4.0.3 pypi_0 pypi
asyncssh 2.17.0 pypi_0 pypi
atomicwrites 1.4.1 pypi_0 pypi
attrs 23.2.0 pypi_0 pypi
autopep8 2.0.4 pyhd3eb1b0_0
babel 2.15.0 pypi_0 pypi
backports-tarfile 1.2.0 pypi_0 pypi
bcrypt 3.2.0 py310h2bbff1b_1
beautifulsoup4 4.12.3 py310haa95532_0
binaryornot 0.4.4 pyhd3eb1b0_1
black 24.10.0 pypi_0 pypi
blas 1.0 mkl
bleach 6.1.0 pypi_0 pypi
brotli 1.1.0 hcfcfb64_1 conda-forge
brotli-bin 1.1.0 hcfcfb64_1 conda-forge
brotli-python 1.0.9 py310hd77b12b_8
bzip2 1.0.8 h2466b09_7 conda-forge
ca-certificates 2024.9.24 haa95532_0
certifi 2024.8.30 py310haa95532_0
cffi 1.16.0 pypi_0 pypi
chardet 5.2.0 pypi_0 pypi
charset-normalizer 3.3.2 pyhd3eb1b0_0
click 8.1.7 py310haa95532_0
cloudpickle 3.1.0 pypi_0 pypi
colorama 0.4.6 pyhd8ed1ab_0 conda-forge
comm 0.2.2 pypi_0 pypi
contourpy 1.2.1 py310h232114e_0 conda-forge
cookiecutter 2.6.0 py310haa95532_0
cryptography 43.0.3 pypi_0 pypi
cycler 0.12.1 pyhd8ed1ab_0 conda-forge
dclut 0.0.3 pypi_0 pypi
debugpy 1.8.2 pypi_0 pypi
decorator 5.1.1 pyhd3eb1b0_0
defusedxml 0.7.1 pyhd3eb1b0_0
deprecated 1.2.14 pypi_0 pypi
diff-match-patch 20241021 pypi_0 pypi
dill 0.3.9 pypi_0 pypi
docstring-to-markdown 0.15 pypi_0 pypi
docutils 0.21.2 pypi_0 pypi
exceptiongroup 1.2.2 pypi_0 pypi
executing 2.0.1 pypi_0 pypi
fastjsonschema 2.20.0 pypi_0 pypi
fileio 0.3 pypi_0 pypi
flake8 7.1.1 pypi_0 pypi
fonttools 4.53.1 py310ha8f682b_0 conda-forge
fqdn 1.5.1 pypi_0 pypi
freetype 2.12.1 hdaf720e_2 conda-forge
frozenlist 1.5.0 pypi_0 pypi
glib 2.78.4 hd77b12b_0
glib-tools 2.78.4 hd77b12b_0
gst-plugins-base 1.22.3 hfc3ed34_1
gstreamer 1.22.3 h1779075_1
h11 0.14.0 pypi_0 pypi
h5py 3.11.0 pypi_0 pypi
hdmf 3.14.2 pypi_0 pypi
httpcore 1.0.5 pypi_0 pypi
httpx 0.27.0 pypi_0 pypi
icu 73.2 h63175ca_0 conda-forge
idna 3.7 py310haa95532_0
imagesize 1.4.1 py310haa95532_0
importlib-metadata 8.0.0 pypi_0 pypi
importlib_metadata 7.0.1 hd3eb1b0_0
inflection 0.5.1 pypi_0 pypi
iniconfig 2.0.0 pypi_0 pypi
intel-openmp 2024.2.0 h57928b3_980 conda-forge
intervaltree 3.1.0 pyhd3eb1b0_0
ipykernel 6.29.5 py310haa95532_0
ipython 8.26.0 pypi_0 pypi
isoduration 20.11.0 pypi_0 pypi
isort 5.13.2 py310haa95532_0
jaraco-classes 3.4.0 pypi_0 pypi
jaraco-context 5.3.0 pypi_0 pypi
jaraco-functools 4.0.1 pypi_0 pypi
jaraco.classes 3.2.1 pyhd3eb1b0_0
jax 0.4.31 pypi_0 pypi
jaxlib 0.4.31 pypi_0 pypi
jaxopt 0.8.3 pypi_0 pypi
jedi 0.19.1 py310haa95532_0
jellyfish 1.1.0 pypi_0 pypi
jinja2 3.1.4 py310haa95532_0
joblib 1.4.2 pyhd8ed1ab_0 conda-forge
jpeg 9e h827c3e9_3
json5 0.9.25 pypi_0 pypi
jsonpointer 3.0.0 pypi_0 pypi
jsonschema 4.23.0 py310haa95532_0
jsonschema-specifications 2023.12.1 pypi_0 pypi
jupyter-client 8.6.2 pypi_0 pypi
jupyter-events 0.10.0 pypi_0 pypi
jupyter-lsp 2.2.5 pypi_0 pypi
jupyter-server 2.14.2 pypi_0 pypi
jupyter-server-terminals 0.5.3 pypi_0 pypi
jupyter_client 8.6.0 py310haa95532_0
jupyter_core 5.7.2 py310haa95532_0
jupyterlab 4.2.4 pypi_0 pypi
jupyterlab-pygments 0.3.0 pypi_0 pypi
jupyterlab-server 2.27.3 pypi_0 pypi
jupyterlab_pygments 0.2.2 py310haa95532_0
keyring 25.2.1 pypi_0 pypi
kiwisolver 1.4.5 py310h232114e_1 conda-forge
krb5 1.20.1 h5b6d351_0
lazy-object-proxy 1.10.0 py310h2bbff1b_0
lcms2 2.12 h83e58a3_0
lerc 3.0 hd77b12b_0
libblas 3.9.0 1_h8933c1f_netlib conda-forge
libbrotlicommon 1.1.0 hcfcfb64_1 conda-forge
libbrotlidec 1.1.0 hcfcfb64_1 conda-forge
libbrotlienc 1.1.0 hcfcfb64_1 conda-forge
libcblas 3.9.0 5_hd5c7e75_netlib conda-forge
libclang 14.0.6 default_hb5a9fac_1
libclang13 14.0.6 default_h8e68704_1
libdeflate 1.17 h2bbff1b_1
libffi 3.4.2 h8ffe710_5 conda-forge
libglib 2.78.4 ha17d25a_0
libhwloc 2.11.1 default_h8125262_1000 conda-forge
libiconv 1.17 hcfcfb64_2 conda-forge
libintl 0.22.5 h5728263_2 conda-forge
libintl-devel 0.22.5 h5728263_2 conda-forge
libjpeg-turbo 2.0.0 h196d8e1_0
liblapack 3.9.0 5_hd5c7e75_netlib conda-forge
libogg 1.3.5 h2466b09_0 conda-forge
libpng 1.6.43 h19919ed_0 conda-forge
libpq 12.17 h906ac69_0
libsodium 1.0.18 h62dcd97_0
libspatialindex 1.9.3 h6c2663c_0
libsqlite 3.46.0 h2466b09_0 conda-forge
libtiff 4.5.1 hd77b12b_0
libvorbis 1.3.7 h0e60522_0 conda-forge
libwebp-base 1.4.0 hcfcfb64_0 conda-forge
libxcb 1.16 hcd874cb_0 conda-forge
libxml2 2.13.1 h24da03e_2
libzlib 1.2.13 h2466b09_6 conda-forge
llvmlite 0.43.0 pypi_0 pypi
m2w64-gcc-libgfortran 5.3.0 6 conda-forge
m2w64-gcc-libs 5.3.0 7 conda-forge
m2w64-gcc-libs-core 5.3.0 7 conda-forge
m2w64-gmp 6.1.0 2 conda-forge
m2w64-libwinpthread-git 5.0.0.4634.697f757 2 conda-forge
markdown-it-py 3.0.0 pypi_0 pypi
markupsafe 2.1.5 pypi_0 pypi
matplotlib 3.9.2 py310haa95532_0
matplotlib-base 3.9.2 py310h37e0a56_1 conda-forge
matplotlib-inline 0.1.7 pypi_0 pypi
mccabe 0.7.0 pyhd3eb1b0_0
mdurl 0.1.2 pypi_0 pypi
mimo-pack 0.0.0 dev_0
@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?