Skip to content
← Back to Community
"Repl.it: Package operation failed" on installing discord.py
Profile icon
danaragnarok

I am trying to create a simple discord bot. I have tried importing it via the packages window, which gives the error "Repl.it: Package operation failed" and no other message. Adding it through requirements.txt does nothing. What else can I do?

Voters
Profile icon
Cryteam
Profile icon
LoganE1
Profile icon
MarioGhio
Profile icon
medhansh_rath
Profile icon
MrOrange9_JCT
Profile icon
Jashwanth2
Profile icon
Topkinsme
Profile icon
danaragnarok
Comments
hotnewtop
Profile icon
Dart

you need to install this as well:
from discord.ext import commands, tasks
and in requirements.txt add discord.py

Profile icon
danaragnarok

@Zexogon I already have discord.py in requirements.txt, as is specified in the question.

Profile icon
Dart

@danaragnarok try adding from discord.ext import commands, tasks

Profile icon
Dart

@danaragnarok importing discord works for me :/

mabey try making a new repl and copy pasting your code to see if it works

Profile icon
danaragnarok

@Zexogon nope, same error message:
Traceback (most recent call last):
File "main.py", line 3, in
import discord
ModuleNotFoundError: No module named 'discord

It's a problem with installing the package, I think, not the imports I'm using, so I don't understand why adding an import would help.

Profile icon
Dart

@danaragnarok try copy pasting your code into a new repl and re importing everything

Profile icon
shraddha121

@Zexogon Still showing the same error

Profile icon
flysan

@shraddha121 Were you able to solve the issue? I just happened to stumble on it as well

Profile icon
NZHacker808

?!