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

Importing zarr in app packaged by pyinstaller continually restarts the script #1676

Closed
pearcetm opened this issue Feb 24, 2024 · 1 comment
Closed
Labels
bug Potential issues with the zarr-python library

Comments

@pearcetm
Copy link

Zarr version

v2.17.0

Numcodecs version

v0.12.1

Python Version

3.10

Operating System

Mac

Installation

using pip into virtual environment

Description

Within an application built by pyinstaller, the application keeps getting recursively run somehow. I'm not sure whether this is best considered a pyinstaller problem or a zarr problem, but zarr is the only library I've seen this happen with so far. I am looking for ideas on what could be causing this behavior.

Steps to reproduce

In test.py

import zarr
print('Starting test.py')
print(zarr)
print('Exiting')

On the command line (in your virtual env)

pip install zarr
pip install pyinstaller
python -m PyInstaller test.py

Running python test.py gives the following:
image

Running dist/test/test (built by pyinstaller) leads to this:
image

Ctrl-c in the command window doesn't kill the loop, though it appears it can kill individual processes as they scroll by.

Additional output

No response

@pearcetm pearcetm added the bug Potential issues with the zarr-python library label Feb 24, 2024
@pearcetm
Copy link
Author

Did some more searching. Following this stack overflow answer fixes this issue.

Adding this to the beginning of my script stopped the behavior described above.

import multiprocessing
multiprocessing.set_start_method('forkserver', force=True)
multiprocessing.freeze_support()

So, not a zarr problem after all.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Potential issues with the zarr-python library
Projects
None yet
Development

No branches or pull requests

1 participant