Home > OS >  Error when trying to deploy Django app to Heroku - Conflicting Dependencies
Error when trying to deploy Django app to Heroku - Conflicting Dependencies

Time:11-08

This is the error i get when trying to push, everything was working fine a week ago, I could deploy with no problems. Now when I try to deploy I always get this error beacuse I can't satisfy both python-dateutil==2.8 (needed by the app) and python-dateutl==1.5 (needed by heroku). No clue why this started happening. (Updated heroku globally but nothing changed). There is a wrapper Heroku3 but I can't seem to use it to deploy, when i install it in the env, heroku3 command doesn't exist and its not available on npm, so all I can do is write python code with it. Would really appreciate if someone knew how to resolve this problem.

git push heroku master
Enumerating objects: 401, done.
Counting objects: 100% (401/401), done.
Delta compression using up to 16 threads
Compressing objects: 100% (321/321), done.
Writing objects: 100% (386/386), 226.01 KiB | 4.43 MiB/s, done.
Total 386 (delta 39), reused 0 (delta 0), pack-reused 0
remote: Compressing source files... done.
remote: Building source:
remote: 
remote: -----> Building on the Heroku-20 stack
remote: -----> Using buildpack: heroku/python
remote: -----> Python app detected
remote: -----> No Python version was specified. Using the same version as the last build: python-3.9.7
remote:        To use a different version, see: https://devcenter.heroku.com/articles/python-runtimes
remote: -----> No change in requirements detected, installing from cache
remote: -----> Using cached install of python-3.9.7
remote: -----> Installing pip 21.3.1, setuptools 57.5.0 and wheel 0.37.0
remote: -----> Installing SQLite3
remote: -----> Installing requirements with pip
remote:        INFO: pip is looking at multiple versions of gunicorn to determine which version is compatible with other requirements. This could take a while.
remote:        Collecting gunicorn==20.1.0
remote:          Downloading gunicorn-20.1.0-py3-none-any.whl (79 kB)
remote:        INFO: pip is looking at multiple versions of django-storages to determine which version is compatible with other requirements. This could take a while.
remote:        Collecting django-storages==1.11.1
remote:          Downloading django_storages-1.11.1-py3-none-any.whl (42 kB)
remote:        INFO: pip is looking at multiple versions of django-heroku to determine which version is compatible with other requirements. This could take a while.
remote:        Collecting django-heroku==0.3.1
remote:          Downloading django_heroku-0.3.1-py2.py3-none-any.whl (6.2 kB)
remote:        INFO: pip is looking at multiple versions of django-crispy-forms to determine which version is compatible with other requirements. This could take a while.
remote:        Collecting django-crispy-forms==1.12.0
remote:          Downloading django_crispy_forms-1.12.0-py3-none-any.whl (122 kB)
remote:        INFO: pip is looking at multiple versions of django to determine which version is compatible with other requirements. This could take a while.
remote:        Collecting Django==3.2.7
remote:          Downloading Django-3.2.7-py3-none-any.whl (7.9 MB)
remote:        INFO: pip is looking at multiple versions of dj-database-url to determine which version is compatible with other requirements. This could take a while.
remote:        Collecting dj-database-url==0.5.0
remote:          Downloading dj_database_url-0.5.0-py2.py3-none-any.whl (5.5 kB)
remote:        INFO: pip is looking at multiple versions of charset-normalizer to determine which version is compatible with other requirements. This could take a while.
remote:        Collecting charset-normalizer==2.0.4
remote:          Downloading charset_normalizer-2.0.4-py3-none-any.whl (36 kB)
remote:        INFO: pip is looking at multiple versions of certifi to determine which version is compatible with other requirements. This could take a while.
remote:        Collecting certifi==2021.5.30
remote:          Downloading certifi-2021.5.30-py2.py3-none-any.whl (145 kB)
remote:        INFO: pip is looking at multiple versions of botocore to determine which version is compatible with other requirements. This could take a while.
remote:        Collecting botocore==1.21.39
remote:          Downloading botocore-1.21.39-py3-none-any.whl (7.9 MB)
remote:        INFO: pip is looking at multiple versions of <Python from Requires-Python> to determine which version is compatible with other requirements. This could take a while.       
remote:        INFO: pip is looking at multiple versions of boto3 to determine which version is compatible with other requirements. This could take a while.
remote:        Collecting boto3==1.18.39
remote:          Downloading boto3-1.18.39-py3-none-any.whl (131 kB)
remote:        INFO: pip is looking at multiple versions of beautifulsoup4 to determine which version is compatible with other requirements. This could take a while.
remote:        Collecting beautifulsoup4==4.9.3
remote:          Downloading beautifulsoup4-4.9.3-py3-none-any.whl (115 kB)
remote:        INFO: pip is looking at multiple versions of asgiref to determine which version is compatible with other requirements. This could take a while.
remote:        Collecting asgiref==3.4.1
remote:          Downloading asgiref-3.4.1-py3-none-any.whl (25 kB)
remote:        INFO: pip is looking at multiple versions of botocore to determine which version is compatible with other requirements. This could take a while.
remote:        ERROR: Cannot install -r /tmp/build_414b410f/requirements.txt (line 4), heroku==0.1.4 and python-dateutil==2.8.2 because these package versions have conflicting dependencies.
remote:
remote:        The conflict is caused by:
remote:            The user requested python-dateutil==2.8.2
remote:            botocore 1.21.39 depends on python-dateutil<3.0.0 and >=2.1
remote:
remote:        To fix this you could try to:
remote:        1. loosen the range of package versions you've specified
remote:        2. remove package versions to allow pip attempt to solve the dependency conflict
remote:
remote:        ERROR: ResolutionImpossible: for help visit https://pip.pypa.io/en/latest/user_guide/#fixing-conflicting-dependencies
remote:  !     Push rejected, failed to compile Python app.
remote:
remote:  !     Push failed
remote:  !
remote:  ! ## Warning - The same version of this code has already been built: 37f55b221f93a23b73486ebf55520365c1b5bcb8
remote:  !
remote:  ! We have detected that you have triggered a build from source code with version 37f55b221f93a23b73486ebf55520365c1b5bcb8
remote:  ! at least twice. One common cause of this behavior is attempting to deploy code from a different branch.
remote:  !
remote:  ! If you are developing on a branch and deploying via git you must run:
remote:  !
remote:  !     git push heroku <branchname>:main
remote:  !
remote:  ! This article goes into details on the behavior:
remote:  !   https://devcenter.heroku.com/articles/duplicate-build-version
remote:
remote: Verifying deploy...
remote:
remote: !       Push rejected to app.
remote:
To gitlink
 ! [remote rejected] master -> master (pre-receive hook declined)
