ModuleNotFoundError: No module named 'discord'
Opened this issue · 4 comments
I followed the steps for self-hosting closely, and upon trying to run it, I get this error:
max@WIN-V0U91D6I6JV:~/LLMChat$ python3.9 main.py
Traceback (most recent call last):
File "/home/max/LLMChat/main.py", line 6, in <module>
from client import DiscordClient
File "/home/max/LLMChat/llmchat/client.py", line 3, in <module>
import discord
ModuleNotFoundError: No module named 'discord'
I've already tried python3.9 -m pip install discord.py
, python3.9 update.py -y
and pip install discord
.
Tried manually downloading this, https://github.com/hc20k/discord.py and copied the discord folder from it after install to LLMChat, ran the python3.9 main.py command again and got this error:
max@WIN-V0U91D6I6JV:~/LLMChat$ python3.9 main.py Traceback (most recent call last): File "/home/max/LLMChat/main.py", line 6, in <module> from client import DiscordClient File "/home/max/LLMChat/llmchat/client.py", line 3, in <module> import discord File "/home/max/LLMChat/discord/__init__.py", line 23, in <module> from .client import * File "/home/max/LLMChat/discord/client.py", line 49, in <module> import aiohttp ModuleNotFoundError: No module named 'aiohttp'
Seems to me the install instructiosn are missing lots of dependencies. I'd like to get this fixed and running soon because I did pay for a month of Elevenalbs to get the API.
EDIT: Found out that for some reason python3.9 was installing the dependencies all in the \\wsl$\Ubuntu-22.04\home\max\.local\lib\python3.10\site-packages
folder, copied everything from there to LLMChat, tried running again, new error:
max@WIN-V0U91D6I6JV:~/LLMChat$ python3.9 update.py -y Traceback (most recent call last): File "/home/max/LLMChat/update.py", line 2, in <module> import pkg_resources File "/usr/lib/python3/dist-packages/pkg_resources/__init__.py", line 23, in <module> import zipfile File "/usr/lib/python3.9/zipfile.py", line 7, in <module> import importlib.util File "/usr/lib/python3.9/importlib/util.py", line 2, in <module> from . import abc File "/usr/lib/python3.9/importlib/abc.py", line 17, in <module> from typing import Protocol, runtime_checkable File "/home/max/LLMChat/typing.py", line 1359, in <module> class Callable(extra=collections_abc.Callable, metaclass=CallableMeta): File "/home/max/LLMChat/typing.py", line 1007, in __new__ self._abc_registry = extra._abc_registry AttributeError: type object 'Callable' has no attribute '_abc_registry'
I had this error as well and was able to resolve it by manually invoking python3.9 -m pip install discord.py[voice]
, but then receive the following error:
Traceback (most recent call last):
File "/home/ubuntu/LLMChat/main.py", line 6, in <module>
from client import DiscordClient
File "/home/ubuntu/LLMChat/llmchat/client.py", line 16, in <module>
from voice_support import BufferAudioSink
File "/home/ubuntu/LLMChat/llmchat/voice_support.py", line 12, in <module>
class BufferAudioSink(discord.AudioSink):
AttributeError: module 'discord' has no attribute 'AudioSink'
Per my own research, this is because the discord.py module does not have an AudioSink class (ref: Rapptz/discord.py#1094). In requirements.txt the discord.py specified is Sheepposu's fork, and this must be installed manually via pip to resolve the issue:
git clone https://github.com/Sheepposu/discord.py
cd discord.py
python3.9 -m pip install -U .[voice]
Hope this helps others!
I had this error as well and was able to resolve it by manually invoking
python3.9 -m pip install discord.py[voice]
, but then receive the following error:Traceback (most recent call last): File "/home/ubuntu/LLMChat/main.py", line 6, in <module> from client import DiscordClient File "/home/ubuntu/LLMChat/llmchat/client.py", line 16, in <module> from voice_support import BufferAudioSink File "/home/ubuntu/LLMChat/llmchat/voice_support.py", line 12, in <module> class BufferAudioSink(discord.AudioSink): AttributeError: module 'discord' has no attribute 'AudioSink'
Per my own research, this is because the discord.py module does not have an AudioSink class (ref: Rapptz/discord.py#1094). In requirements.txt the discord.py specified is Sheepposu's fork, and this must be installed manually via pip to resolve the issue:
git clone https://github.com/Sheepposu/discord.py cd discord.py python3.9 -m pip install -U .[voice]
Hope this helps others!
I got these errors:
Damn. And my hopes had gotten up for this.
Have you used the update.py script to download the discord module?
Manually downloading it doesn't work for me, but by using the update.py script, it works.