This is the official document https://github.com/python-telegram-bot/python-telegram-bot. How do I using pip install python-telegram-bot --upgrade on heroku. These are crashed messages.
2022-05-14T19:57:10.129393 00:00 heroku[web.1]: State changed from starting to crashed
2022-05-14T19:57:10.133517 00:00 heroku[web.1]: State changed from crashed to starting
2022-05-14T19:57:13.000000 00:00 app[api]: Build succeeded
2022-05-14T19:57:13.393948 00:00 heroku[web.1]: Starting process with command `gunicorn app:app`
2022-05-14T19:57:14.270178 00:00 app[web.1]: [2022-05-14 19:57:14 0000] [4] [INFO] Starting gunicorn 20.1.0
2022-05-14T19:57:14.270671 00:00 app[web.1]: [2022-05-14 19:57:14 0000] [4] [INFO] Listening at: http://0.0.0.0:20713 (4)
2022-05-14T19:57:14.270711 00:00 app[web.1]: [2022-05-14 19:57:14 0000] [4] [INFO] Using worker: sync
2022-05-14T19:57:14.274010 00:00 app[web.1]: [2022-05-14 19:57:14 0000] [9] [INFO] Booting worker with pid: 9
2022-05-14T19:57:14.327970 00:00 app[web.1]: [2022-05-14 19:57:14 0000] [10] [INFO] Booting worker with pid: 10
2022-05-14T19:57:14.372053 00:00 app[web.1]: [2022-05-14 19:57:14 0000] [9] [ERROR] Exception in worker process
2022-05-14T19:57:14.372057 00:00 app[web.1]: Traceback (most recent call last):
2022-05-14T19:57:14.372065 00:00 app[web.1]: File "/app/.heroku/python/lib/python3.10/site-packages/gunicorn/arbiter.py", line 589, in spawn_worker
2022-05-14T19:57:14.372066 00:00 app[web.1]: worker.init_process()
2022-05-14T19:57:14.372066 00:00 app[web.1]: File "/app/.heroku/python/lib/python3.10/site-packages/gunicorn/workers/base.py", line 134, in init_process
2022-05-14T19:57:14.372066 00:00 app[web.1]: self.load_wsgi()
2022-05-14T19:57:14.372067 00:00 app[web.1]: File "/app/.heroku/python/lib/python3.10/site-packages/gunicorn/workers/base.py", line 146, in load_wsgi
2022-05-14T19:57:14.372067 00:00 app[web.1]: self.wsgi = self.app.wsgi()
2022-05-14T19:57:14.372067 00:00 app[web.1]: File "/app/.heroku/python/lib/python3.10/site-packages/gunicorn/app/base.py", line 67, in wsgi
2022-05-14T19:57:14.372067 00:00 app[web.1]: self.callable = self.load()
2022-05-14T19:57:14.372068 00:00 app[web.1]: File "/app/.heroku/python/lib/python3.10/site-packages/gunicorn/app/wsgiapp.py", line 58, in load
2022-05-14T19:57:14.372068 00:00 app[web.1]: return self.load_wsgiapp()
2022-05-14T19:57:14.372068 00:00 app[web.1]: File "/app/.heroku/python/lib/python3.10/site-packages/gunicorn/app/wsgiapp.py", line 48, in load_wsgiapp
2022-05-14T19:57:14.372068 00:00 app[web.1]: return util.import_app(self.app_uri)
2022-05-14T19:57:14.372069 00:00 app[web.1]: File "/app/.heroku/python/lib/python3.10/site-packages/gunicorn/util.py", line 359, in import_app
2022-05-14T19:57:14.372069 00:00 app[web.1]: mod = importlib.import_module(module)
2022-05-14T19:57:14.372069 00:00 app[web.1]: File "/app/.heroku/python/lib/python3.10/importlib/__init__.py", line 126, in import_module
2022-05-14T19:57:14.372070 00:00 app[web.1]: return _bootstrap._gcd_import(name[level:], package, level)
2022-05-14T19:57:14.372070 00:00 app[web.1]: File "<frozen importlib._bootstrap>", line 1050, in _gcd_import
2022-05-14T19:57:14.372070 00:00 app[web.1]: File "<frozen importlib._bootstrap>", line 1027, in _find_and_load
2022-05-14T19:57:14.372070 00:00 app[web.1]: File "<frozen importlib._bootstrap>", line 1006, in _find_and_load_unlocked
2022-05-14T19:57:14.372070 00:00 app[web.1]: File "<frozen importlib._bootstrap>", line 688, in _load_unlocked
2022-05-14T19:57:14.372071 00:00 app[web.1]: File "<frozen importlib._bootstrap_external>", line 883, in exec_module
2022-05-14T19:57:14.372071 00:00 app[web.1]: File "<frozen importlib._bootstrap>", line 241, in _call_with_frames_removed
2022-05-14T19:57:14.372071 00:00 app[web.1]: File "/app/app.py", line 3, in <module>
2022-05-14T19:57:14.372071 00:00 app[web.1]: import telebot
2022-05-14T19:57:14.372071 00:00 app[web.1]: ModuleNotFoundError: No module named 'telebot'
2022-05-14T19:57:14.372143 00:00 app[web.1]: [2022-05-14 19:57:14 0000] [9] [INFO] Worker exiting (pid: 9)
2022-05-14T19:57:14.433579 00:00 app[web.1]: [2022-05-14 19:57:14 0000] [10] [ERROR] Exception in worker process
2022-05-14T19:57:14.433580 00:00 app[web.1]: Traceback (most recent call last):
2022-05-14T19:57:14.433580 00:00 app[web.1]: File "/app/.heroku/python/lib/python3.10/site-packages/gunicorn/arbiter.py", line 589, in spawn_worker
2022-05-14T19:57:14.433581 00:00 app[web.1]: worker.init_process()
2022-05-14T19:57:14.433581 00:00 app[web.1]: File "/app/.heroku/python/lib/python3.10/site-packages/gunicorn/workers/base.py", line 134, in init_process
2022-05-14T19:57:14.433581 00:00 app[web.1]: self.load_wsgi()
2022-05-14T19:57:14.433582 00:00 app[web.1]: File "/app/.heroku/python/lib/python3.10/site-packages/gunicorn/workers/base.py", line 146, in load_wsgi
2022-05-14T19:57:14.433582 00:00 app[web.1]: self.wsgi = self.app.wsgi()
2022-05-14T19:57:14.433582 00:00 app[web.1]: File "/app/.heroku/python/lib/python3.10/site-packages/gunicorn/app/base.py", line 67, in wsgi
2022-05-14T19:57:14.433582 00:00 app[web.1]: self.callable = self.load()
2022-05-14T19:57:14.433583 00:00 app[web.1]: File "/app/.heroku/python/lib/python3.10/site-packages/gunicorn/app/wsgiapp.py", line 58, in load
2022-05-14T19:57:14.433583 00:00 app[web.1]: return self.load_wsgiapp()
2022-05-14T19:57:14.433583 00:00 app[web.1]: File "/app/.heroku/python/lib/python3.10/site-packages/gunicorn/app/wsgiapp.py", line 48, in load_wsgiapp
2022-05-14T19:57:14.433583 00:00 app[web.1]: return util.import_app(self.app_uri)
2022-05-14T19:57:14.433583 00:00 app[web.1]: File "/app/.heroku/python/lib/python3.10/site-packages/gunicorn/util.py", line 359, in import_app
2022-05-14T19:57:14.433584 00:00 app[web.1]: mod = importlib.import_module(module)
2022-05-14T19:57:14.433584 00:00 app[web.1]: File "/app/.heroku/python/lib/python3.10/importlib/__init__.py", line 126, in import_module
2022-05-14T19:57:14.433584 00:00 app[web.1]: return _bootstrap._gcd_import(name[level:], package, level)
2022-05-14T19:57:14.433584 00:00 app[web.1]: File "<frozen importlib._bootstrap>", line 1050, in _gcd_import
2022-05-14T19:57:14.433585 00:00 app[web.1]: File "<frozen importlib._bootstrap>", line 1027, in _find_and_load
2022-05-14T19:57:14.433585 00:00 app[web.1]: File "<frozen importlib._bootstrap>", line 1006, in _find_and_load_unlocked
2022-05-14T19:57:14.433585 00:00 app[web.1]: File "<frozen importlib._bootstrap>", line 688, in _load_unlocked
2022-05-14T19:57:14.433585 00:00 app[web.1]: File "<frozen importlib._bootstrap_external>", line 883, in exec_module
2022-05-14T19:57:14.433587 00:00 app[web.1]: File "<frozen importlib._bootstrap>", line 241, in _call_with_frames_removed
2022-05-14T19:57:14.433587 00:00 app[web.1]: File "/app/app.py", line 3, in <module>
2022-05-14T19:57:14.433587 00:00 app[web.1]: import telebot
2022-05-14T19:57:14.433588 00:00 app[web.1]: ModuleNotFoundError: No module named 'telebot'
2022-05-14T19:57:14.433666 00:00 app[web.1]: [2022-05-14 19:57:14 0000] [10] [INFO] Worker exiting (pid: 10)
2022-05-14T19:57:14.488129 00:00 app[web.1]: Traceback (most recent call last):
2022-05-14T19:57:14.488138 00:00 app[web.1]: File "/app/.heroku/python/lib/python3.10/site-packages/gunicorn/arbiter.py", line 209, in run
2022-05-14T19:57:14.488349 00:00 app[web.1]: self.sleep()
2022-05-14T19:57:14.488357 00:00 app[web.1]: File "/app/.heroku/python/lib/python3.10/site-packages/gunicorn/arbiter.py", line 357, in sleep
2022-05-14T19:57:14.488467 00:00 app[web.1]: ready = select.select([self.PIPE[0]], [], [], 1.0)
2022-05-14T19:57:14.488469 00:00 app[web.1]: File "/app/.heroku/python/lib/python3.10/site-packages/gunicorn/arbiter.py", line 242, in handle_chld
2022-05-14T19:57:14.488550 00:00 app[web.1]: self.reap_workers()
2022-05-14T19:57:14.488551 00:00 app[web.1]: File "/app/.heroku/python/lib/python3.10/site-packages/gunicorn/arbiter.py", line 525, in reap_workers
2022-05-14T19:57:14.488663 00:00 app[web.1]: raise HaltServer(reason, self.WORKER_BOOT_ERROR)
2022-05-14T19:57:14.488703 00:00 app[web.1]: gunicorn.errors.HaltServer: <HaltServer 'Worker failed to boot.' 3>
2022-05-14T19:57:14.488705 00:00 app[web.1]:
2022-05-14T19:57:14.488705 00:00 app[web.1]: During handling of the above exception, another exception occurred:
2022-05-14T19:57:14.488705 00:00 app[web.1]:
2022-05-14T19:57:14.488712 00:00 app[web.1]: Traceback (most recent call last):
2022-05-14T19:57:14.488719 00:00 app[web.1]: File "/app/.heroku/python/bin/gunicorn", line 8, in <module>
2022-05-14T19:57:14.488784 00:00 app[web.1]: sys.exit(run())
2022-05-14T19:57:14.488789 00:00 app[web.1]: File "/app/.heroku/python/lib/python3.10/site-packages/gunicorn/app/wsgiapp.py", line 67, in run
2022-05-14T19:57:14.488848 00:00 app[web.1]: WSGIApplication("%(prog)s [OPTIONS] [APP_MODULE]").run()
2022-05-14T19:57:14.488856 00:00 app[web.1]: File "/app/.heroku/python/lib/python3.10/site-packages/gunicorn/app/base.py", line 231, in run
2022-05-14T19:57:14.488938 00:00 app[web.1]: super().run()
2022-05-14T19:57:14.488950 00:00 app[web.1]: File "/app/.heroku/python/lib/python3.10/site-packages/gunicorn/app/base.py", line 72, in run
2022-05-14T19:57:14.489010 00:00 app[web.1]: Arbiter(self).run()
2022-05-14T19:57:14.489018 00:00 app[web.1]: File "/app/.heroku/python/lib/python3.10/site-packages/gunicorn/arbiter.py", line 229, in run
2022-05-14T19:57:14.489093 00:00 app[web.1]: self.halt(reason=inst.reason, exit_status=inst.exit_status)
2022-05-14T19:57:14.489101 00:00 app[web.1]: File "/app/.heroku/python/lib/python3.10/site-packages/gunicorn/arbiter.py", line 342, in halt
2022-05-14T19:57:14.489195 00:00 app[web.1]: self.stop()
2022-05-14T19:57:14.489203 00:00 app[web.1]: File "/app/.heroku/python/lib/python3.10/site-packages/gunicorn/arbiter.py", line 393, in stop
2022-05-14T19:57:14.489299 00:00 app[web.1]: time.sleep(0.1)
2022-05-14T19:57:14.489307 00:00 app[web.1]: File "/app/.heroku/python/lib/python3.10/site-packages/gunicorn/arbiter.py", line 242, in handle_chld
2022-05-14T19:57:14.489383 00:00 app[web.1]: self.reap_workers()
2022-05-14T19:57:14.489391 00:00 app[web.1]: File "/app/.heroku/python/lib/python3.10/site-packages/gunicorn/arbiter.py", line 525, in reap_workers
2022-05-14T19:57:14.489499 00:00 app[web.1]: raise HaltServer(reason, self.WORKER_BOOT_ERROR)
2022-05-14T19:57:14.489524 00:00 app[web.1]: gunicorn.errors.HaltServer: <HaltServer 'Worker failed to boot.' 3>
2022-05-14T19:57:14.619791 00:00 heroku[web.1]: Process exited with status 1
2022-05-14T19:57:14.690454 00:00 heroku[web.1]: State changed from starting to crashed
Procfile
web: gunicorn app:app
requirements.txt
flask
gunicorn
python-telegram-bot==13.11
app.py
from flask import Flask, request
import telebot
app = Flask(__name__)
bot = telebot.TeleBot('myTelBotID')
@app.route("/webhook", methods=['post'])
def webhook():
print(request.data.decode('utf-8'))
bot.send_message(myChatRoomId, request.data.decode('utf-8'))
return '{"status":"successed"}'
bot.polling()
CodePudding user response:
telbot is diffrent from python-telegram-bot, if this script works on your local machine, just save your dependcies in the requirements file by:
pip freeze > requirements.txt
Commit the changes and push them to Heroku.
To install latest version of python-telegram-bot remove ==13.11
from requrements file.
To install telbot
just add it to your requrements file