-
Notifications
You must be signed in to change notification settings - Fork 121
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
Add work-around for tensorflow < 2.3.0 trying to use site.USER_SITE #546
Conversation
Add a run-time hook for `tensorflow` that sets `site.USER_SITE` to an empty string, in order to prevent run-time errors caused by `tensorflow` < 2.3.0 blindly passing `site.USER_SITE` to `str.startswith`. Due to `site` being disabled in PyInstaller-frozen application, `site.USER_SITE` is `None`. In PyInstaller versions prior to v5.5, this was mitigated by PyInstaller's own fake `site` module, which also set `site.USER_SITE` to an empty string.
2f848bc
to
3f05f81
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hmm, I'd prefer to close #529 as won't fix but if you think it's worth it...
The problem with I have misfortune of having a project that's stuck on |
This is basically the context that caused me to file the issue in the first place, although we're pinned to an even older TensorFlow. I have a workaround in place, but look forward to removing it in the future whenever we resolve some unrelated our-side conflicts with newer versions of PyInstaller. I agree that it's an edge case, but thanks for putting in a patch for it! |
…3.1 (#43) Bumps [pyinstaller-hooks-contrib](https://github.com/pyinstaller/pyinstaller-hooks-contrib) from 2023.0 to 2023.1. <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.1</h2> <p>Please see the <a href="https://www.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.1 (2023-03-16)</h2> <p>Updated hooks</p> <pre><code> * Add work-around for ``ffpyplayer`` 4.3.5 and 4.4.0 trying to use ``site.USER_BASE``, which is ``None`` in PyInstaller 5.5 and later due to removal of PyInstaller's fake ``site`` module. (`[#545](pyinstaller/pyinstaller-hooks-contrib#545) <https://github.com/pyinstaller/pyinstaller-hooks-contrib/issues/545>`_) * Add work-around for ``tensorflow`` < 2.3.0 trying to use ``site.USER_SITE``, which is ``None`` in PyInstaller 5.5 and later due to removal of PyInstaller's fake ``site`` module. (`[#546](pyinstaller/pyinstaller-hooks-contrib#546) <https://github.com/pyinstaller/pyinstaller-hooks-contrib/issues/546>`_) * Prevent ``pyqtgraph`` hook from recursing into ``pyqgraph.examples`` while scanning for submodules. (`[#551](pyinstaller/pyinstaller-hooks-contrib#551) <https://github.com/pyinstaller/pyinstaller-hooks-contrib/issues/551>`_) * Update ``sklearn`` hooks for compatibility with ``scikit-learn`` 1.2.0 and 1.2.1. (`[#547](pyinstaller/pyinstaller-hooks-contrib#547) <https://github.com/pyinstaller/pyinstaller-hooks-contrib/issues/547>`_) <p>Removed hooks </code></pre></p> <ul> <li>Delete hook for <code>yt_dlp</code> which fixed the offending hidden import upstream in <code>yt_dlp>=2022.07.18</code>. (<code>[#556](pyinstaller/pyinstaller-hooks-contrib#556) <https://github.com/pyinstaller/pyinstaller-hooks-contrib/issues/556></code>_)</li> </ul> </blockquote> </details> <details> <summary>Commits</summary> <ul> <li><a href="https://github.com/pyinstaller/pyinstaller-hooks-contrib/commit/3807cb660a645b45ab1fd358bc0cbe7bb18ab5ce"><code>3807cb6</code></a> Release v2023.1</li> <li><a href="https://github.com/pyinstaller/pyinstaller-hooks-contrib/commit/7bbece956dd535e2763c936b81aa6a6f25ebd64a"><code>7bbece9</code></a> Remove yt_dlp hook and test.</li> <li><a href="https://github.com/pyinstaller/pyinstaller-hooks-contrib/commit/2f047ccb134b2b4514ab2ae0dee58a2103f70a26"><code>2f047cc</code></a> Add "remove" towncrier category.</li> <li><a href="https://github.com/pyinstaller/pyinstaller-hooks-contrib/commit/5ebfd2230fa8a79cb2615b1ed733e70b25f23579"><code>5ebfd22</code></a> Scheduled weekly dependency update for week 11 (<a href="https://redirect.github.com/pyinstaller/pyinstaller-hooks-contrib/issues/555">#555</a>)</li> <li><a href="https://github.com/pyinstaller/pyinstaller-hooks-contrib/commit/1a636ef08bb06db4b1d6ef7f58c70a540c88eeff"><code>1a636ef</code></a> Scheduled weekly dependency update for week 10 (<a href="https://redirect.github.com/pyinstaller/pyinstaller-hooks-contrib/issues/553">#553</a>)</li> <li><a href="https://github.com/pyinstaller/pyinstaller-hooks-contrib/commit/9a6dcbd4d7c06df459a4c09d96175b9fe2a97563"><code>9a6dcbd</code></a> Scheduled weekly dependency update for week 09 (<a href="https://redirect.github.com/pyinstaller/pyinstaller-hooks-contrib/issues/550">#550</a>)</li> <li><a href="https://github.com/pyinstaller/pyinstaller-hooks-contrib/commit/8e6d06dd96453fd9b99939f9f1d70159b8debd86"><code>8e6d06d</code></a> hooks: prevent pyqtgraph hook from recursing into pyqtgraph.examples</li> <li><a href="https://github.com/pyinstaller/pyinstaller-hooks-contrib/commit/4728a3d1e861d3a2755ed47eef509e65a6ee6e78"><code>4728a3d</code></a> Update sklearn hooks for compatibility with scikit-learn 1.2.0</li> <li><a href="https://github.com/pyinstaller/pyinstaller-hooks-contrib/commit/01127a0ac37cbc14512cb55b04ade8595af43eec"><code>01127a0</code></a> Scheduled weekly dependency update for week 07 (<a href="https://redirect.github.com/pyinstaller/pyinstaller-hooks-contrib/issues/544">#544</a>)</li> <li><a href="https://github.com/pyinstaller/pyinstaller-hooks-contrib/commit/74467d1d22b1a351d8e9160266f4aa02ded360a9"><code>74467d1</code></a> Add work-around for tensorflow < 2.3.0 trying to use site.USER_SITE</li> <li>Additional commits viewable in <a href="https://github.com/pyinstaller/pyinstaller-hooks-contrib/compare/2023.0...2023.1">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.0&new-version=2023.1)](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>
Add a run-time hook for
tensorflow
that sets site.USER_SITE to an empty string, in order to prevent run-time errors caused bytensorflow
< 2.3.0 blindly passingsite.USER_SITE
tostr.startswith
.Due to
site
being disabled in PyInstaller-frozen application,site.USER_SITE
isNone
. In PyInstaller versions prior to v5.5, this was mitigated by PyInstaller's own fakesite
module, which also setsite.USER_SITE
to an empty string.Fixes #529.