1

Was able to push the app with no issues but when try to access the app using the provided url (randomname.herokuapp.com) I get an error and when trying to get more details, this is part of what I get when I type heroku logs --tail:

 line 525, in reap_workers
2021-06-22T20:14:16.545426+00:00 app[web.1]: raise HaltServer(reason, self.WORKER_BOOT_ERROR)
2021-06-22T20:14:16.545426+00:00 app[web.1]: gunicorn.errors.HaltServer: <HaltServer 'Worker failed to boot.' 3>
2021-06-22T20:14:16.642285+00:00 heroku[web.1]: Process exited with status 1
2021-06-22T20:14:16.769100+00:00 heroku[web.1]: State changed from starting to crashed
2021-06-22T20:14:38.349399+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path="/" host=mooddetection.herokuapp.com request_id=7b53a355-7ab8-4bd3-b412-7adb57be7b44 fwd="24.3.214.102" dyno= connect= service= status=503 bytes= protocol=https

After some research I was advised to get into a more detail issue by typying gunicorn app:application --preload -b 0.0.0.0:5000 and this is what I got:

Traceback (most recent call last):
  File "c:\users\gucas\anaconda3\envs\emotion_env\lib\runpy.py", line 193, in _run_module_as_main
    "__main__", mod_spec)
  File "c:\users\gucas\anaconda3\envs\emotion_env\lib\runpy.py", line 85, in _run_code
    exec(code, run_globals)
  File "C:\Users\gucas\anaconda3\envs\emotion_env\Scripts\gunicorn.exe\__main__.py", line 4, in <module>
  File "c:\users\gucas\anaconda3\envs\emotion_env\lib\site-packages\gunicorn\app\wsgiapp.py", line 9, in <module>
    from gunicorn.app.base import Application
  File "c:\users\gucas\anaconda3\envs\emotion_env\lib\site-packages\gunicorn\app\base.py", line 11, in <module>
    from gunicorn import util
  File "c:\users\gucas\anaconda3\envs\emotion_env\lib\site-packages\gunicorn\util.py", line 8, in <module>
    import fcntl
ModuleNotFoundError: No module named 'fcntl'

I am stuck at this point since most of my findings are related to Django or running gunicorn in windows which is not my case. I just have a flask app that I want to deploy into heroku using a requirement.txt file that was apparently done with no issues.

Please advise what to do.

Much appreciated!

davidism
  • 121,510
  • 29
  • 395
  • 339
tmd13
  • 55
  • 2
  • 6
  • Does this answer your question? [Error: No module named 'fcntl'](https://stackoverflow.com/questions/45228395/error-no-module-named-fcntl) – Michael Ruth Jun 22 '21 at 22:32
  • @MichaelRuth My error is related to gunicorn that is used to deploy my flask application to heroku. – tmd13 Jun 22 '21 at 22:35
  • 1
    `C:\Users\gucas\...` looks like a Windows path to me. Also looks like `gunicorn` is trying to use `fcntl` which isn't available on Windows. – Michael Ruth Jun 22 '21 at 22:45
  • @MichaelRuth shouldn't this no longer be a windows issue since I am trying to run it on heroku, not on my computer? I run the command line to try to find the issue based on some findings online – tmd13 Jun 22 '21 at 22:49
  • 1
    Oh, so the first error was generated on Heroku, and the second error was generated on your local machine? – Michael Ruth Jun 22 '21 at 22:51
  • Well this is what I get on heroku when trying to run the app: Application error An error occurred in the application and your page could not be served. If you are the application owner, check your logs for details. You can do this from the Heroku CLI with the command heroku logs --tail – tmd13 Jun 22 '21 at 22:52
  • 1
    How are you exactly running your application? It seems it is running locally with all the Windows paths. Are you using `heroku local`? – Gino Mempin Jun 22 '21 at 22:57
  • just using their provided url – tmd13 Jun 22 '21 at 23:00
  • url is generally randomname.herokuapp.com. What should I do to fix that issue? Is it maybe a settings inssue on the heroku website? I deployed it using git then just proceeded to run it. When I got the error they ask to run this (heroku logs --tail ) on the command line and thats how I got the logs – tmd13 Jun 22 '21 at 23:19
  • [Heroku's stacks are not using Windows, AFAIK](https://devcenter.heroku.com/articles/stack). I suspect you have a different error on Heroku, but right now the commands you are using *locally* are running the app *also locally* on windows, which isn't compatible with gunicorn. That's why I asked if you used `heroku local`. For complete reproducibility, can you also post your requirements.txt and Procfile. – Gino Mempin Jun 23 '21 at 01:34
  • 1
    I was able to figure out this issue after further research. The main error was related to a library called opencv-python and got it working by replacing it with another one called opencv-python-headless. Appreciate all the help! – tmd13 Jun 23 '21 at 17:15

0 Answers0