MouseLand / suite2p

cell detection in calcium imaging recordings
http://www.suite2p.org
GNU General Public License v3.0
344 stars 240 forks source link

TypeError: mode() got an unexpected keyword argument 'keepdims' #886

Closed enot14134 closed 1 year ago

enot14134 commented 1 year ago

Hi,

I am a new suite2p user with very little python familiarity. I am currently collecting a data set capturing live GCaMP6f activity in human brain organoids (imaged on a confocal microscope, not a 2-photon) and am very interested in assessing the suitability of the suite2p analysis pipeline for my data.

To start, I have attempted to run a provided example data set to get things up and running however I am coming across the below error message (also attached).

I would appreciate any suggested fixes.

Many thanks,

{'data_path': ["C:/Users/60288184/OneDrive - Children's Medical Research Institute/KR/SNAP25 Project/Calcium Imaging/Suite2Pfiles/Data_path"], 'subfolders': [], 'save_path0': "C:/Users/60288184/OneDrive - Children's Medical Research Institute/KR/SNAP25 Project/Calcium Imaging/Suite2Pfiles/Save_path", 'fast_disk': "C:/Users/60288184/OneDrive - Children's Medical Research Institute/KR/SNAP25 Project/Calcium Imaging/Suite2Pfiles/Fast_path", 'input_format': 'tif'} tif Found 1 tifs - converting to binary 2000 frames of binary, time 19.39 sec. time 19.49 sec. Wrote 2000 frames per binary for 1 planes PLANE 0 <<<<<<<<<<<<<<<<<<<<<< NOTE: not registered / registration forced with ops['do_registration']>1 (no previous offsets to delete) NOTE: applying default C:\Users\60288184.suite2p\classifiers\classifier_user.npy ----------- REGISTRATION Reference frame, 42.34 sec. Registered 500/2000 in 460.11s Registered 1000/2000 in 1019.69s Registered 1500/2000 in 1465.94s Registered 2000/2000 in 1951.87s ----------- Total 2007.89 sec Registration metrics, 356.56 sec. ----------- ROI DETECTION Binning movie in chunks of length 10 Binned movie of size [200,656,776] created in 6.83 sec.