error: failed to push some refs to 'gitlink'

When i do pip freeze I get this

asgiref==3.4.1
beautifulsoup4==4.9.3    
boto3==1.18.39
botocore==1.21.39        
certifi==2021.5.30       
charset-normalizer==2.0.4
click==8.0.1
colorama==0.4.4
dj-database-url==0.5.0   
Django==3.2.7
django-click==2.3.0      
django-crispy-forms==1.12.0
django-heroku==0.3.1
django-pg-copy==0.4.0
django-storages==1.11.1
gunicorn==20.1.0
heroku3==5.1.4
idna==3.2
jmespath==0.10.0
pep517==0.12.0
Pillow==8.3.2
postgres==3.0.0
postgres.client==0.4.6
psycopg2==2.9.1
psycopg2-binary==2.9.1
psycopg2-pool==1.1
PyOpenGL==3.1.5
python-dateutil==2.8.2
python-decouple==3.4
pytz==2021.1
requests==2.26.0
s3transfer==0.5.0
six==1.16.0
soupsieve==2.2.1
sqlparse==0.4.1
tomli==1.2.2
urllib3==1.26.6
whitenoise==5.3.0

CodePudding user response:

asgiref==3.4.1
beautifulsoup4==4.9.3   
python-dateutil 
boto3==1.18.39
botocore==1.21.39        
certifi==2021.5.30       
charset-normalizer==2.0.4
click==8.0.1
colorama==0.4.4
dj-database-url==0.5.0   
Django==3.2.7
django-click==2.3.0      
django-crispy-forms==1.12.0
django-heroku==0.3.1
django-pg-copy==0.4.0
django-storages==1.11.1
gunicorn==20.1.0
heroku3==5.1.4
idna==3.2
jmespath==0.10.0
pep517==0.12.0
Pillow==8.3.2
postgres==3.0.0
postgres.client==0.4.6
psycopg2==2.9.1
psycopg2-binary==2.9.1
psycopg2-pool==1.1
PyOpenGL==3.1.5
python-decouple==3.4
pytz==2021.1
requests==2.26.0
s3transfer==0.5.0
six==1.16.0
soupsieve==2.2.1
sqlparse==0.4.1
tomli==1.2.2
urllib3==1.26.6
whitenoise==5.3.0

unversion python-dateutil if not working visit https://pypi.org/project/python-dateutil/#history and do the following try many tries and every time deploy to heroku

  1. got requirements.txt and change to python-dateutil==2.5.1 if not working try lower version
  2. change Heroku version to be heroku3==3.1.0

CodePudding user response:

If everything is fine in the previous deployment, you can log in to Heroku https://dashboard.heroku.com/ & open the console of your application & get the currently installed libraries.

In case if you are not sure how to do it, Run console button will be available in more button on the right side top of your application. Then type bash & hit enter, bash console will be opened.

  • Related