Fix dash pushing to heroku

Hi.
I am trying to push to heroku and it runs installs everything there but my app doesnt open.
Please, see heroku log below:

heroku logs --tail
2019-10-24T12:47:34.731472+00:00 app[web.1]: File “/app/.heroku/python/lib/python3.7/site-packages/pandas/io/excel/_base.py”, line 359, in init
2019-10-24T12:47:34.731473+00:00 app[web.1]: self.book = self.load_workbook(filepath_or_buffer)
2019-10-24T12:47:34.731475+00:00 app[web.1]: File “/app/.heroku/python/lib/python3.7/site-packages/pandas/io/excel/_xlrd.py”, line 36, in load_workbook
2019-10-24T12:47:34.731476+00:00 app[web.1]: return open_workbook(filepath_or_buffer)
2019-10-24T12:47:34.731477+00:00 app[web.1]: File “/app/.heroku/python/lib/python3.7/site-packages/xlrd/init.py”, line 111, in open_workbook
2019-10-24T12:47:34.731478+00:00 app[web.1]: with open(filename, “rb”) as f:
2019-10-24T12:47:34.73148+00:00 app[web.1]: FileNotFoundError: [Errno 2] No such file or directory: ‘data\df_matriz.xlsx’
2019-10-24T12:47:34.731705+00:00 app[web.1]: [2019-10-24 12:47:34 +0000] [10] [INFO] Worker exiting (pid: 10)
2019-10-24T12:47:34.734577+00:00 app[web.1]: [2019-10-24 12:47:34 +0000] [11] [ERROR] Exception in worker process
2019-10-24T12:47:34.73458+00:00 app[web.1]: Traceback (most recent call last):
2019-10-24T12:47:34.734582+00:00 app[web.1]: File “/app/.heroku/python/lib/python3.7/site-packages/gunicorn/arbiter.py”, line 583, in spawn_worker
2019-10-24T12:47:34.734583+00:00 app[web.1]: worker.init_process()
2019-10-24T12:47:34.734585+00:00 app[web.1]: File “/app/.heroku/python/lib/python3.7/site-packages/gunicorn/workers/base.py”, line 129, in init_process
2019-10-24T12:47:34.734586+00:00 app[web.1]: self.load_wsgi()
2019-10-24T12:47:34.734587+00:00 app[web.1]: File “/app/.heroku/python/lib/python3.7/site-packages/gunicorn/workers/base.py”, line 138, in load_wsgi
2019-10-24T12:47:34.734589+00:00 app[web.1]: self.wsgi = self.app.wsgi()
2019-10-24T12:47:34.73459+00:00 app[web.1]: File “/app/.heroku/python/lib/python3.7/site-packages/gunicorn/app/base.py”, line 67, in wsgi
2019-10-24T12:47:34.734591+00:00 app[web.1]: self.callable = self.load()
2019-10-24T12:47:34.734593+00:00 app[web.1]: File “/app/.heroku/python/lib/python3.7/site-packages/gunicorn/app/wsgiapp.py”, line 52, in load
2019-10-24T12:47:34.734594+00:00 app[web.1]: return self.load_wsgiapp()
2019-10-24T12:47:34.734595+00:00 app[web.1]: File “/app/.heroku/python/lib/python3.7/site-packages/gunicorn/app/wsgiapp.py”, line 41, in load_wsgiapp
2019-10-24T12:47:34.734597+00:00 app[web.1]: return util.import_app(self.app_uri)
2019-10-24T12:47:34.734598+00:00 app[web.1]: File “/app/.heroku/python/lib/python3.7/site-packages/gunicorn/util.py”, line 350, in import_app
2019-10-24T12:47:34.734599+00:00 app[web.1]: import(module)
2019-10-24T12:47:34.734601+00:00 app[web.1]: File “/app/app.py”, line 6, in
2019-10-24T12:47:34.734602+00:00 app[web.1]: from pages import (
2019-10-24T12:47:34.734603+00:00 app[web.1]: File “/app/pages/overview.py”, line 44, in
2019-10-24T12:47:34.734605+00:00 app[web.1]: encoding=“latin-1”)
2019-10-24T12:47:34.734606+00:00 app[web.1]: File “/app/.heroku/python/lib/python3.7/site-packages/pandas/util/_decorators.py”, line 208, in wrapper
2019-10-24T12:47:34.734607+00:00 app[web.1]: return func(*args, **kwargs)
2019-10-24T12:47:34.734609+00:00 app[web.1]: File “/app/.heroku/python/lib/python3.7/site-packages/pandas/io/excel/_base.py”, line 310, in read_excel
2019-10-24T12:47:34.73461+00:00 app[web.1]: io = ExcelFile(io, engine=engine)
2019-10-24T12:47:34.734611+00:00 app[web.1]: File “/app/.heroku/python/lib/python3.7/site-packages/pandas/io/excel/_base.py”, line 819, in init
2019-10-24T12:47:34.734612+00:00 app[web.1]: self._reader = self._enginesengine
2019-10-24T12:47:34.734613+00:00 app[web.1]: File “/app/.heroku/python/lib/python3.7/site-packages/pandas/io/excel/_xlrd.py”, line 21, in init
2019-10-24T12:47:34.734615+00:00 app[web.1]: super().init(filepath_or_buffer)
2019-10-24T12:47:34.734616+00:00 app[web.1]: File “/app/.heroku/python/lib/python3.7/site-packages/pandas/io/excel/_base.py”, line 359, in init
2019-10-24T12:47:34.734617+00:00 app[web.1]: self.book = self.load_workbook(filepath_or_buffer)
2019-10-24T12:47:34.734619+00:00 app[web.1]: File “/app/.heroku/python/lib/python3.7/site-packages/pandas/io/excel/_xlrd.py”, line 36, in load_workbook
2019-10-24T12:47:34.73462+00:00 app[web.1]: return open_workbook(filepath_or_buffer)
2019-10-24T12:47:34.734621+00:00 app[web.1]: File “/app/.heroku/python/lib/python3.7/site-packages/xlrd/init.py”, line 111, in open_workbook
2019-10-24T12:47:34.734622+00:00 app[web.1]: with open(filename, “rb”) as f:
2019-10-24T12:47:34.734624+00:00 app[web.1]: FileNotFoundError: [Errno 2] No such file or directory: ‘data\df_matriz.xlsx’
2019-10-24T12:47:34.735135+00:00 app[web.1]: [2019-10-24 12:47:34 +0000] [11] [INFO] Worker exiting (pid: 11)
2019-10-24T12:47:35.130829+00:00 app[web.1]: [2019-10-24 12:47:35 +0000] [4] [INFO] Shutting down: Master
2019-10-24T12:47:35.130938+00:00 app[web.1]: [2019-10-24 12:47:35 +0000] [4] [INFO] Reason: Worker failed to boot.
2019-10-24T12:47:35.206997+00:00 heroku[web.1]: Process exited with status 3
2019-10-24T12:47:35.24727+00:00 heroku[web.1]: State changed from up to crashed
2019-10-24T13:08:00.776878+00:00 heroku[web.1]: State changed from crashed to starting
2019-10-24T13:08:16.56521+00:00 heroku[web.1]: Starting process with command gunicorn --pythonpath apps/van-champions-league-to-share app:server
2019-10-24T13:08:18.819135+00:00 app[web.1]: [2019-10-24 13:08:18 +0000] [4] [INFO] Starting gunicorn 19.9.0
2019-10-24T13:08:18.819995+00:00 app[web.1]: [2019-10-24 13:08:18 +0000] [4] [INFO] Listening at: http://0.0.0.0:48924 (4)
2019-10-24T13:08:18.820145+00:00 app[web.1]: [2019-10-24 13:08:18 +0000] [4] [INFO] Using worker: sync
2019-10-24T13:08:18.825948+00:00 app[web.1]: [2019-10-24 13:08:18 +0000] [10] [INFO] Booting worker with pid: 10
2019-10-24T13:08:18.91101+00:00 app[web.1]: [2019-10-24 13:08:18 +0000] [11] [INFO] Booting worker with pid: 11
2019-10-24T13:08:19.462865+00:00 heroku[web.1]: State changed from starting to up
2019-10-24T13:08:27.537103+00:00 app[web.1]: [2019-10-24 13:08:27 +0000] [11] [ERROR] Exception in worker process
2019-10-24T13:08:27.537124+00:00 app[web.1]: Traceback (most recent call last):
2019-10-24T13:08:27.537127+00:00 app[web.1]: File “/app/.heroku/python/lib/python3.7/site-packages/gunicorn/arbiter.py”, line 583, in spawn_worker
2019-10-24T13:08:27.537129+00:00 app[web.1]: worker.init_process()
2019-10-24T13:08:27.53713+00:00 app[web.1]: File “/app/.heroku/python/lib/python3.7/site-packages/gunicorn/workers/base.py”, line 129, in init_process
2019-10-24T13:08:27.537132+00:00 app[web.1]: self.load_wsgi()
2019-10-24T13:08:27.537133+00:00 app[web.1]: File “/app/.heroku/python/lib/python3.7/site-packages/gunicorn/workers/base.py”, line 138, in load_wsgi
2019-10-24T13:08:27.537134+00:00 app[web.1]: self.wsgi = self.app.wsgi()
2019-10-24T13:08:27.537136+00:00 app[web.1]: File “/app/.heroku/python/lib/python3.7/site-packages/gunicorn/app/base.py”, line 67, in wsgi
2019-10-24T13:08:27.537138+00:00 app[web.1]: self.callable = self.load()
2019-10-24T13:08:27.537139+00:00 app[web.1]: File “/app/.heroku/python/lib/python3.7/site-packages/gunicorn/app/wsgiapp.py”, line 52, in load
2019-10-24T13:08:27.53714+00:00 app[web.1]: return self.load_wsgiapp()
2019-10-24T13:08:27.537142+00:00 app[web.1]: File “/app/.heroku/python/lib/python3.7/site-packages/gunicorn/app/wsgiapp.py”, line 41, in load_wsgiapp
2019-10-24T13:08:27.537143+00:00 app[web.1]: return util.import_app(self.app_uri)
2019-10-24T13:08:27.537144+00:00 app[web.1]: File “/app/.heroku/python/lib/python3.7/site-packages/gunicorn/util.py”, line 350, in import_app
2019-10-24T13:08:27.537146+00:00 app[web.1]: import(module)
2019-10-24T13:08:27.537147+00:00 app[web.1]: File “/app/app.py”, line 6, in
2019-10-24T13:08:27.537148+00:00 app[web.1]: from pages import (
2019-10-24T13:08:27.537151+00:00 app[web.1]: File “/app/pages/overview.py”, line 44, in
2019-10-24T13:08:27.537152+00:00 app[web.1]: encoding=“latin-1”)
2019-10-24T13:08:27.537153+00:00 app[web.1]: File “/app/.heroku/python/lib/python3.7/site-packages/pandas/util/_decorators.py”, line 208, in wrapper
2019-10-24T13:08:27.537155+00:00 app[web.1]: return func(*args, **kwargs)
2019-10-24T13:08:27.537156+00:00 app[web.1]: File “/app/.heroku/python/lib/python3.7/site-packages/pandas/io/excel/_base.py”, line 310, in read_excel
2019-10-24T13:08:27.537157+00:00 app[web.1]: io = ExcelFile(io, engine=engine)
2019-10-24T13:08:27.537159+00:00 app[web.1]: File “/app/.heroku/python/lib/python3.7/site-packages/pandas/io/excel/_base.py”, line 819, in init
2019-10-24T13:08:27.53716+00:00 app[web.1]: self._reader = self._enginesengine
2019-10-24T13:08:27.537161+00:00 app[web.1]: File “/app/.heroku/python/lib/python3.7/site-packages/pandas/io/excel/_xlrd.py”, line 21, in init
2019-10-24T13:08:27.537163+00:00 app[web.1]: super().init(filepath_or_buffer)
2019-10-24T13:08:27.537164+00:00 app[web.1]: File “/app/.heroku/python/lib/python3.7/site-packages/pandas/io/excel/_base.py”, line 359, in init
2019-10-24T13:08:27.537165+00:00 app[web.1]: self.book = self.load_workbook(filepath_or_buffer)
2019-10-24T13:08:27.537166+00:00 app[web.1]: File “/app/.heroku/python/lib/python3.7/site-packages/pandas/io/excel/_xlrd.py”, line 36, in load_workbook
2019-10-24T13:08:27.537168+00:00 app[web.1]: return open_workbook(filepath_or_buffer)
2019-10-24T13:08:27.537169+00:00 app[web.1]: File “/app/.heroku/python/lib/python3.7/site-packages/xlrd/init.py”, line 111, in open_workbook
2019-10-24T13:08:27.537171+00:00 app[web.1]: with open(filename, “rb”) as f:
2019-10-24T13:08:27.537172+00:00 app[web.1]: FileNotFoundError: [Errno 2] No such file or directory: ‘data\df_matriz.xlsx’
2019-10-24T13:08:27.537614+00:00 app[web.1]: [2019-10-24 13:08:27 +0000] [11] [INFO] Worker exiting (pid: 11)
2019-10-24T13:08:27.540583+00:00 app[web.1]: [2019-10-24 13:08:27 +0000] [10] [ERROR] Exception in worker process
2019-10-24T13:08:27.540587+00:00 app[web.1]: Traceback (most recent call last):
2019-10-24T13:08:27.540588+00:00 app[web.1]: File “/app/.heroku/python/lib/python3.7/site-packages/gunicorn/arbiter.py”, line 583, in spawn_worker
2019-10-24T13:08:27.54059+00:00 app[web.1]: worker.init_process()
2019-10-24T13:08:27.540591+00:00 app[web.1]: File “/app/.heroku/python/lib/python3.7/site-packages/gunicorn/workers/base.py”, line 129, in init_process
2019-10-24T13:08:27.540592+00:00 app[web.1]: self.load_wsgi()
2019-10-24T13:08:27.540594+00:00 app[web.1]: File “/app/.heroku/python/lib/python3.7/site-packages/gunicorn/workers/base.py”, line 138, in load_wsgi
2019-10-24T13:08:27.540595+00:00 app[web.1]: self.wsgi = self.app.wsgi()

