Projects packages seemingly dissapear everytime I close it

Hi, so I’ve been using replit to create discord bots in python, using the discord.py packages. I have two bots, both with very similar, basic functions, and both start with “import discord”. One of these bots was created around 2 years ago while the other was made just yesterday.

So heres my problem. The older bot has worked fine on/off for most of its life. Just recently though, it started going offline for seemingly no reason. Now, without fail, everytime I try running it it gives me the error “no module named discord”. Obviously, this is already a little weird because it was working just fine, and my other discord bot has had no issues despite being similar. My next step is to just go to the shell, type “pip install discord.py”, its run for a sec and gives me a warning about pip versions, telling me to upgrade using the “/opt/virtualenvs/python3/bin/python3 -m pip install --upgrade pip” command. I do this, hit “run” and now the bots working fine again. But if I close the window, leave replit by itself, eventually the bot just shuts down by itself again. If I open it up, I see I’m getting the exact same “no module named discord” error, exact same pip version update. I’ve done this 3 times now, each time leaving the bot in perfectly fine working condition, but when I come back its discord packages are gone.

Any help? Again, the bot giving me trouble shares all the standard “being a discord bot” code as my other one, yet the new one hasnt given me any trouble.

Hm. What happens if you add discord to poetry on the older one? (poetry add discord.py (or discord, I don’t know))

1 Like

sorry for being noobish, but poetry is the packages tab in the “tools” section, right? if so, then trying to add “discord” and “discord.py” gives me a pop up saying “package installed”, but the console says “replit: package operation failed” and it doesnt seem to actually do anything.

1 Like

Packages is replit’s packaging system, which calls poetry in the Console tab. poetry itself is a CLI tool, try running the command I provided in the Shell tab.