skip to Main Content
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


  1. My guess is that you have installed python-telegram when in fact you wanted to install python-telegram-bot, which are different packages. Try doing:

    pip uninstall python-telegram
    pip install python-telegram-bot
    

    and then re-running your code.

    Login or Signup to reply.
  2. looks like you’re using an old/ abandoned package. try

    pip install python-telegram-bot

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search