kushalkolar / MESmerize

Platform for Calcium Imaging analysis. DEPRECATED.
GNU General Public License v3.0
58 stars 14 forks source link

[BUG Daemonic processes are not allowed to have children #67

Closed mestmas closed 2 years ago

mestmas commented 2 years ago

Hi all,

Describe the bug I'm trying to run "extractstim" from flowchart and I always get the program bolcked and the error: Daemonic processes are not allowed to have children.

To Reproduce Steps to reproduce the behavior, for example: image

Expected behavior Extract portions of curves according to stimulus mpas

Copy paste message from the error window (if any) image

Operating System & specs (CPU, RAM etc.). Please complete the following information:

Details about your Mesmerize install using anaconda pip install 21.0.1

Additional context Add any other context about the problem here.

Thanks in advance!!

kushalkolar commented 2 years ago

@DanielDondorp this seems windows specific, any ideas? Related to the way windows does forking?

Fastest solution is probably to just use threading if windows, multiprocessing if not windows.

DanielDondorp commented 2 years ago

I vaguely remember that you can make non-daemonic pools. Doing that to the top-level here would solve this I think. I can't look into it deeply right now but I will have a look tomorrow.

DanielDondorp commented 2 years ago

@kushalkolar What I had in mind yesterday will not work with python3.6 I see. Would have been nice to try changing out the Pool import with this: from concurrent.futures import ProcessPoolExecutor as Pool

A work-around for earlier python versions might be detailed here but the implementation is a bit more involved.

Otherwise perhaps just using multiprocessing.pool.ThreadPool in analysis/stimulus_extraction.py?

mestmas commented 2 years ago

Hi guys, thanks for your help.

@DanielDondorp do you mean that I can try to substitute "from multiprocessing import Pool" with "from concurrent.futures import ProcessPoolExecutor as Pool" in stimulus_extraction.py?

Thanks again.

DanielDondorp commented 2 years ago

Hi! you could try replacing the import it with 'multiprocessing.pool.ThreadPool' since I don't think the other thing will work with anything under python 3.8

@kushalkolar will know if I actually found the correct import.

kushalkolar commented 2 years ago

@mestmas what Python version are you using for mesmerize?

mestmas commented 2 years ago

@kushalkolar I'm using 3.8 (thought was 3.6). I've try multiprocessing.pool.ThreadPool but I get the following error: import multiprocess.pool.ThreadPool as Pool ModuleNotFoundError: No module named 'multiprocess.pool.ThreadPool'; 'multiprocess.pool' is not a package" but the function is there. Later, since my python is 3.8, I try "from multiprocessing import Pool" and I got the following error : 'ProcessPoolExecutor' object has no attribute 'imap'

image

DanielDondorp commented 2 years ago

I suppose for the first fix it is a typo: 'multiprocess' instead of multiprocessing

mestmas commented 2 years ago

@DanielDondorp no sorry, I made the typo when I wrote it here, in the script is properly written "import multiprocess.pool.ThreadPool as Pool"

DanielDondorp commented 2 years ago

Sorry, I am a bit confused now. It is supposed to be: import multiprocessing.pool.ThreadPool as Pool. The error you get suggests that you wrote multiprocess and not multiprocessing in the file.

mestmas commented 2 years ago

sorry, you are right, I try import multiprocessing.pool.ThreadPool as Pool and since it was giving me an error I try import multiprocess.pool.ThreadPool as Pool and Looks that I took the screenshot for the wrong one
image

DanielDondorp commented 2 years ago

Sorry, my bad. Can you try rewording the import as from multiprocessing.pool import ThreadPool as Pool? image

mestmas commented 2 years ago

@DanielDondorp I changed it and it seems to work, I'll check the output tomorrow!! Thanks!!!

DanielDondorp commented 2 years ago

Good to hear!

mestmas commented 2 years ago

Sorry, I'm a bit useless. I'm trying to use heat-map to visualize it. Is it correct? because I don't manage to see anything that makes sense for me. (thanks for your help)

kushalkolar commented 2 years ago

What're you trying to visualize? The ExtractStims node is useful for plotting things like average traces in notebooks.

kushalkolar commented 2 years ago

closing, you're welcome to re-open if you still have issues or post a new issue.