Traceback (most recent call last):
File "/home/himself/Desktop/image_resizer_bot.py", line 2, in <module>
from telegram import Update, KeyboardButton, ReplyKeyboardMarkup
ImportError: cannot import name 'Update' from 'telegram' (/home/himself/Desktop/myenv/lib/python3.11/site-packages/telegram/__init__.py)
How to fix this?
I was expecting error free code.
2
Answers
My guess is that you have installed
python-telegram
when in fact you wanted to installpython-telegram-bot
, which are different packages. Try doing:and then re-running your code.
looks like you’re using an old/ abandoned package. try
pip install python-telegram-bot