Open Alex-code-lab opened 2 years ago
This is because of a subtle issue involving Python's multiprocessing
module on Windows. If you are unsure of how to follow the advice, a search of the old issues in this repository, or a Google search of the internet, will turn up some help. The workaround in trackpy is to use the processes=1
argument to batch
to turn off multiprocessing altogether.
Thank you @nkeim for your answer. I'm running it on a macBook Air, might be the same problem as with Windows. I will check this and try to turn it off tomorrow.
Hi @Alex-code-lab , I'm noticing that from the traceback the following lines are reported:
This probably means that you are not using fork to start your
child processes and you have forgotten to use the proper idiom
in the main module:
if __name__ == '__main__':
freeze_support()
...
The "freeze_support()" line can be omitted if the program
is not going to be frozen to produce an `executable.`
This happened to me too while running some other code using the multiprocessing
package (I use Windows). If you're planning to use it without using trackpy.batch
, you might want to wrap your script in the if condition if __name__ == "__main__":
. This won't fix the issue with the batch
call but it'll avoid problems when running parallel code.
Hi @jacopoabramo,
Thank you for your answer.
I diged the multiprocessing library (not so hard ahah) and I found that on MacOs since python 3.8, the multriprocessing method using by default is the 'spawn' one.
By simply writing :
import multiprocessing
multiprocessing.get_start_method()
should appear 'spawn"
Then, I simply wrote :
multiprocessing.set_start_method('fork', True)
and now the code runs. It might also help you!
Thank you for your helps!
Hello,
I just began to use trackpy to follow cells during migration. unfortunately, an error occurs when I run the code. It runs in loop because of a runtimeerror on the tp.batch and I have no idea why. Here is the error I get :
and here is the code I'm using :
Do you have an idea to solve this issue ?
Thank you for your help!!
Bye!