I’m encountering an issue with my Telegram bot developed using Django after attempting to upgrade the Python version. Initially, everything worked perfectly on Python 3.6.9, but due to Heroku not supporting it anymore, I had to update to 3.6.10.
Upon trying to run my bot, I’m facing the following error:
from .callbackcontext import CallbackContext File
"/home/usr/bot-name/venv/lib/python3.6/site-packages/telegram/ext/callbackcontext.py",
line 21, in <module> from telegram import Update
ImportError: cannot import name 'Update' from 'telegram'
I also tested it with Python 3.7.6, which is still supported, but I received the same error when attempting to start the server:
python manage.py runserver
Watching for file changes with StatReloader
Exception in thread django-main-thread:
Traceback (most recent call last):
File "/usr/local/lib/python3.7/threading.py", line 926, in _bootstrap_inner
self.run()
File "/usr/local/lib/python3.7/threading.py", line 870, in run
self._target(*self._args, **self._kwargs)
...
ImportError: cannot import name 'Update' from 'telegram' (/home/usr/bot-name/venv/lib/python3.7/site-packages/telegram/__init__.py)
Here are my current package dependencies:
cffi==1.13.2
cryptography==2.8
dj-database-url==0.5.0
Django==2.2.7
django-heroku==0.3.1
django-telegrambot==1.0.1
et-xmlfile==1.0.1
future==0.18.2
gunicorn==20.0.4
jdcal==1.4.1
mysqlclient==1.4.5
openpyxl==3.0.2
pipenv==2018.11.26
psycopg2==2.8.4
pycparser==2.19
python-telegram-bot==12.2.0
pytz==2019.3
six==1.13.0
sqlparse==0.3.0
telegram==0.0.1
tornado==6.0.3
virtualenv==16.7.9
virtualenv-clone==0.5.3
whitenoise==5.0.1
Can anyone help me identify the reason behind this import problem?