#ImportError: cannot import name 'option' from 'discord'

1 messages · Page 1 of 1 (latest)

dull cove
#

So i uploaded my bot to cloud using docker:

FROM python:3.11.4-slim-buster

# Install FFmpeg and Opus
RUN apt-get update && apt-get install -y libopus-dev

WORKDIR /kexobot

COPY requirements.txt .

RUN pip install --no-cache-dir -r requirements.txt

COPY . .

ENV PYTHONDONTWRITEBYTECODE 1
ENV PYTHONUNBUFFERED 1
EXPOSE 8000
EXPOSE 2333

CMD ["python", "KexoBOT.py"]

And then requirements

py-cord
dnspython
pymongo
PyNaCl
async-timeout
asyncio
nest-asyncio
requests
lxml
imgflip.py
bs4
asyncpraw
wavelink

And i have no idea what's causing this, bot works locally normally, but when i upload i get this error:

Traceback (most recent call last):

File "/kexobot/KexoBOT.py", line 16, in <module>

from discord import option
ImportError: cannot import name 'option' from 'discord' (/usr/local/lib/python3.11/site-packages/discord/__init__.py)```
balmy drift
#

try using python 3.10.7?

dull cove
#

ImportError: cannot import name 'option' from 'discord' (/usr/local/lib/python3.10/site-packages/discord/__init__.py)```
balmy drift
#

so like there's conflicts there

dull cove
#

hmm

#

how does it work on my pc then

balmy drift
#

probably installation order?

dull cove
#

lemme try

dull cove
pastel falcon
#

The 100% working and ideal solution ^

dull cove
dull cove
#

py-cord my beloved ❤️

pastel falcon
#

wavelink supports pycord

#

it works

dull cove
#

not on docker

pastel falcon
#

it does

pastel falcon
#

you need to make a complete requirements.txt file

#

that has everything like aiohttp and stuff

#

and then you pass the no-deps flag to pip install

pastel falcon
dull cove
#

i have no idea how to it

pastel falcon
#

hmm have you made a venv before?

pastel falcon
#

pip installed it shrug

dull cove
#

but py-cord is based on dpy

pastel falcon
#

it is a fork, some things are different, base is the same

dull cove
#

tell me how should req.txt file look like bcs i don't understand you

pastel falcon
#

if you want, i can make you requirements.txt

dull cove
#

yes

pastel falcon
#

alr you would need to wait for a while

dull cove
#

kk

pastel falcon
#

or wait yk what

#

you can make an easy workaround

#

remove wavelink from requirements.txt, and change your docker file to this

RUN pip install --no-cache-dir -r requirements.txt
RUN pip install --no-cache-dir --no-deps wavelink
dull cove
#

lemme try

dull cove
#

i kiss you

pastel falcon
#

no worries

#

.tag close

dreamy shoreBOT
#

Done with your help thread?

Please close your own help thread by using </close:1009144375709814897> with @last wyvern.

Backup bot: </solved:1109625445990793246> (or .solved) with @dreamy shore.

remote bear
#

.solved