#Module error

41 messages · Page 1 of 1 (latest)

narrow terrace
#

Hi, i am trying to make a Discord Bot. the first line of my script is 'import discord' but when i try to run the bot i got a error that says 'no module named discord' but when i typ 'pip install discord.py' it says the module is already installed. Can somebody help me understand please.

analog acorn
#

How are you running the bot?

narrow terrace
#

you mean with what command?

analog acorn
#

might be that your pip is installing the package for a different python version than the one you're using to run the bot

#

e.g. pip points to 3.12 by default but python points to 3.13 or something

narrow terrace
#

i typ pyton3 and than the name of my file

analog acorn
#

python3 -m pip install discord.py

#

try that one to force it to use the right pip

narrow terrace
#

i will try it thanks.

#

now i get an error saying 'cannot import name 'InputText' from 'discord.ui' 'what can be the problem of that error?

analog acorn
#

did you chatgpt that code lol

narrow terrace
#

no, why?

#

i watched a youtube video 🙂

#

but on the video he doesn't have does problems

analog acorn
#

Might be a version thing since that was introduced in 2.0

#

What version did you install?

narrow terrace
#

idk i just installed visuel studio code today. so i guess the newest version

analog acorn
#

(should show up if you just run that install command again)

narrow terrace
#

24.3.1

#

or 3.10

analog acorn
#

Those sound like pip and python versions

narrow terrace
analog acorn
#

sounds unlikely

narrow terrace
#

this is what the terminal says

analog acorn
#

That's Python 3.10 and aihttp 4.12.2

#

(I think?)

narrow terrace
#

how can i find what version of discord.py i'm using?

analog acorn
#

python3 -m pip show discord.py should work

narrow terrace
#

i'm using the 2.4.0 version

analog acorn
narrow terrace
#

from discord.ui import View, Button, Modal, InputText

#

that's to code

analog acorn
#

Can you do a quick check

#

python3 -m pip show py-cord?

narrow terrace
#

package not found.

analog acorn
narrow terrace
#

how can i know what packages are 3rd party add-ons?

analog acorn
#

Idk I'd probably python3 -m pip list and then check for stuff called cord or something

narrow terrace
#

nothing called cord