#ImportError: cannot import name 'listen' from 'interactions'

1 messages · Page 1 of 1 (latest)

blissful fulcrum
#
0|abc_bot  |   import interactions
0|abc_bot  | Traceback (most recent call last):
0|abc_bot  |   File "/home/abc/code/discord/abc_bot_prod.py", line 24, in <module>
0|abc_bot  |     from interactions import Client, Intents, listen, slash_command, SlashContext, SlashCommandChoice, StringSelectMenu, StringSelectOption, ComponentContext, OptionType, slash_option, User, check, BaseContext, Embed, Task, IntervalTrigger, ChannelType, TimeTrigger
0|abc_bot  | ImportError: cannot import name 'listen' from 'interactions' (/home/abc/.local/lib/python3.9/site-packages/interactions/__init__.py)
PM2         | App [abc_bot:0] exited with code [1] via signal [SIGINT]
PM2         | Script /home/abc/code/discord/abc_bot_prod.py had too many unstable restarts (16). Stopped. "errored"
^C
abc@SN-E5-80:~$ python --version
Python 3.10.3
abc@SN-E5-80:~$ pip --version
pip 22.0.4 from /home/abc/.pyenv/versions/3.10.3/lib/python3.10/site-packages/pip (python 3.10)
abc@SN-E5-80:~$ pip show discord-py-interactions
Name: discord-py-interactions
Version: 5.14.0
Summary: Easy, simple, scalable and modular: a Python API wrapper for interactions.
Home-page: https://github.com/interactions-py/interactions.py
Author: LordOfPolls
Author-email: [email protected]
License: 
Location: /home/abc/.pyenv/versions/3.10.3/lib/python3.10/site-packages
Requires: aiohttp, attrs, croniter, discord-typings, emoji, tomli
Required-by: 
silver snowBOT
#

Hey! Once your issue is solved, press the button below to close this thread!

blissful fulcrum
#

trying to run my bot on a new server, the code did not change so i dont understand whats wrong

from interactions import Client, Intents, listen, slash_command, SlashContext, SlashCommandChoice, StringSelectMenu, StringSelectOption, ComponentContext, OptionType, slash_option, User, check, BaseContext, Embed, Task, IntervalTrigger, ChannelType, TimeTrigger```
faint thistle
#

You've got v4 installed

blissful fulcrum
#
abc@SN-E5-80:~$ pip show discord-py-interactions
Name: discord-py-interactions
Version: 5.14.0
faint thistle
#

I know. But that depreciation warning in the first line of your code says otherwise

blissful fulcrum
#

so what to do

faint thistle
#

Can you show me pip freeze?

blissful fulcrum
#
$ pip freeze
aiohappyeyeballs==2.4.6
aiohttp==3.11.12
aiomysql==0.2.0
aiosignal==1.3.2
async-timeout==4.0.3
attrs==25.1.0
croniter==6.0.0
discord-py-interactions==5.14.0
discord-typings==0.9.0
emoji==2.14.1
frozenlist==1.5.0
idna==3.10
multidict==6.1.0
propcache==0.3.0
PyMySQL==1.1.1
python-dateutil==2.9.0.post0
python-dotenv==1.0.1
pytz==2025.1
six==1.17.0
tomli==2.2.1
typing_extensions==4.12.2
yarl==1.18.3
#

i first installed with old python, so possibly it had v4

faint thistle
#

Yeah, let's just do a pip uninstall and then reinstall it?

blissful fulcrum
#

ok i try

#

ok thx a lot its working now. dont understand why pyenv upgrading python and reinstalling did not fix it