#Anybody familiar with Interactions.py? Problems running the code outside of virtual envirovement

43 messages · Page 1 of 1 (latest)

rustic plank
#

Hey,

I got a Discord bot written in python. I'm mostly using Interactions.py framework.
My code works if I have activated virtual envirovement, but deactivated I can't even download the library, in virtual envirovement I can.

This is a problem because I need to host my bot in cloud and when I uploaded my code and dependecies I get an error "ModuleNotFoundError: No module named 'interactions'". I get this same error on my own desktop computer when I don't have virtual envirovment activated.

I tried to install the Interactions library outside of the virtual envirovment and I get this error traceback:

[pc@archlinux bee]$ python3 -m pip install discord-py-interactions --upgrade
error: externally-managed-environment

× This environment is externally managed
╰─> To install Python packages system-wide, try 'pacman -S
    python-xyz', where xyz is the package you are trying to
    install.
    
    If you wish to install a non-Arch-packaged Python package,
    create a virtual environment using 'python -m venv path/to/venv'.
    Then use path/to/venv/bin/python and path/to/venv/bin/pip.
    
    If you wish to install a non-Arch packaged Python application,
    it may be easiest to use 'pipx install xyz', which will manage a
    virtual environment for you. Make sure you have python-pipx
    installed via pacman.

note: If you believe this is a mistake, please contact your Python installation or OS distribution provider. You can override this, at the risk of breaking your Python installation or OS, by passing --break-system-packages.
hint: See PEP 668 for the detailed specification.
[pc@archlinux bee]$ 

and here is my dependencies gotten from "pip freeze > requirements.txt"

aiohttp==3.9.1
aiosignal==1.3.1
attrs==23.2.0
discord-py-interactions==5.11.0
discord-typings==0.7.0
discord.py==2.3.2
emoji==2.9.0
frozenlist==1.4.1
idna==3.6
multidict==6.0.4
tomli==2.0.1
typing_extensions==4.9.0
yarl==1.9.4
noble lintel
#

Hey, try this

aiohttp==3.9.1
aiosignal==1.3.1
attrs==23.2.0
discord-py-interactions
discord-typings==0.7.0
discord.py==2.3.2
emoji==2.9.0
frozenlist==1.4.1
idna==3.6
multidict==6.0.4
tomli==2.0.1
typing_extensions==4.9.0
yarl==1.9.4
#

@rustic plank

#

Let me know if that works

rustic plank
#

okay thank you, will try now

noble lintel
#

Hopefully that fixes your issue

rustic plank
leaden prismBOT
#

@rustic plank, you just advanced to level 1 !

rustic plank
#

it's saying something about v4 being derecated and to move to v5

noble lintel
#

That's to do with interaction-models

rustic plank
#

oh okay so this one?

noble lintel
#

What version of python are you using

rustic plank
#

3.11.6

noble lintel
#

Is that version of python3 you need

#

Can you send me a link to the bot you are using

#

You will have to dm me

rustic plank
#

link to the source code or what u mean

noble lintel
#

Yes

rustic plank
#

yea sure let me make it public on github one sec

noble lintel
#

OK not a problem

noble lintel
#

@rustic plank try this
Change
from interactions.models import OptionType

To
from interactions import OptionType

rustic plank
#

okay will try now

noble lintel
#

And tell me if that fixes your problem

rustic plank
#

nope, it's saying

[pc@archlinux bee]$ python main.py
Traceback (most recent call last):
File "/home/kp/Documents/bee/main.py", line 1, in <module>
import interactions
ModuleNotFoundError: No module named 'interactions'
[pc@archlinux bee]$

noble lintel
#

Does the bot work you try do commands

#

When it it said deprecated

#

?

rustic plank
#

yeah if i run the main.py in virtual envirovement, the commands does work

#

all of them

noble lintel
#

Then you can just ignore the error

rustic plank
#

the problem is that when i upload the sourcecode to cloud server, it doesn't start because it won't download the interactions-py

noble lintel
#

But it does now?

rustic plank
#

can't download it outside of virtual envirovment

noble lintel
#

Hmm

rustic plank
#

yea it does download in virtual env but not outside of virtual env

#

i see other people on youtube running a bot outside of virtual env

noble lintel
#

It runs from a virtual env

#

It's basically like docker

rustic plank
#

and i made a bug report about it on github but it got insta closed and they said it does run outside of virtual env too

leaden prismBOT
#

@rustic plank, you just advanced to level 2 !

rustic plank
#

hang on i think i've found something

rustic plank