Issues with installation of suite2p
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 "
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
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.
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!
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?
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.
Also experiencing this problem; Trying to run Suite2p with files from DANDI and Dandihub has updated their Python version, which I don't have control over.
I think you can do one of two things:
-
you can edit the
suite2psource code yourself to get it up to speed (as far as I can, it's really only a simple change that should not affect anything: change line 59 of suite2p/detection/stats.py torsort : np.ndarray = field(default_factory=lambda: np.sort(distance_kernel(radius=30).flatten()), repr=False)) or -
you can use one of the various forks that are compatible with more recent versions. For example, I use my own branch of
suite2pwhere I updated the continuous integration tests to ensure compatibility with newer versions of Python up to 3.12 and across OSes. But be wary of any foreign code on Github -- even if the CI tests run you don't know that something we didn't test isn't broken! https://github.com/StephenThornquist/suite2p/tree/ci_macos_fix_and_py311
If suite2p is installed as a dependency in one of your other libraries (or you make it a dependency in one of your own tools), and you're willing to be extra brave, you can also ensure those users install a Py >=311 -compliant branch by modifying the dependencies of your pyproject.toml, e.g. dependencies = [... , "suite2p @ git+https://github.com/StephenThornquist/suite2p.git"]
Yeah, my platform, the OpenScope Databook is intended to be launchable by many people and we'd like to keep the environment tinkering processing simple.
Are there plans to keep Suite2p up to date with newer version of Python? If not, I'll probably try to option 3.
sorry for the trouble here, we plan to update suite2p to support python 3.11 and 3.12 in ~2 months. in the meantime thanks @StephenThornquist your fork seems very helpful!