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

AttributeError: partially initialized module 'charset_normalizer' has no attribute 'md__mypyc' (most likely due to a circular import) #242

Open
niuwa2333 opened this issue Mar 18, 2023 · 9 comments

Comments

@niuwa2333
Copy link

Traceback (most recent call last):
File "/data/ynj/conda_envs/visgpt/lib/python3.8/site-packages/aiohttp/client_reqrep.py", line 70, in
import cchardet as chardet
ModuleNotFoundError: No module named 'cchardet'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "visual_chatgpt.py", line 2, in
import gradio as gr
File "/data/ynj/conda_envs/visgpt/lib/python3.8/site-packages/gradio/init.py", line 3, in
import gradio.components as components
File "/data/ynj/conda_envs/visgpt/lib/python3.8/site-packages/gradio/components.py", line 32, in
from gradio import media_data, processing_utils, utils
File "/data/ynj/conda_envs/visgpt/lib/python3.8/site-packages/gradio/processing_utils.py", line 25, in
from gradio import encryptor, utils
File "/data/ynj/conda_envs/visgpt/lib/python3.8/site-packages/gradio/utils.py", line 39, in
import aiohttp
File "/data/ynj/conda_envs/visgpt/lib/python3.8/site-packages/aiohttp/init.py", line 6, in
from .client import (
File "/data/ynj/conda_envs/visgpt/lib/python3.8/site-packages/aiohttp/client.py", line 59, in
from .client_reqrep import (
File "/data/ynj/conda_envs/visgpt/lib/python3.8/site-packages/aiohttp/client_reqrep.py", line 72, in
import charset_normalizer as chardet # type: ignore[no-redef]
File "/data/ynj/conda_envs/visgpt/lib/python3.8/site-packages/charset_normalizer/init.py", line 23, in
from charset_normalizer.api import from_fp, from_path, from_bytes, normalize
File "/data/ynj/conda_envs/visgpt/lib/python3.8/site-packages/charset_normalizer/api.py", line 10, in
from charset_normalizer.md import mess_ratio
AttributeError: partially initialized module 'charset_normalizer' has no attribute 'md__mypyc' (most likely due to a circular import)

@Elon-Chan
Copy link

Updating the charset-normalizer to latest version works for me:

pip install --force-reinstall charset-normalizer==3.1.0

as the solution suggested here https://stackoverflow.com/questions/75501048/how-to-fix-attributeerror-partially-initialized-module-charset-normalizer-has

@nakulkorde
Copy link

Updating to latest version worked for me as well. Thanks @Elon-Chan !

1 similar comment
@VeechiYip
Copy link

Updating to latest version worked for me as well. Thanks @Elon-Chan !

@ether-levitation
Copy link

ether-levitation commented Apr 20, 2023

Elon-Chan Thanks works like charm.

**pip install --force-reinstall charset-normalizer==3.1.0**

However just a note, even though it correctly re-installs, receive an error in terminal and
an additional warning when jupyter notebook is restarted.

$ **pip install --force-reinstall charset-normalizer==3.1.0**
Collecting charset-normalizer==3.1.0
  Using cached charset_normalizer-3.1.0-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (199 kB)
Installing collected packages: charset-normalizer
  Attempting uninstall: charset-normalizer
    Found existing installation: charset-normalizer 2.0.4
    Uninstalling charset-normalizer-2.0.4:
      Successfully uninstalled charset-normalizer-2.0.4
_ERROR: pip's dependency resolver does not currently take into account all the packages that are installed. This behaviour is the source of the following dependency conflicts.
requests 2.28.1 requires charset-normalizer<3,>=2, but you have charset-normalizer 3.1.0 which is incompatible._
**Successfully installed charset-normalizer-3.1.0**

@dbeiski-artlist
Copy link

This solution:

pip install --force-reinstall charset-normalizer==3.1.0

Does not work for me.
Anyone else is stuck with this?

It is required by "requests" package which is at the core of most packages I use.

@peterjsadowski
Copy link

peterjsadowski commented Jun 3, 2023

Updating to latest version worked for me, too. Thanks.

pip install --force-reinstall charset-normalizer==3.1.0

@genagurbanguliyev
Copy link

Updating the charset-normalizer to latest version works for me:

pip install --force-reinstall charset-normalizer==3.1.0

as the solution suggested here https://stackoverflow.com/questions/75501048/how-to-fix-attributeerror-partially-initialized-module-charset-normalizer-has

pip install --force-reinstall charset-normalizer==3.1.0

Worked for me. Thanks

@Keneyr
Copy link

Keneyr commented Mar 20, 2024

This solution:

pip install --force-reinstall charset-normalizer==3.1.0

Does not work for me. Anyone else is stuck with this?

It is required by "requests" package which is at the core of most packages I use.

it doesn't work for me either. I use pip install chardet to tackle this error, seems work.

@lures2019
Copy link

将pyinstaller模块升级到最新版打包就不会出现问题了

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

10 participants