Cannot import anything from `telegram`

Question:

I have installed telegram bot by running pip install python-telegram-bot in Shell. The installation ran fine. I have the latest version:

pip index versions telegram
WARNING: pip index is currently an experimental command. It may be removed/changed in a future release without prior warning.
telegram (0.0.1)
Available versions: 0.0.1
INSTALLED: 0.0.1
LATEST: 0.0.1

However, I cannot import anything from telegram. The error I am getting is

ImportError: cannot import name 'Chat' from 'telegram' (/home/runner/TimeCoinBot/.pythonlibs/lib/python3.10/site-packages/telegram/__init__.py)

I opened the /.pythonlibs/lib/python3.10/site-packages/telegram/__init__.py and it reads

# coding: utf-8


class Telegram(object):

    def __init__(self):
        print('coming soon...')

No wonder I cannot import anything. Could anyone explain how to fix the problem and make the package run?

Repl link:

https://replit.com/@zyxxy/TimeCoinBot

Check if the package is inside the pip list command.

If it is try to reinstall the package like

pip uninstall python-telegram-bot
pip install python-telegram-bot
1 Like

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.