-
Notifications
You must be signed in to change notification settings - Fork 128
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
Update hook-tensorflow.py #564
Conversation
In the recent TF 2.12 release, there is a new file `libtensorflow_cc.so.2` which now appears twice in the final output: once correctly in the root directory (as 'binary') and once incorrectly in the `tensorflow` subdirectory (as 'data' file). This new file is where they moved the majority of the code, it's over 500 MB, so this duplication causes a lot of overhead. To reproduce the issue, install `tensorflow==2.12` or `tensorflow-cpu==2.12` and package a file with only `import tensorflow`. With these changes the file only appears once in the final output and the package still works as expected. I have tested this change on Linux only.
Just for the record, it is actually the other way around; because the binary dependency analysis (incorrectly) collects the copy (as binary) to the root directory, the data copy in the subdirectory needs to be suppressed. At least until we sort out preservation of binaries' subdirectory structure on all platforms. |
Looks good. Please add a news entry for the change, and we can merge this. |
Thanks for the quick response! |
Thanks @Tombana! |
…3.2 (#45) Bumps [pyinstaller-hooks-contrib](https://github.com/pyinstaller/pyinstaller-hooks-contrib) from 2023.1 to 2023.2. <details> <summary>Release notes</summary> <p><em>Sourced from <a href="https://github.com/pyinstaller/pyinstaller-hooks-contrib/releases">pyinstaller-hooks-contrib's releases</a>.</em></p> <blockquote> <h2>2023.2</h2> <p>Please see the <a href="https://github.com/pyinstaller/pyinstaller-hooks-contrib/tree/master/CHANGELOG.rst">changelog</a> for more details</p> </blockquote> </details> <details> <summary>Changelog</summary> <p><em>Sourced from <a href="https://github.com/pyinstaller/pyinstaller-hooks-contrib/blob/master/CHANGELOG.rst">pyinstaller-hooks-contrib's changelog</a>.</em></p> <blockquote> <h2>2023.2 (2023-04-07)</h2> <p>New hooks</p> <pre><code> * Add hooks for ``moviepy.audio.fx.all`` and ``moviepy.video.fx.all`` that collect all corresponding submodules, so that importing ``moviepy.editor`` from MoviePy works out-of-the-box in the frozen application. (`[#559](pyinstaller/pyinstaller-hooks-contrib#559) <https://github.com/pyinstaller/pyinstaller-hooks-contrib/issues/559>`_) <p>Updated hooks </code></pre></p> <ul> <li>Add automatic increase of recursion limit in the <code>torch</code> hook to ensure that recursion limit is at least 5000 if <code>torch</code> 2.0.0 or later is detected. (<code>[#570](pyinstaller/pyinstaller-hooks-contrib#570) <https://github.com/pyinstaller/pyinstaller-hooks-contrib/issues/570></code>_)</li> <li>Extend <code>cv2</code> hook with support for OpenCV built manually from source and for OpenCV installed using the official Windows installer. This support requires PyInstaller >= 5.3 to work properly. (<code>[#557](pyinstaller/pyinstaller-hooks-contrib#557) <https://github.com/pyinstaller/pyinstaller-hooks-contrib/issues/557></code>_)</li> <li>Update <code>scikit-image</code> hooks for compatibility with the 0.19.x series; account for lazy module loading in <code>skimage.filters</code>. (<code>[#565](pyinstaller/pyinstaller-hooks-contrib#565) <https://github.com/pyinstaller/pyinstaller-hooks-contrib/issues/565></code>_)</li> <li>Update <code>scikit-image</code> hooks for compatibility with the 0.20.x series; account for switch to <code>lazy_module</code> in <code>skimage.data</code> and <code>skimage.filters</code> as well as in main package. Collect new data files that are now required by <code>skimage.morphology</code>. (<code>[#565](pyinstaller/pyinstaller-hooks-contrib#565) <https://github.com/pyinstaller/pyinstaller-hooks-contrib/issues/565></code>_)</li> <li>Update the hook for <code>tensorflow</code> to be compatible with TensorFlow 2.12. (<code>[#564](pyinstaller/pyinstaller-hooks-contrib#564) <https://github.com/pyinstaller/pyinstaller-hooks-contrib/issues/564></code>_)</li> </ul> </blockquote> </details> <details> <summary>Commits</summary> <ul> <li><a href="https://github.com/pyinstaller/pyinstaller-hooks-contrib/commit/c317371a98ccb03f202774142fe6c51c72b42c94"><code>c317371</code></a> Release v2023.2</li> <li><a href="https://github.com/pyinstaller/pyinstaller-hooks-contrib/commit/af3272702eeeddfd7a19b3bdb4b39436adfa8d5c"><code>af32727</code></a> hooks: torch: automatically increase recursion limit for torch >= 2.0.0 (<a href="https://github.com/pyinstaller/pyinstaller-hooks-contrib/issues/570">#570</a>)</li> <li><a href="https://github.com/pyinstaller/pyinstaller-hooks-contrib/commit/988208a7c187cb500c3a607f59e5dd5fdb84b9f1"><code>988208a</code></a> Scheduled weekly dependency update for week 14 (<a href="https://github.com/pyinstaller/pyinstaller-hooks-contrib/issues/569">#569</a>)</li> <li><a href="https://github.com/pyinstaller/pyinstaller-hooks-contrib/commit/43c1eb1f201720311d5bb03c37c2648639ea2d5f"><code>43c1eb1</code></a> tests: add scikit-image to requirements-test-libraries.txt</li> <li><a href="https://github.com/pyinstaller/pyinstaller-hooks-contrib/commit/f25eae9dbee3f4812ad66af42073fa46af55f350"><code>f25eae9</code></a> tests: test_skimage: drop test for skimage.viewer</li> <li><a href="https://github.com/pyinstaller/pyinstaller-hooks-contrib/commit/113512f2df1272bdfba63fc5d3bc835cc61abf10"><code>113512f</code></a> hooks: update scikit-image hooks for compatibility with v0.20.0</li> <li><a href="https://github.com/pyinstaller/pyinstaller-hooks-contrib/commit/942843e6d83d89a8120fd8a1410ffe28e9c85d53"><code>942843e</code></a> hooks: update scikit-image hooks for compatibility with 0.19.x series</li> <li><a href="https://github.com/pyinstaller/pyinstaller-hooks-contrib/commit/33ea7ac018498075caf36dd0f97b81477e9f31fd"><code>33ea7ac</code></a> tests: add scikit-learn to requirements-test-libraries</li> <li><a href="https://github.com/pyinstaller/pyinstaller-hooks-contrib/commit/f8aba9f04f7700493eafc6670d9a01eb00f54031"><code>f8aba9f</code></a> ci: conditionally enable slow tests for scikit-image and scikit-learn</li> <li><a href="https://github.com/pyinstaller/pyinstaller-hooks-contrib/commit/fc1d009a7836609219fa41cf47e47b65144d9325"><code>fc1d009</code></a> Oneshot CI: Add option to pass flags to pytest.</li> <li>Additional commits viewable in <a href="https://github.com/pyinstaller/pyinstaller-hooks-contrib/compare/2023.1...2023.2">compare view</a></li> </ul> </details> <br /> [![Dependabot compatibility score](https://dependabot-badges.githubapp.com/badges/compatibility_score?dependency-name=pyinstaller-hooks-contrib&package-manager=pip&previous-version=2023.1&new-version=2023.2)](https://docs.github.com/en/github/managing-security-vulnerabilities/about-dependabot-security-updates#about-compatibility-scores) Dependabot will resolve any conflicts with this PR as long as you don't alter it yourself. You can also trigger a rebase manually by commenting `@dependabot rebase`. [//]: # (dependabot-automerge-start) [//]: # (dependabot-automerge-end) --- <details> <summary>Dependabot commands and options</summary> <br /> You can trigger Dependabot actions by commenting on this PR: - `@dependabot rebase` will rebase this PR - `@dependabot recreate` will recreate this PR, overwriting any edits that have been made to it - `@dependabot merge` will merge this PR after your CI passes on it - `@dependabot squash and merge` will squash and merge this PR after your CI passes on it - `@dependabot cancel merge` will cancel a previously requested merge and block automerging - `@dependabot reopen` will reopen this PR if it is closed - `@dependabot close` will close this PR and stop Dependabot recreating it. You can achieve the same result by closing it manually - `@dependabot ignore this major version` will close this PR and stop Dependabot creating any more for this major version (unless you reopen the PR or upgrade to it yourself) - `@dependabot ignore this minor version` will close this PR and stop Dependabot creating any more for this minor version (unless you reopen the PR or upgrade to it yourself) - `@dependabot ignore this dependency` will close this PR and stop Dependabot creating any more for this dependency (unless you reopen the PR or upgrade to it yourself) </details> Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
In the recent TF 2.12 release, there is a new file
libtensorflow_cc.so.2
which now appears twice in the final output: once correctly in the root directory (as 'binary') and once incorrectly in thetensorflow
subdirectory (as 'data' file). This new file is where they moved the majority of the code, it's over 500 MB, so this duplication causes a lot of overhead.To reproduce the issue, install
tensorflow==2.12
ortensorflow-cpu==2.12
and package a file with onlyimport tensorflow
. With these changes the file only appears once in the final output and the package still works as expected.I have tested this change on Linux only.