Error on telegram import Update

Hi!

I am using python to run a Telegram bot on Ubuntu 22.04.5 LTS, I am however facing an importing error:

raceback (most recent call last):
  File "/home/shared_dir/otaniemi_bot/bot.py", line 2, in <module>
    from telegram import Update
ImportError: cannot import name 'Update' from 'telegram' (/home/miquel/.local/lib/python3.10/site-packages/telegram/__init__.py)

Which I am not understanding why it is happening since I have the modules installed with pip.

$ python3 -m pip show telegram
Name: telegram
Version: 0.0.1
Summary: Telegram APIs
Home-page: https://github.com/liluo/telegram
Author: liluo
Author-email: i@liluo.org
License: MIT
Location: /home/miquel/.local/lib/python3.10/site-packages
Requires:
Required-by:
$ python3 -m pip show python-telegram-bot
Name: python-telegram-bot
Version: 21.10
Summary: We have made you a wrapper you can't refuse
Home-page:
Author:
Author-email: Leandro Toledo <devs@python-telegram-bot.org>
License:
Location: /home/miquel/.local/lib/python3.10/site-packages
Requires: httpx
Required-by:

Hello,

a google search brought me here:

To import the module, you might have to try:

python3 -m pip install python-telegram-bot

Does this work for you?

Thanks for your reply, I got this output

$ python3 -m pip install python-telegram-bot
Defaulting to user installation because normal site-packages is not writeable
Requirement already satisfied: python-telegram-bot in /home/miquel/.local/lib/python3.10/site-packages (21.10)
Requirement already satisfied: httpx~=0.27 in /home/miquel/.local/lib/python3.10/site-packages (from python-telegram-bot) (0.28.1)
Requirement already satisfied: anyio in /home/miquel/.local/lib/python3.10/site-packages (from httpx~=0.27->python-telegram-bot) (4.8.0)
Requirement already satisfied: idna in /usr/lib/python3/dist-packages (from httpx~=0.27->python-telegram-bot) (3.3)
Requirement already satisfied: httpcore==1.* in /home/miquel/.local/lib/python3.10/site-packages (from httpx~=0.27->python-telegram-bot) (1.0.7)
Requirement already satisfied: certifi in /usr/lib/python3/dist-packages (from httpx~=0.27->python-telegram-bot) (2020.6.20)
Requirement already satisfied: h11<0.15,>=0.13 in /home/miquel/.local/lib/python3.10/site-packages (from httpcore==1.*->httpx~=0.27->python-telegram-bot) (0.14.0)
Requirement already satisfied: typing_extensions>=4.5 in /home/miquel/.local/lib/python3.10/site-packages (from anyio->httpx~=0.27->python-telegram-bot) (4.12.2)
Requirement already satisfied: exceptiongroup>=1.0.2 in /home/miquel/.local/lib/python3.10/site-packages (from anyio->httpx~=0.27->python-telegram-bot) (1.2.2)
Requirement already satisfied: sniffio>=1.1 in /home/miquel/.local/lib/python3.10/site-packages (from anyio->httpx~=0.27->python-telegram-bot) (1.3.1)

And same for telegram package:

$ python3 -m pip install telegram
Defaulting to user installation because normal site-packages is not writeable
Requirement already satisfied: telegram in /home/miquel/.local/lib/python3.10/site-packages (0.0.1)

But still does not work, continuing with same error ImportError: cannot import name 'Update' from 'telegram'

From this:

Can you try:

pip install python-telegram-bot