Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ForkingPickler can't pickle #9

Closed
biswajitSM opened this issue May 15, 2020 · 6 comments
Closed

ForkingPickler can't pickle #9

biswajitSM opened this issue May 15, 2020 · 6 comments

Comments

@biswajitSM
Copy link

biswajitSM commented May 15, 2020

Hi,
I was trying out the pycro-manager with democamera config in microanager-gamma (14May nightly build) in a jupyter notebook with the following codes as documented.

from pycromanager import Acquisition, multi_d_acquisition_events

with Acquisition(directory=r'C:\Users\biswajitpradha\Reseach\analysis\PycroManager\data', name='acquisition_name') as acq:
    events = multi_d_acquisition_events(
                                    num_time_points=4, time_interval_s=0,
                                    channel_group='channel', channels=['DAPI', 'FITC'],
                                    z_start=0, z_end=6, z_step=0.4,
                                    order='tcz')

But it showed an error:

AttributeError: Can't pickle local object 'Acquisition.__init__.<locals>.event_sending_fn'

full error pic:
image

Do you know what's going wrong here?

Thanks, Biswajit

@henrypinkard
Copy link
Member

Appears to be something specific to python launching new processes on Windows. I just pushed a new version that may fix this. Upgrade to version 0.0.3 with pip install pycromanager --upgrade and give it a try

@dpshepherd
Copy link
Contributor

Hi @henrypinkard ,

Thanks for the hard work on this! Same issue here. I just tried to install version 0.0.3 and it isn't found. pip install reports that only 0.0.1 and 0.0.2 are available.

Looking forward to trying the package out on a couple of our rigs,
Doug

@henrypinkard
Copy link
Member

Whoops, look like I somehow forgot to push. Its up now. Let me know how it goes

@dpshepherd
Copy link
Contributor

This code,

from pycromanager import Acquisition, multi_d_acquisition_events

with Acquisition(directory=r'C://testing//data', name='acquisition_name') as acq:
    events = multi_d_acquisition_events(
                                    num_time_points=4, time_interval_s=0,
                                    channel_group='channel', channels=['DAPI', 'FITC'],
                                    z_start=0, z_end=6, z_step=0.4,
                                    order='tcz')

used with version 0.0.3 now gives the following error:

TypeError: no default __reduce__ due to non-trivial __cinit__

full error picture:
image

@henrypinkard
Copy link
Member

looks like this is a quirk with how windows handles multiple processes. For the time being, you can fix this by putting your whole script in a block with:

if __name__ == '__main__':
     with Acquisition...

I'm going to keep playing around to see if I can find a more durable solution

@henrypinkard
Copy link
Member

I guess the above is the best solution possible due to how multiprocessing is implemented on windows. This should be fixed by #18, and I just pushed version 0.2.0 to pip that has these changes.

You'll need to get the next MM nightly build after this PR merges (micro-manager/micro-manager#805).

Closing for now since I think this is fixed. Open a new one if you run into something else

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants