MouseLand / suite2p

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

Issues with installation of suite2p #1128

Open GiangTranHU opened 2 weeks ago

GiangTranHU commented 2 weeks ago

Describe the issue:

Dear Marius and suite2p administrative team, I am Giang Tran, from Japan. I am using your program suite2p for my research. Unfortunately, when I tried to install it, I got the following errors, I hope you can give me advice to resolve the problem. When I installed it from anaconda, I got the following error after typing "python -m suite2p"

Traceback (most recent call last): File "", line 189, in _run_module_as_main File "", line 148, in _get_module_details File "", line 112, in _get_module_details File "C:\Users\gtran\anaconda3\envs\suite2p\Lib\site-packages\suite2p__init__.py", line 6, in from .run_s2p import run_s2p, run_plane, pipeline File "C:\Users\gtran\anaconda3\envs\suite2p\Lib\site-packages\suite2p\run_s2p.py", line 15, in from . import extraction, io, registration, detection, classification, default_ops File "C:\Users\gtran\anaconda3\envs\suite2p\Lib\site-packages\suite2p\extraction__init.py", line 5, in from .extract import create_masks_and_extract, enhanced_mean_image, extract_traces_from_masks, extraction_wrapper File "C:\Users\gtran\anaconda3\envs\suite2p\Lib\site-packages\suite2p\extraction\extract.py", line 11, in from .masks import create_masks File "C:\Users\gtran\anaconda3\envs\suite2p\Lib\site-packages\suite2p\extraction\masks.py", line 9, in from ..detection.sparsedetect import extendROI File "C:\Users\gtran\anaconda3\envs\suite2p\Lib\site-packages\suite2p\detection\init__.py", line 4, in from .detect import detect, detection_wrapper, bin_movie File "C:\Users\gtran\anaconda3\envs\suite2p\Lib\site-packages\suite2p\detection\detect.py", line 9, in from . import sourcery, sparsedetect, chan2detect, utils File "C:\Users\gtran\anaconda3\envs\suite2p\Lib\site-packages\suite2p\detection\sourcery.py", line 12, in from .stats import fitMVGaus File "C:\Users\gtran\anaconda3\envs\suite2p\Lib\site-packages\suite2p\detection\stats.py", line 52, in @dataclass(frozen=True) ^^^^^^^^^^^^^^^^^^^^^^ File "C:\Users\gtran\anaconda3\envs\suite2p\Lib\dataclasses.py", line 1220, in wrap return _process_class(cls, init, repr, eq, order, unsafe_hash, ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "C:\Users\gtran\anaconda3\envs\suite2p\Lib\dataclasses.py", line 958, in _process_class cls_fields.append(_get_field(cls, name, type, kw_only)) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "C:\Users\gtran\anaconda3\envs\suite2p\Lib\dataclasses.py", line 815, in _get_field raise ValueError(f'mutable default {type(f.default)} for field ' ValueError: mutable default <class 'numpy.ndarray'> for field rsort is not allowed: use default_factory.

I am using python 3.11.7.

I also tried to install using the instruction " Clone the repository with git and cd suite2p Run pip install -e . in that folder " Then, I tried the jupyter notebook "run_suite2p_colab_2023" at the cell " ops = suite2p.default_ops() ops['batch_size'] = 200 # we will decrease the batch_size in case low RAM on computer ops['threshold_scaling'] = 2.0 # we are increasing the threshold for finding ROIs to limit the number of non-cell ROIs found (sometimes useful in gcamp injections) ops['fs'] = 13 # sampling rate of recording, determines binning for cell detection ops['tau'] = 1.25 # timescale of gcamp to use for deconvolution print(ops) " I also got an error "

TypeError Traceback (most recent call last) Cell In[19], line 3 1 #print(suite2p.version) 2 #from suite2p import default_ops ----> 3 ops = suite2p.default_ops() 4 ops['batch_size'] = 200 # we will decrease the batch_size in case low RAM on computer 5 ops['threshold_scaling'] = 2.0 # we are increasing the threshold for finding ROIs to limit the number of non-cell ROIs found (sometimes useful in gcamp injections)

TypeError: 'module' object is not callable "

Would you please give me advice on how to solve the problems? Thank you very much and I am looking forward to hearing from you! Best, Giang Tran

Provide environment info:

active environment : suite2p active env location : C:\Users\gtran\anaconda3\envs\suite2p shell level : 2 user config file : C:\Users\gtran.condarc populated config files : C:\Users\gtran.condarc conda version : 24.4.0 conda-build version : 24.1.2 python version : 3.11.7.final.0 solver : libmamba (default) virtual packages : archspec=1=x86_64_v4 conda=24.4.0=0 cuda=12.3=0 win=0=0 base environment : C:\Users\gtran\anaconda3 (writable) conda av data dir : C:\Users\gtran\anaconda3\etc\conda conda av metadata url : None channel URLs : https://repo.anaconda.com/pkgs/main/win-64 https://repo.anaconda.com/pkgs/main/noarch https://repo.anaconda.com/pkgs/r/win-64 https://repo.anaconda.com/pkgs/r/noarch https://repo.anaconda.com/pkgs/msys2/win-64 https://repo.anaconda.com/pkgs/msys2/noarch package cache : C:\Users\gtran\anaconda3\pkgs C:\Users\gtran.conda\pkgs C:\Users\gtran\AppData\Local\conda\conda\pkgs envs directories : C:\Users\gtran\anaconda3\envs C:\Users\gtran.conda\envs C:\Users\gtran\AppData\Local\conda\conda\envs platform : win-64 user-agent : conda/24.4.0 requests/2.31.0 CPython/3.11.7 Windows/10 Windows/10.0.22631 solver/libmamba conda-libmamba-solver/24.1.0 libmambapy/1.5.6 aau/0.4.3 c/kG-aFcIWoPdrzB3QmON-aQ s/9Mi_-x20V1u2hkqmK45u8w e/kPgv2tDRiRGO7hI7D-X34w administrator : False netrc file : None offline mode : False

StephenThornquist commented 1 week ago

This is explored in issue #1047 -- suite2p is not compatible with Python >=3.11 as far as I can tell due to a single line that is not compatible with the builtin dataclasses, and can't even be imported to test whether anything is broken until they fix this bug (which appears not to be a priority?). I've been using it (in a fairly limited way) in Python 3.10 but I'll echo that it would be nice to see this fixed.

GiangTranHU commented 3 days ago

Thank you very much for your help! Since I am new to suite2p, may I have a few questions? Can suite2p be used for 3D images? Would you please give me some tips to apply suite2p to 3D images? Thank you very much!

StephenThornquist commented 3 days ago

I haven't actually tried to use it for analyses; personally I only use it for image registration because I work in Drosophila and our signal extraction and ROI identification needs are pretty different from rodent. Since the default_ops contains an entry for n_planes and a recent commit has the message "fixing bug with multi-plane nonrigid ops", my guess is there are some features intended for 3d imaging, though quickly scanning some of the files I don't see it come up in that many places. It might be useful if you were more specific about what you're trying to do, and maybe someone else can help answer?

GiangTranHU commented 2 days ago

Hi Stephen, Thank you very much for your comments! In fact, I want to detect cells in 3D images of mouse brain. I am considering applying suite2p, but as I was known it is only for 2D. It should be more convenient if it can be extended to 3D. I am also looking for some other softwares which can be used for 3D, but currently I could not find one.