1

I am trying to deploy a flask application (https://github.com/ihavemadefire/BestYearYet) using Heroku. When I deploy it it crashes immediately. I can't tell if the redirect is telling me there is an error in my code (It runs perfectly on a local browser port), an error in my virtual env or if there is an error in an external library.

I have tried updating the appdirs and flask-dateutil libraries. I have tried deploying from the Heroku git cli and from Github. I checked my code to see if I missed something (but like I said, it runs fine locally) I even tried rebooting. I think this problem is beyond my experience level.

Here are the relevant error logs from Heroku (greatly truncated):

File "/app/.heroku/python/lib/python3.6/site-packages/alembic/script/base.py", line 7, in from dateutil import tz File "/app/.heroku/python/lib/python3.6/site-packages/dateutil/tz.py", line 78 self._name, ^

2
  • Have you tried to run a fresh copy of the repo in a new virtualenv? Try to mimic what Heroku does on deployment. Commented Apr 8, 2019 at 19:44
  • Simply setting python-dateutil==2.8.1 in requirements.txt solved the issue for me. Heroku was using python-dateutil==1.5.0 which seemingly had compatibility issues with python-3.6.13. Upon pushing, Heroku gave this error ERROR: heroku 0.1.4 has requirement python-dateutil==1.5, but you'll have python-dateutil 2.8.1 which is incompatible., and then showed installed python-dateutil-2.8.1 successfully. I don't know what happened here, but everything started working correctly! XD Commented Mar 12, 2021 at 13:04

2 Answers 2

4

Uninstall python-dateutil:

pip uninstall python-dateutil

And install the new version:

i use this version

pip install python-dateutil==2.81

see if you have the requirements.txt file, remember to change the version of python-dateutil there too, manually or try this:

pip freeze > requirements.txt

if you don't have a requirements.txt, consider making one because it is "good practice" and is really helpfull

Sign up to request clarification or add additional context in comments.

Comments

0

It looks like alembic depends on python-dateutil. In your Requirements.txt make sure alembic comes after the dateutil entry and try pushing the app to heroku again.

2 Comments

I moved the python-dateutil above alembic and it produced the same error.
I had the same error. The reason is that heroku has python-dateutil==1.5.0 in the dependencies, which includes the deprecated syntax for python3.6

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.