0

I'm using repl.it with the discord2 package for slash commands. This package shares the same import namespace with discord.py. When I run "import discord", repl.it's package manager (poetry?) automatically goes and installs discord (the mirror for discord.py).

So, I already have discord2 installed. And, when I press "run", the console outputs,

Replit: Updating package configuration
--> python3 -m poetry add discord

and then it installs discord, and ignores discord2.

Is there a way around that? Like, can I explicitly declare which package I want to import from, or prevent repl.it from automatically installing the additional package?

Thanks in advance!

boxcartenant
  • 271
  • 2
  • 14

1 Answers1

1

You can use Replit's Package Manager on the left to get discord2! Just go to the left bar with the files and settings and stuff, go to the package manager (The shaded in white cube) and then type in discord/discord2 and then you will find discord2!

limegradient
  • 66
  • 10
  • I mean, I have discord2 already installed, and the package manager ignores that and automatically installs discord on top of it, then throws errors because it's using the wrong library. – boxcartenant Apr 21 '22 at 18:24
  • @boxcartenant if you put this in your terminal: pip install --upgrade --no-deps --force-reinstall git+https://github.com/Pycord-Development/pycord this will make it work. – limegradient Apr 21 '22 at 18:35
  • Looks like git isn't installed on the replit terminal – boxcartenant Apr 21 '22 at 18:55
  • Put it in the replit shell and make sure to put https:// before github – limegradient Apr 21 '22 at 18:58
  • So, that did install py-cord, but still when I run the code, the first thing it does is installs discord. – boxcartenant Apr 21 '22 at 19:34
  • OK, so I tried it a few different times, and for some reason, it worked after the last time I tried it. Hopefully it sticks! D: Thanks for your help! – boxcartenant Apr 21 '22 at 19:49
  • nope, as soon as I made a change to the code, it went back to trying to install discord every time I run it :"( – boxcartenant Apr 21 '22 at 20:04
  • OK, here's what I finally figured out to do: 1. Paste `pip install --upgrade --no-deps --force-reinstall git+https://github.com/Pycord-Development/pycord` into the console 2. Run the code with `import discord`. Let it install discord. 3. Do step 1 again. Now pycord takes priority. 4. Run it and it works. – boxcartenant Apr 21 '22 at 20:47
  • @boxcartenant thats good, at least you got it! – limegradient Apr 22 '22 at 12:49