It’s failing because it can’t find the data. Has that been uploaded with the source code?

FileNotFoundError: [Errno 2] No such file or directory: ‘data\df_matriz.xlsx’

Also that path looks like a windows path but Heroku dynos are virtualized Unix containers, so that might be part of the problem?

1 Like

Hi Thanks.
I am sure the data is there I think. Let me show you some output.

I run this command:

heroku run ls

and I get this output:

Running ls on ⬢ liga-misau... up, run.3808 (Free)
 app.py                 Procfile        Barchart.ipynb'  'VAN MISAU_v1.ipynb'
 assets
 data                   requirements.txt   utils.py                                            
 df_classificação.csv   runtime.txt                             
 pages                  screenshots 

So, data folder looks like is there. Do you agree with me?
Thanks.

Ok, then I think the problem could be related to the \ in the path which looks windows specific, unix paths use /. You could either try hardcoding data/df_matriz.xlsx or you could instead use pathlib or os.path in Python to construct the path.

Great idea.
I will channge \ to / bu dont know how to use pathlib or os.path. I will search for it because I saw many app using it but aas wee are now diagnosing theee reason for mmy app not working in heroku but workinng in localhost, to be sure, if you could help me with some example using pathlib or os.path it should be great. Nevertheless, I thank you so much for the help.

Sure, pathlib would be something like

from pathlib import Path

data_path = Path("data") / "df_matriz.xlsx"

pd.read_excel(data_path)  # or whatever you want to do

or os.path

import os

data_path = os.path.join("data", "df_matriz.xlsx")

pd.read_excel(data_path)

Thanks but looks like heroku bug.
Heroku doesnt update my app even though my all files are pushed to heroku directory.
It is sucking. It is taking very long time to see some change through heroku logs.
Is there any better deployment website other than heroku?