'AttributeError: module 'discord' has no attribute 'ui'
Question title defines the issue. I install the discord.py
module with this following:
pip install -U git+https://github.com/Rapptz/discord.py
However, when I try to run my code:
import discord
class JoinQueue_Button(discord.ui.View):
@discord.ui.button(label='Join This Game!', style=discord.ButtonStyle.green)
async def queue(self, interaction: discord.Interaction):
current_queue = {}
await interaction.user.id
I get an error saying the ui
module does not exist. I am unsure what to do at this point.
Solution 1:[1]
I think it may be outdated.
Try and run the next command: pip install --upgrade discord.py
Solution 2:[2]
Try This:
- Windows:
py -m pip install discord-ui
- Linux:
python3 -m pip install discord-ui
Also check here
Solution 3:[3]
I solved the problem running this
python3 -m pip install -U py-cord --pre
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
Solution | Source |
---|---|
Solution 1 | Eduardo Ortiz |
Solution 2 | AmirhosseinHG |
Solution 3 | OhSerk |