pycord icon indicating copy to clipboard operation
pycord copied to clipboard

ModuleNotFoundError: No module named 'chardet'

Open UCYT5040 opened this issue 4 years ago • 4 comments

Summary

When I run I get ModuleNotFoundError: No module named 'chardet'

Reproduction Steps

  1. Enter code from Minimal Reproducible Code
  2. Run

Minimal Reproducible Code

from discord.ext import commands
import discord

bot = commands.Bot()

with open(".token", "r") as token:
    bot.run(token=token.read())

Expected Results

I expect the bot to just go online.

Actual Results

Traceback (most recent call last):
  File "/workspace/.pip-modules/lib/python3.8/site-packages/aiohttp/client_reqrep.py", line 70, in <module>
    import cchardet as chardet
ModuleNotFoundError: No module named 'cchardet'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/workspace/Fight-Bot/main.py", line 1, in <module>
    from discord.ext import commands
  File "/workspace/.pip-modules/lib/python3.8/site-packages/discord/__init__.py", line 25, in <module>
    from .client import Client
  File "/workspace/.pip-modules/lib/python3.8/site-packages/discord/client.py", line 33, in <module>
    import aiohttp
  File "/workspace/.pip-modules/lib/python3.8/site-packages/aiohttp/__init__.py", line 6, in <module>
    from .client import (
  File "/workspace/.pip-modules/lib/python3.8/site-packages/aiohttp/client.py", line 58, in <module>
    from .client_reqrep import (
  File "/workspace/.pip-modules/lib/python3.8/site-packages/aiohttp/client_reqrep.py", line 72, in <module>
    import chardet  # type: ignore
ModuleNotFoundError: No module named 'chardet'
gitpod /workspace/Fight-Bot (main) $ /home/gitpod/.pyenv/versions/3.8.12/bin/python /workspace/Fight-Bot/main.py
Traceback (most recent call last):
  File "/workspace/.pip-modules/lib/python3.8/site-packages/aiohttp/client_reqrep.py", line 70, in <module>
    import cchardet as chardet
ModuleNotFoundError: No module named 'cchardet'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/workspace/Fight-Bot/main.py", line 1, in <module>
    from discord.ext import commands
  File "/workspace/.pip-modules/lib/python3.8/site-packages/discord/__init__.py", line 25, in <module>
    from .client import Client
  File "/workspace/.pip-modules/lib/python3.8/site-packages/discord/client.py", line 33, in <module>
    import aiohttp
  File "/workspace/.pip-modules/lib/python3.8/site-packages/aiohttp/__init__.py", line 6, in <module>
    from .client import (
  File "/workspace/.pip-modules/lib/python3.8/site-packages/aiohttp/client.py", line 58, in <module>
    from .client_reqrep import (
  File "/workspace/.pip-modules/lib/python3.8/site-packages/aiohttp/client_reqrep.py", line 72, in <module>
    import chardet  # type: ignore
ModuleNotFoundError: No module named 'chardet'

Intents

None

System Information

This had an error so

Python 3.8 Ubuntu Linux

Checklist

  • [X] I have searched the open issues for duplicates.
  • [X] I have shown the entire traceback, if possible.
  • [X] I have removed my token from display, if visible.

Additional Context

No response

UCYT5040 avatar Feb 24 '22 01:02 UCYT5040

Your modules weren't installed correctly, cchardet should have been installed with aiohttp.

plun1331 avatar Feb 24 '22 02:02 plun1331

When I do pip install chardet it says it is already installed.

On Wed, Feb 23, 2022, 8:02 PM plun1331 @.***> wrote:

Your modules weren't installed correctly, cchardet should have been installed with aiohttp.

— Reply to this email directly, view it on GitHub https://github.com/Pycord-Development/pycord/issues/1076#issuecomment-1049419681, or unsubscribe https://github.com/notifications/unsubscribe-auth/ALEAFKWFQK3NBURW2BJTXQLU4WGTNANCNFSM5PF7DO3A . You are receiving this because you authored the thread.Message ID: @.***>

UCYT5040 avatar Feb 24 '22 03:02 UCYT5040

Reinstall pycord would also check the modules, maybe give that a try.

Miolus avatar Mar 04 '22 09:03 Miolus

pip install aiohttp --force-reinstall should fix this

BobDotCom avatar Mar 04 '22 16:03 BobDotCom