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

Missing file for charset-normalizer==3.0.1 #534

Closed
ikus060 opened this issue Jan 13, 2023 · 7 comments · Fixed by #535
Closed

Missing file for charset-normalizer==3.0.1 #534

ikus060 opened this issue Jan 13, 2023 · 7 comments · Fixed by #535
Assignees
Labels

Comments

@ikus060
Copy link

ikus060 commented Jan 13, 2023

Description of the issue

Trying to froze an application is failing.
Requests is not working in PyInstaller packages because of missing file from charset_normalizer module.

Context information (for bug reports)

  • Output of pyinstaller --version: 5.7.0
  • Version of Python: Any
  • Platform: Linux, Windows, Mac
  • How you installed Python: n/a
  • Did you also try this on another platform? Does it work there?
  • try the latest development version, using the following command: Get the same issue.

A minimal example program which shows the error

test.py:

import requests

print(requests.get('http://example.com'))
pip install requests==2.28.2 charset-normalizer==3.0.1 pyinstaller
pyinstaller test.py
dist/test/test

Stacktrace / full error message

Traceback (most recent call last):
  File "requests\compat.py", line 11, in <module>
ModuleNotFoundError: No module named 'chardet'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "minarca_client\main.py", line 15, in <module>
    from minarca_client.core import (
  File "PyInstaller\loader\pyimod03_importers.py", line 495, in exec_module
  File "minarca_client\core\__init__.py", line 23, in <module>
    import requests
  File "PyInstaller\loader\pyimod03_importers.py", line 495, in exec_module
  File "requests\__init__.py", line 45, in <module>
  File "PyInstaller\loader\pyimod03_importers.py", line 495, in exec_module
  File "requests\exceptions.py", line 9, in <module>
  File "PyInstaller\loader\pyimod03_importers.py", line 495, in exec_module
  File "requests\compat.py", line 13, in <module>
  File "PyInstaller\loader\pyimod03_importers.py", line 495, in exec_module
  File "charset_normalizer\__init__.py", line 24, in <module>
  File "PyInstaller\loader\pyimod03_importers.py", line 495, in exec_module
  File "charset_normalizer\api.py", line 5, in <module>
  File "PyInstaller\loader\pyimod03_importers.py", line 495, in exec_module
  File "charset_normalizer\cd.py", line 9, in <module>
ModuleNotFoundError: No module named 'charset_normalizer.md__mypyc'
@ikus060 ikus060 added the triage label Jan 13, 2023
@ikus060
Copy link
Author

ikus060 commented Jan 13, 2023

I've also reported the problem here: psf/requests#6331
But I think it's more appropriate to get it fixed in PyInstaller.

@itamarst
Copy link

Also hit by this, will likely work around it for now by pinning older version of charset_normalizer.

@rokm
Copy link
Member

rokm commented Jan 13, 2023

Moving the issue to contrib hooks repository, where we will add a hook (and a test) for the charset_normalizer.

Until then, use --hiddenimport charset_normalizer.md__mypyc with your PyInstaller command.

@rokm rokm transferred this issue from pyinstaller/pyinstaller Jan 13, 2023
@bwoodsend bwoodsend self-assigned this Jan 14, 2023
bwoodsend added a commit to bwoodsend/pyinstaller-hooks-contrib that referenced this issue Jan 14, 2023
charset-normalizer has gone down my pet hatred route of squirting random
submodules through Cython...

Fixes pyinstaller#534.
bwoodsend added a commit that referenced this issue Jan 15, 2023
charset-normalizer has gone down my pet hatred route of squirting random
submodules through Cython...

Fixes #534.
@bwoodsend
Copy link
Member

I've gone ahead and hit the release button in the hopes that I won't be receiving a new duplicate of this bug report each day for the next two weeks.

pip install "pyinstaller-hooks-contrib>=2022.15"

Guts added a commit to Guts/qgis-deployment-cli that referenced this issue Mar 1, 2023
#201)

Updates the requirements on
[pyinstaller-hooks-contrib](https://github.com/pyinstaller/pyinstaller-hooks-contrib)
to permit the latest version.
<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.0</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.0 (2023-02-13)</h2>
<p>New hooks</p>
<pre><code>
* Add hook for ``minecraft-launcher-lib``
(`[#536](pyinstaller/pyinstaller-hooks-contrib#536)

&lt;https://github.com/pyinstaller/pyinstaller-hooks-contrib/issues/536&gt;`_)
* Add hook for ``nbt``
(`[#537](pyinstaller/pyinstaller-hooks-contrib#537)

&lt;https://github.com/pyinstaller/pyinstaller-hooks-contrib/issues/537&gt;`_)
<p>Updated hooks
</code></pre></p>
<ul>
<li>Have <code>fiona</code> hook collect the package's data files (e.g.,
the
projections database).
(<code>[#541](pyinstaller/pyinstaller-hooks-contrib#541)
&lt;https://github.com/pyinstaller/pyinstaller-hooks-contrib/issues/541&gt;</code>_)</li>
<li>Update <code>fiona</code> hook for compatibility with
<code>fiona</code> 1.9.0.
(<code>[#541](pyinstaller/pyinstaller-hooks-contrib#541)
&lt;https://github.com/pyinstaller/pyinstaller-hooks-contrib/issues/541&gt;</code>_)</li>
</ul>
<h2>2022.15 (2023-01-15)</h2>
<p>New hooks</p>
<pre><code>
* Add a hook for `easyocr &lt;https://github.com/JaidedAI/EasyOCR&gt;`_,
  which imports recognition backends via ``imporlib.import_module()``
  and has a number of datafiles for different languages.
<p>Users can set which languages to include datafiles for with a hook
option.

(<code>[#530](pyinstaller/pyinstaller-hooks-contrib#530)
&amp;lt;https://github.com/pyinstaller/pyinstaller-hooks-contrib/issues/530&amp;gt;</code>_)</p>
<ul>
<li>Add hook for <code>charset-normalizer</code> to fix
<code>ModuleNotFoundError: No module named
'charset_normalizer.md__mypyc'</code>.
(<code>[#534](pyinstaller/pyinstaller-hooks-contrib#534)
&amp;lt;https://github.com/pyinstaller/pyinstaller-hooks-contrib/issues/534&amp;gt;</code>_)</li>
</ul>
<p>Updated hooks
</code></pre></p>
<ul>
<li>Update <code>shapely</code> hook for compatibility with
<code>shapely &gt;= 2.0.0</code>.
(<code>[#527](pyinstaller/pyinstaller-hooks-contrib#527)
&lt;https://github.com/pyinstaller/pyinstaller-hooks-contrib/issues/527&gt;</code>_)</li>
</ul>
<p>Project &amp; Process</p>
<pre><code>
&lt;/tr&gt;&lt;/table&gt; 
</code></pre>
</blockquote>
<p>... (truncated)</p>
</details>
<details>
<summary>Commits</summary>
<ul>
<li><a
href="https://github.com/pyinstaller/pyinstaller-hooks-contrib/commit/63d24c331f79c7dc018a3a0fd08b1397e6a81ec2"><code>63d24c3</code></a>
Release v2023.0</li>
<li><a
href="https://github.com/pyinstaller/pyinstaller-hooks-contrib/commit/a9431e18f1e7b578311166b6fa3ae45ff5c5cfb8"><code>a9431e1</code></a>
Scheduled weekly dependency update for week 06 (<a
href="https://github-redirect.dependabot.com/pyinstaller/pyinstaller-hooks-contrib/issues/543">#543</a>)</li>
<li><a
href="https://github.com/pyinstaller/pyinstaller-hooks-contrib/commit/23a86ad948a81a311b080b10e6d059699844152c"><code>23a86ad</code></a>
Scheduled weekly dependency update for week 05 (<a
href="https://github-redirect.dependabot.com/pyinstaller/pyinstaller-hooks-contrib/issues/540">#540</a>)</li>
<li><a
href="https://github.com/pyinstaller/pyinstaller-hooks-contrib/commit/aced50065556bb9af136c10537773cb54014c57a"><code>aced500</code></a>
hooks: fiona: update for compatibility with fiona 1.9.0</li>
<li><a
href="https://github.com/pyinstaller/pyinstaller-hooks-contrib/commit/88366af06d2bd48cbafdcbfb8674a1ae86efc5e3"><code>88366af</code></a>
hooks: fiona: collect the package's data files</li>
<li><a
href="https://github.com/pyinstaller/pyinstaller-hooks-contrib/commit/7dba7f99de1ee981c7806f7a00c0b24179457e52"><code>7dba7f9</code></a>
Scheduled weekly dependency update for week 04 (<a
href="https://github-redirect.dependabot.com/pyinstaller/pyinstaller-hooks-contrib/issues/539">#539</a>)</li>
<li><a
href="https://github.com/pyinstaller/pyinstaller-hooks-contrib/commit/00038a3456a02dfb4ee19061e99b517ba13b80b8"><code>00038a3</code></a>
Add hook for NBT (<a
href="https://github-redirect.dependabot.com/pyinstaller/pyinstaller-hooks-contrib/issues/537">#537</a>)</li>
<li><a
href="https://github.com/pyinstaller/pyinstaller-hooks-contrib/commit/0e3528e46aa1c59d087e713d2a357cee9f813c78"><code>0e3528e</code></a>
Scheduled weekly dependency update for week 03 (<a
href="https://github-redirect.dependabot.com/pyinstaller/pyinstaller-hooks-contrib/issues/538">#538</a>)</li>
<li><a
href="https://github.com/pyinstaller/pyinstaller-hooks-contrib/commit/e1f160103cee85c2b8cd2232c0f9f473e96d807d"><code>e1f1601</code></a>
Add hook for minecraft-launcher-lib (<a
href="https://github-redirect.dependabot.com/pyinstaller/pyinstaller-hooks-contrib/issues/536">#536</a>)</li>
<li><a
href="https://github.com/pyinstaller/pyinstaller-hooks-contrib/commit/b5d051d31f878a3e605d37f285a5dd2055c15297"><code>b5d051d</code></a>
Release v2022.15</li>
<li>Additional commits viewable in <a
href="https://github.com/pyinstaller/pyinstaller-hooks-contrib/compare/2022.0...2023.0">compare
view</a></li>
</ul>
</details>
<br />


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>
Guts added a commit to geotribu/cli that referenced this issue Mar 2, 2023
#44)

Updates the requirements on
[pyinstaller-hooks-contrib](https://github.com/pyinstaller/pyinstaller-hooks-contrib)
to permit the latest version.
<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.0</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.0 (2023-02-13)</h2>
<p>New hooks</p>
<pre><code>
* Add hook for ``minecraft-launcher-lib``
(`[#536](pyinstaller/pyinstaller-hooks-contrib#536)

&lt;https://github.com/pyinstaller/pyinstaller-hooks-contrib/issues/536&gt;`_)
* Add hook for ``nbt``
(`[#537](pyinstaller/pyinstaller-hooks-contrib#537)

&lt;https://github.com/pyinstaller/pyinstaller-hooks-contrib/issues/537&gt;`_)
<p>Updated hooks
</code></pre></p>
<ul>
<li>Have <code>fiona</code> hook collect the package's data files (e.g.,
the
projections database).
(<code>[#541](pyinstaller/pyinstaller-hooks-contrib#541)
&lt;https://github.com/pyinstaller/pyinstaller-hooks-contrib/issues/541&gt;</code>_)</li>
<li>Update <code>fiona</code> hook for compatibility with
<code>fiona</code> 1.9.0.
(<code>[#541](pyinstaller/pyinstaller-hooks-contrib#541)
&lt;https://github.com/pyinstaller/pyinstaller-hooks-contrib/issues/541&gt;</code>_)</li>
</ul>
<h2>2022.15 (2023-01-15)</h2>
<p>New hooks</p>
<pre><code>
* Add a hook for `easyocr &lt;https://github.com/JaidedAI/EasyOCR&gt;`_,
  which imports recognition backends via ``imporlib.import_module()``
  and has a number of datafiles for different languages.
<p>Users can set which languages to include datafiles for with a hook
option.

(<code>[#530](pyinstaller/pyinstaller-hooks-contrib#530)
&amp;lt;https://github.com/pyinstaller/pyinstaller-hooks-contrib/issues/530&amp;gt;</code>_)</p>
<ul>
<li>Add hook for <code>charset-normalizer</code> to fix
<code>ModuleNotFoundError: No module named
'charset_normalizer.md__mypyc'</code>.
(<code>[#534](pyinstaller/pyinstaller-hooks-contrib#534)
&amp;lt;https://github.com/pyinstaller/pyinstaller-hooks-contrib/issues/534&amp;gt;</code>_)</li>
</ul>
<p>Updated hooks
</code></pre></p>
<ul>
<li>Update <code>shapely</code> hook for compatibility with
<code>shapely &gt;= 2.0.0</code>.
(<code>[#527](pyinstaller/pyinstaller-hooks-contrib#527)
&lt;https://github.com/pyinstaller/pyinstaller-hooks-contrib/issues/527&gt;</code>_)</li>
</ul>
<p>Project &amp; Process</p>
<pre><code>
&lt;/tr&gt;&lt;/table&gt; 
</code></pre>
</blockquote>
<p>... (truncated)</p>
</details>
<details>
<summary>Commits</summary>
<ul>
<li><a
href="https://github.com/pyinstaller/pyinstaller-hooks-contrib/commit/63d24c331f79c7dc018a3a0fd08b1397e6a81ec2"><code>63d24c3</code></a>
Release v2023.0</li>
<li><a
href="https://github.com/pyinstaller/pyinstaller-hooks-contrib/commit/a9431e18f1e7b578311166b6fa3ae45ff5c5cfb8"><code>a9431e1</code></a>
Scheduled weekly dependency update for week 06 (<a
href="https://github-redirect.dependabot.com/pyinstaller/pyinstaller-hooks-contrib/issues/543">#543</a>)</li>
<li><a
href="https://github.com/pyinstaller/pyinstaller-hooks-contrib/commit/23a86ad948a81a311b080b10e6d059699844152c"><code>23a86ad</code></a>
Scheduled weekly dependency update for week 05 (<a
href="https://github-redirect.dependabot.com/pyinstaller/pyinstaller-hooks-contrib/issues/540">#540</a>)</li>
<li><a
href="https://github.com/pyinstaller/pyinstaller-hooks-contrib/commit/aced50065556bb9af136c10537773cb54014c57a"><code>aced500</code></a>
hooks: fiona: update for compatibility with fiona 1.9.0</li>
<li><a
href="https://github.com/pyinstaller/pyinstaller-hooks-contrib/commit/88366af06d2bd48cbafdcbfb8674a1ae86efc5e3"><code>88366af</code></a>
hooks: fiona: collect the package's data files</li>
<li><a
href="https://github.com/pyinstaller/pyinstaller-hooks-contrib/commit/7dba7f99de1ee981c7806f7a00c0b24179457e52"><code>7dba7f9</code></a>
Scheduled weekly dependency update for week 04 (<a
href="https://github-redirect.dependabot.com/pyinstaller/pyinstaller-hooks-contrib/issues/539">#539</a>)</li>
<li><a
href="https://github.com/pyinstaller/pyinstaller-hooks-contrib/commit/00038a3456a02dfb4ee19061e99b517ba13b80b8"><code>00038a3</code></a>
Add hook for NBT (<a
href="https://github-redirect.dependabot.com/pyinstaller/pyinstaller-hooks-contrib/issues/537">#537</a>)</li>
<li><a
href="https://github.com/pyinstaller/pyinstaller-hooks-contrib/commit/0e3528e46aa1c59d087e713d2a357cee9f813c78"><code>0e3528e</code></a>
Scheduled weekly dependency update for week 03 (<a
href="https://github-redirect.dependabot.com/pyinstaller/pyinstaller-hooks-contrib/issues/538">#538</a>)</li>
<li><a
href="https://github.com/pyinstaller/pyinstaller-hooks-contrib/commit/e1f160103cee85c2b8cd2232c0f9f473e96d807d"><code>e1f1601</code></a>
Add hook for minecraft-launcher-lib (<a
href="https://github-redirect.dependabot.com/pyinstaller/pyinstaller-hooks-contrib/issues/536">#536</a>)</li>
<li><a
href="https://github.com/pyinstaller/pyinstaller-hooks-contrib/commit/b5d051d31f878a3e605d37f285a5dd2055c15297"><code>b5d051d</code></a>
Release v2022.15</li>
<li>Additional commits viewable in <a
href="https://github.com/pyinstaller/pyinstaller-hooks-contrib/compare/2022.0...2023.0">compare
view</a></li>
</ul>
</details>
<br />


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>
@bwilso1
Copy link

bwilso1 commented Apr 27, 2023

i'm running PyInstaller==5.10.1, and I still have to use this work around --hiddenimport charset_normalizer.md__mypyc

mentioned here.
#534 (comment)

If this was reported against 5.7 and was "merged" how is this not currently fixed?

I can only show this at runtime after the .exe is built.
File "PyInstaller\loader\pyimod02_importers.py", line 352, in exec_module File "charset_normalizer\cd.py", line 9, in <module> ModuleNotFoundError: No module named 'charset_normalizer.md__mypyc' [12748] Failed to execute script 'main' due to unhandled exception!

and the above errors go away when i compile with --hiddenimports

@bwoodsend
Copy link
Member

The fix is in the hooks repo so it's pyinstaller-hooks-contrib you need to upgrade.

@bwilso1
Copy link

bwilso1 commented Apr 28, 2023

The fix is in the hooks repo so it's pyinstaller-hooks-contrib you need to upgrade.

I guess I did not properly upgrade. I modified my spec file to set hidden imports back to an empty list, hiddenimports=[],

the new generated EXE worked.

Now I understand what you meant by pip install "pyinstaller-hooks-contrib>=2022.15"

current working versions for me.

pyinstaller==5.10.1
pyinstaller-hooks-contrib==2023.2

Thanks!

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

Successfully merging a pull request may close this issue.

5 participants