Ask coding questions

← Back to all posts
"Repl.it: Package operation failed" on installing discord.py
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
MarioGhio
medhansh_rath
MrOrange9_JCT
Jashwanth2
Topkinsme
danaragnarok
Comments
hotnewtop
Dart

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

danaragnarok

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

Dart

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

Dart

@danaragnarok importing discord works for me :/

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

danaragnarok

@Zexogon nope, same error message:
Traceback (most recent call last):
File "main.py", line 3, in <module>
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.

Dart

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

shraddha121

@Zexogon Still showing the same error

flysan

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

NZHacker808

?!