ERROR<<< Traceback (most recent call last): File "C:\Users\60288184\Anaconda3\envs\suite2p\lib\runpy.py", line 194, in _run_module_as_main ERROR<<< return _run_code(code, main_globals, None, File "C:\Users\60288184\Anaconda3\envs\suite2p\lib\runpy.py", line 87, in _run_code ERROR<<< exec(code, run_globals) File "C:\Users\60288184\Anaconda3\envs\suite2p\lib\site-packages\suite2p__main.py", line 78, in ERROR<<< main() File "C:\Users\60288184\Anaconda3\envs\suite2p\lib\site-packages\suite2p\main__.py", line 71, in main ERROR<<< run_s2p(ops, db) File "C:\Users\60288184\Anaconda3\envs\suite2p\lib\site-packages\suite2p\run_s2p.py", line 429, in run_s2p op = run_plane(op, ops_path=ops_path) File "C:\Users\60288184\Anaconda3\envs\suite2p\lib\site-packages\suite2p\run_s2p.py", line 292, in run_plane ERROR<<< ops = pipeline(f_reg, f_raw, f_reg_chan2, f_raw_chan2, run_registration, ops, stat=stat) File "C:\Users\60288184\Anaconda3\envs\suite2p\lib\site-packages\suite2p\run_s2p.py", line 129, in pipeline ops, stat = detection.detection_wrapper(f_reg, File "C:\Users\60288184\Anaconda3\envs\suite2p\lib\site-packages\suite2p\detection\detect.py", line 148, in detection_wrapper stat = select_rois( File "C:\Users\60288184\Anaconda3\envs\suite2p\lib\site-packages\suite2p\detection\detect.py", line 203, in select_rois new_ops, stat = sparsedetect.sparsery( File "C:\Users\60288184\Anaconda3\envs\suite2p\lib\site-packages\suite2p\detection\sparsedetect.py", line 307, in sparsery scale, estimate_mode = find_best_scale(I=I, spatial_scale=spatial_scale) File "C:\Users\60288184\Anaconda3\envs\suite2p\lib\site-packages\suite2p\detection\sparsedetect.py", line 266, in find_best_scale scale = estimate_spatial_scale(I=I) File "C:\Users\60288184\Anaconda3\envs\suite2p\lib\site-packages\suite2p\detection\sparsedetect.py", line 256, in estimate_spatialscale im, = mode(imap[ipk][isort[:50]], keepdims=True) TypeError: mode() got an unexpected keyword argument 'keepdims' Interrupted by error (not finished)

220929_example data_error_downgradedpython to 3.8.txt

samilcase commented 1 year ago

I'm new to suite2P as well and having this exact same issue...

{'data_path': ['C:/Users/slca230/Downloads'], 'subfolders': [], 'save_path0': 'C:/Users/slca230/Downloads', 'fast_disk': 'C:/Users/slca230/Downloads', 'input_format': 'tif'} tif Found 1 tifs - converting to binary 2000 frames of binary, time 3.47 sec. 4000 frames of binary, time 6.32 sec. time 7.18 sec. Wrote 4500 frames per binary for 1 planes

PLANE 0 <<<<<<<<<<<<<<<<<<<<<< NOTE: not registered / registration forced with ops['do_registration']>1 (no previous offsets to delete) NOTE: applying default C:\Users\slca230.suite2p\classifiers\classifier_user.npy ----------- REGISTRATION Reference frame, 11.13 sec. Registered 500/4500 in 10.53s Registered 1000/4500 in 20.50s Registered 1500/4500 in 30.33s Registered 2000/4500 in 40.18s Registered 2500/4500 in 50.05s Registered 3000/4500 in 59.83s Registered 3500/4500 in 69.72s Registered 4000/4500 in 79.23s Registered 4500/4500 in 89.19s ----------- Total 105.07 sec Registration metrics, 16.53 sec. ----------- ROI DETECTION Binning movie in chunks of length 10 Binned movie of size [450,319,552] created in 3.90 sec. ERROR<<< Traceback (most recent call last): File "C:\Users\slca230\Anaconda3\lib\runpy.py", line 197, in _run_module_as_main ERROR<<< return _run_code(code, main_globals, None, File "C:\Users\slca230\Anaconda3\lib\runpy.py", line 87, in _run_code exec(code, run_globals) File "C:\Users\slca230\suite2p\suite2p__main.py", line 78, in main() File "C:\Users\slca230\suite2p\suite2p\main__.py", line 71, in main run_s2p(ops, db) File "C:\Users\slca230\suite2p\suite2p\run_s2p.py", line 443, in run_s2p op = run_plane(op, ops_path=ops_path) File "C:\Users\slca230\suite2p\suite2p\run_s2p.py", line 296, in run_plane ERROR<<< ops = pipeline(f_reg, f_raw, f_reg_chan2, f_raw_chan2, run_registration, ops, stat=stat) File "C:\Users\slca230\suite2p\suite2p\run_s2p.py", line 129, in pipeline ops, stat = detection.detection_wrapper(f_reg, File "C:\Users\slca230\suite2p\suite2p\detection\detect.py", line 148, in detection_wrapper stat = select_rois( File "C:\Users\slca230\suite2p\suite2p\detection\detect.py", line 202, in select_rois ERROR<<< new_ops, stat = sparsedetect.sparsery( File "C:\Users\slca230\suite2p\suite2p\detection\sparsedetect.py", line 307, in sparsery scale, estimate_mode = find_best_scale(I=I, spatial_scale=spatial_scale) File "C:\Users\slca230\suite2p\suite2p\detection\sparsedetect.py", line 266, in find_best_scale scale = estimate_spatial_scale(I=I) File "C:\Users\slca230\suite2p\suite2p\detection\sparsedetect.py", line 256, in estimate_spatialscale im, = mode(imap[ipk][isort[:50]], keepdims=True) TypeError: mode() got an unexpected keyword argument 'keepdims' Interrupted by error (not finished)

chriski777 commented 1 year ago

Hi @enot14134 and @samilcase, just wondering, what version of scipy do you have installed on your machines?

chriski777 commented 1 year ago

Also, can you specify which version of suite2p you are using?

samilcase commented 1 year ago

Hi there. I was using the latest version of suite2p (V0.11.1). I believe it was an error that occurred during the installation process. I removed all versions and tried again and it seems to work perfectly now. Thanks!

cgaletzka commented 1 year ago

Hi, could you please let me know how you installed the newest version (python version etc.)? I’m having the same problem and reinstalling suite2p does not solve the error for me…


From: Sami Case @.> Sent: Monday, October 17, 2022 3:40:48 AM To: MouseLand/suite2p @.> Cc: Cedric Galetzka @.>; Manual @.> Subject: Re: [MouseLand/suite2p] TypeError: mode() got an unexpected keyword argument 'keepdims' (Issue #886)

Hi there. I was using the latest version of suite2p (V0.11.1). I believe it was an error that occurred during the installation process. I removed all versions and tried again and it seems to work perfectly now. Thanks!

— Reply to this email directly, view it on GitHubhttps://github.com/MouseLand/suite2p/issues/886#issuecomment-1280028432, or unsubscribehttps://github.com/notifications/unsubscribe-auth/ANVZR7NV7CLZIX5YNUK7QX3WDRD3BANCNFSM6AAAAAAQZLPUDE. You are receiving this because you are subscribed to this thread.Message ID: @.***>

chriski777 commented 1 year ago

Hi @cgaletzka, hope these steps help:

  1. First, make sure you've activated the conda environment for suite2p: conda activate suite2p.
  2. You can try uninstalling suite2p by running:pip uninstall suite2p.
  3. Run pip install suite2p.
  4. You can then check what version you have by running pip show suite2p.
cgaletzka commented 1 year ago

Hi @chriski777 , thanks for your response. I reinstalled suite2p with these instructions, but I keep getting the same error as before. suite2p version is 0.11.1 with python 3.8.12 and scipy 1.8.0

Here is a list of the packages and version in my conda environment:

packages in environment at C:\Users\cedri.conda\envs\suite2p:

Name Version Build Channel argon2-cffi 21.3.0 pypi_0 pypi argon2-cffi-bindings 21.2.0 pypi_0 pypi asttokens 2.0.5 pypi_0 pypi attrs 21.4.0 pypi_0 pypi backcall 0.2.0 pypi_0 pypi bcrypt 3.2.0 pypi_0 pypi beautifulsoup4 4.10.0 pypi_0 pypi blas 1.0 mkl bleach 4.1.0 pypi_0 pypi brotli 1.0.9 ha925a31_2 ca-certificates 2022.2.1 haa95532_0 cellpose 2.0.4 pypi_0 pypi certifi 2021.10.8 py38haa95532_2 cffi 1.15.0 pypi_0 pypi click 7.1.2 pypi_0 pypi colorama 0.4.4 pypi_0 pypi cryptography 36.0.1 pypi_0 pypi cycler 0.11.0 pyhd3eb1b0_0 debugpy 1.5.1 pypi_0 pypi decorator 5.1.1 pypi_0 pypi defusedxml 0.7.1 pypi_0 pypi entrypoints 0.4 pypi_0 pypi executing 0.8.3 pypi_0 pypi fastremap 1.12.2 pypi_0 pypi fonttools 4.25.0 pyhd3eb1b0_0 freetype 2.10.4 hd328e21_0 h5py 2.10.0 py38h5e291fa_0 hdf5 1.10.4 h7ebc959_0 hdmf 3.2.1 pypi_0 pypi icc_rt 2020.2 intel_254 numba icu 58.2 ha925a31_3 importlib-metadata 4.11.3 pypi_0 pypi importlib-resources 5.4.0 pypi_0 pypi intel-openmp 2021.4.0 haa95532_3556 ipykernel 6.9.2 pypi_0 pypi ipython 8.1.1 pypi_0 pypi ipython-genutils 0.2.0 pypi_0 pypi jedi 0.18.1 pypi_0 pypi jinja2 3.0.3 pypi_0 pypi joblib 1.1.0 pyhd3eb1b0_0 jpeg 9d h2bbff1b_0 jsonschema 4.4.0 pypi_0 pypi jupyter-client 7.1.2 pypi_0 pypi jupyter-core 4.9.2 pypi_0 pypi jupyterlab-pygments 0.1.2 pypi_0 pypi kiwisolver 1.3.2 py38hd77b12b_0 libpng 1.6.37 h2a8f88b_0 libtiff 4.2.0 hd0e1b90_0 libwebp 1.2.2 h2bbff1b_0 llvmlite 0.38.0 py38_0 numba lz4-c 1.9.3 h2bbff1b_1 markupsafe 2.1.0 pypi_0 pypi matplotlib 3.5.1 py38haa95532_0 matplotlib-base 3.5.1 py38hd77b12b_0 matplotlib-inline 0.1.3 pypi_0 pypi mistune 0.8.4 pypi_0 pypi mkl 2021.4.0 haa95532_640 mkl-service 2.4.0 py38h2bbff1b_0 mkl_fft 1.3.1 py38h277e83a_0 mkl_random 1.2.2 py38hf11a4ad_0 munkres 1.1.4 py_0 natsort 8.1.0 pypi_0 pypi nbclient 0.5.13 pypi_0 pypi nbconvert 6.4.4 pypi_0 pypi nbformat 5.2.0 pypi_0 pypi nest-asyncio 1.5.4 pypi_0 pypi notebook 6.4.9 pypi_0 pypi numba 0.55.1 np1.11py3.8h7b37a8b_g76720bf88_0 numba numpy 1.21.5 py38ha4e8547_0 numpy-base 1.21.5 py38hc2deb75_0 opencv-python 4.5.5.64 pypi_0 pypi opencv-python-headless 4.5.5.64 pypi_0 pypi openssl 1.1.1m h2bbff1b_0 packaging 21.3 pyhd3eb1b0_0 pandas 1.4.1 pypi_0 pypi pandocfilters 1.5.0 pypi_0 pypi paramiko 2.10.2 pypi_0 pypi parso 0.8.3 pypi_0 pypi pickleshare 0.7.5 pypi_0 pypi pillow 9.0.1 py38hdc2b20a_0 pip 21.2.2 py38haa95532_0 prometheus-client 0.13.1 pypi_0 pypi prompt-toolkit 3.0.28 pypi_0 pypi psutil 5.9.0 pypi_0 pypi pure-eval 0.2.2 pypi_0 pypi pycparser 2.21 pypi_0 pypi pygments 2.11.2 pypi_0 pypi pynacl 1.5.0 pypi_0 pypi pynwb 2.0.0 pypi_0 pypi pyparsing 3.0.4 pyhd3eb1b0_0 pyqt 5.9.2 py38hd77b12b_6 pyqt5 5.15.4 pypi_0 pypi pyqt5-plugins 5.15.4.2.2 pypi_0 pypi pyqt5-qt5 5.15.2 pypi_0 pypi pyqt5-sip 12.9.1 pypi_0 pypi pyqt5-tools 5.15.4.3.2 pypi_0 pypi pyqtgraph 0.12.4 pypi_0 pypi pyreadline 2.1 py38_1 pyrsistent 0.18.1 pypi_0 pypi python 3.8.12 h6244533_0 python-dateutil 2.8.2 pyhd3eb1b0_0 python-dotenv 0.19.2 pypi_0 pypi pytz 2021.3 pypi_0 pypi pywin32 303 pypi_0 pypi pywinpty 2.0.5 pypi_0 pypi pyzmq 22.3.0 pypi_0 pypi qt 5.9.7 vc14h73c81de_0 qt5-applications 5.15.2.2.2 pypi_0 pypi qt5-tools 5.15.2.1.2 pypi_0 pypi rastermap 0.1.3 pypi_0 pypi ruamel-yaml 0.17.21 pypi_0 pypi ruamel-yaml-clib 0.2.6 pypi_0 pypi sbxreader 0.2.0 pypi_0 pypi scanimage-tiff-reader 1.4.1 pypi_0 pypi scikit-learn 1.0.2 py38hf11a4ad_1 scipy 1.8.0 pypi_0 pypi send2trash 1.8.0 pypi_0 pypi setuptools 58.0.4 py38haa95532_0 sip 4.19.13 py38hd77b12b_0 six 1.16.0 pyhd3eb1b0_1 soupsieve 2.3.1 pypi_0 pypi sqlite 3.38.0 h2bbff1b_0 stack-data 0.2.0 pypi_0 pypi suite2p 0.11.1 pypi_0 pypi tbb 2021.5.0 h59b6b97_0 terminado 0.13.3 pypi_0 pypi testpath 0.6.0 pypi_0 pypi threadpoolctl 2.2.0 pyh0d69192_0 tifffile 2022.2.9 pypi_0 pypi tk 8.6.11 h2bbff1b_0 torch 1.11.0 pypi_0 pypi tornado 6.1 py38h2bbff1b_0 tqdm 4.64.0 pypi_0 pypi traitlets 5.1.1 pypi_0 pypi typing-extensions 4.1.1 pypi_0 pypi vc 14.2 h21ff451_1 vs2015_runtime 14.27.29016 h5e58377_2 wcwidth 0.2.5 pypi_0 pypi webencodings 0.5.1 pypi_0 pypi wheel 0.37.1 pyhd3eb1b0_0 wincertstore 0.2 py38haa95532_2 xz 5.2.5 h62dcd97_0 zipp 3.7.0 pypi_0 pypi zlib 1.2.11 h8cc25b3_4 zstd 1.4.9 h19a0ad4_0

JAMoreno-Larios commented 1 year ago

I had the very same error as @enot14134 and others, I was using Scipy 1.8.0. I updated it to Scipy 1.9.2 and the problem was fixed.

chriski777 commented 1 year ago

Hey @cgaletzka, sorry about that, it seems one of my steps had an error. As @JAMoreno-Larios mentioned, this has to do with the scipy version you have installed. suite2p requires the version of scipy to be >= 1.9.0.

Can you try reinstalling suite2p with the following command python -m pip install suite2p instead of pip install suite2p? Make sure you activated the suite2p environment with conda activate suite2p and that you're in the suite2p directory (should contain setup.py) when calling python -m pip install suite2p.

You can also fix this by just upgrading scipy to any version above 1.9.0. I'll keep this closed for now but feel free to re-open if this issue persists!