How to upgrade all the packages in your Django application in one fell swoop

Thursday, January 30, 2025 at 11:11 PM | 4 min read

Last modified on Wednesday, May 27, 2026 at 9:29 PM

#fullstack development, #macOS, #django, #python3, #pip, #dependency conflicts, #package upgrade

Packaged gifts

Photo by Wijdan Mq on unsplash.com

Table of Contents

How to upgrade all the packages in your Django application in one fell swoop

I was just working on a Django application, and one of my djLint dependencies was not up to date. It resulted in the following error when I ran the pip install -r requirements.txt command:

ERROR: pip's dependency resolver does not currently take into account all the packages that are installed. This behaviour is the source of the following dependency conflicts. djlint 1.36.4 requires click>=8.0.1, but you have click 7.1.2 which is incompatible. djlint 1.36.4 requires pyyaml>=6, but you have pyyaml 5.3.1 which is incompatible. djlint 1.36.4 requires tqdm>=4.62.2, but you have tqdm 4.47.0 which is incompatible. sphinx 8.1.3 requires Jinja2>=3.1, but you have jinja2 2.11.2 which is incompatible.

I ran the command pip install --upgrade -r requirements.txt to find out what version upgrade I needed for the click package. The following was returned in Terminal:

ERROR: Cannot install -r requirements.txt (line 3), click==7.1.2 and djlint==1.36.4 because these package versions have conflicting dependencies. The conflict is caused by: The user requested click==7.1.2 djlint 1.36.4 depends on click>=8.0.1 The user requested click==7.1.2 djlint 1.36.4 depends on click>=8.0.1 To fix this you could try to: 1. loosen the range of package versions you've specified 2. remove package versions to allow pip to attempt to solve the dependency conflict ERROR: ResolutionImpossible: for help visit https://pip.pypa.io/en/latest/topics/dependency-resolution/#dealing-with-dependency-conflicts

I replaced 7.1.2 with 8.0.1 in requirements.txt. I could have upgraded to the latest version of click by running the following:

pip install --upgrade click

This time, the following version was installed:

Requirement already satisfied: click in /Users/mariacam/.pyenv/versions/3.13.0/lib/python3.13/site-packages (8.0.1) Collecting click Using cached click-8.1.8-py3-none-any.whl.metadata (2.3 kB) Using cached click-8.1.8-py3-none-any.whl (98 kB) Installing collected packages: click Attempting uninstall: click Found existing installation: click 8.0.1 Uninstalling click-8.0.1: Successfully uninstalled click-8.0.1 Successfully installed click-8.1.8

I replaced "8.0.1" with "8.1.8". Then I ran pip install --upgrade -r requirements.txt again.

After I had fixed the click issue, and ran pip install --upgrade -r requirements.txt, the following was returned:

ERROR: Cannot install -r requirements.txt (line 3), PyYAML==5.3.1 and djlint==1.36.4 because these package versions have conflicting dependencies. The conflict is caused by: The user requested PyYAML==5.3.1 djlint 1.36.4 depends on pyyaml>=6 The user requested PyYAML==5.3.1 djlint 1.36.4 depends on pyyaml>=6 To fix this you could try to: 1. loosen the range of package versions you've specified 2. remove package versions to allow pip to attempt to solve the dependency conflict ERROR: ResolutionImpossible: for help visit https://pip.pypa.io/en/latest/topics/dependency-resolution/#dealing-with-dependency-conflicts

Again, I upgraded PYAML by running pip install --upgrade PyYAML, and the following was returned:

Requirement already satisfied: PyYAML in /Users/mariacam/.pyenv/versions/3.13.0/lib/python3.13/site-packages (6.0.2)

I replaced "5.3.1" with "6.0.2" in requirements.txt, and then ran pip install --upgrade -r requirements.txt again. The following was returned:

ERROR: Cannot install -r requirements.txt (line 3), djlint==1.36.4 and tqdm==4.47.0 because these package versions have conflicting dependencies. The conflict is caused by: The user requested tqdm==4.47.0 djlint 1.36.4 depends on tqdm>=4.62.2 The user requested tqdm==4.47.0 djlint 1.36.4 depends on tqdm>=4.62.2 To fix this you could try to: 1. loosen the range of package versions you've specified 2. remove package versions to allow pip to attempt to solve the dependency conflict ERROR: ResolutionImpossible: for help visit https://pip.pypa.io/en/latest/topics/dependency-resolution/#dealing-with-dependency-conflicts

I upgraded tqdm by running pip install --upgrade tqdm, and the following was returned:

Requirement already satisfied: tqdm in /Users/mariacam/.pyenv/versions/3.13.0/lib/python3.13/site-packages (4.67.1)

I replaced "4.62.2" with "4.67.1" in requirements.txt, and ran pip install --upgrade -r requirements.txt again. This time no version conflicts were returned:

Collecting click==8.1.8 (from -r requirements.txt (line 1)) Using cached click-8.1.8-py3-none-any.whl.metadata (2.3 kB) Requirement already satisfied: django==5.1.5 in /Users/mariacam/.local/lib/python3.13/site-packages (from -r requirements.txt (line 2)) (5.1.5) Requirement already satisfied: djlint==1.36.4 in /Users/mariacam/.pyenv/versions/3.13.0/lib/python3.13/site-packages (from -r requirements.txt (line 3)) (1.36.4) Requirement already satisfied: future==0.18.2 in /Users/mariacam/.pyenv/versions/3.13.0/lib/python3.13/site-packages (from -r requirements.txt (line 4)) (0.18.2) Requirement already satisfied: Jinja2==2.11.2 in /Users/mariacam/.pyenv/versions/3.13.0/lib/python3.13/site-packages (from -r requirements.txt (line 5)) (2.11.2) Requirement already satisfied: joblib==0.15.1 in /Users/mariacam/.pyenv/versions/3.13.0/lib/python3.13/site-packages (from -r requirements.txt (line 6)) (0.15.1) Requirement already satisfied: livereload==2.6.2 in /Users/mariacam/.pyenv/versions/3.13.0/lib/python3.13/site-packages (from -r requirements.txt (line 7)) (2.6.2) Requirement already satisfied: lunr==0.5.8 in /Users/mariacam/.pyenv/versions/3.13.0/lib/python3.13/site-packages (from -r requirements.txt (line 8)) (0.5.8) Requirement already satisfied: Markdown==3.2.2 in /Users/mariacam/.pyenv/versions/3.13.0/lib/python3.13/site-packages (from -r requirements.txt (line 9)) (3.2.2) Requirement already satisfied: MarkupSafe==1.1.1 in /Users/mariacam/.pyenv/versions/3.13.0/lib/python3.13/site-packages (from -r requirements.txt (line 10)) (1.1.1) Requirement already satisfied: mkdocs==1.1.2 in /Users/mariacam/.pyenv/versions/3.13.0/lib/python3.13/site-packages (from -r requirements.txt (line 11)) (1.1.2) Requirement already satisfied: nltk==3.5 in /Users/mariacam/.pyenv/versions/3.13.0/lib/python3.13/site-packages (from -r requirements.txt (line 12)) (3.5) Requirement already satisfied: PyYAML==6.0.2 in /Users/mariacam/.pyenv/versions/3.13.0/lib/python3.13/site-packages (from -r requirements.txt (line 13)) (6.0.2) Requirement already satisfied: six==1.15.0 in /Users/mariacam/.pyenv/versions/3.13.0/lib/python3.13/site-packages (from -r requirements.txt (line 14)) (1.15.0) Requirement already satisfied: tornado==6.0.4 in /Users/mariacam/.pyenv/versions/3.13.0/lib/python3.13/site-packages (from -r requirements.txt (line 15)) (6.0.4) Requirement already satisfied: tqdm==4.67.1 in /Users/mariacam/.pyenv/versions/3.13.0/lib/python3.13/site-packages (from -r requirements.txt (line 16)) (4.67.1) Requirement already satisfied: asgiref<4,>=3.8.1 in /Users/mariacam/.pyenv/versions/3.13.0/lib/python3.13/site-packages (from django==5.1.5->-r requirements.txt (line 2)) (3.8.1) Requirement already satisfied: sqlparse>=0.3.1 in /Users/mariacam/.pyenv/versions/3.13.0/lib/python3.13/site-packages (from django==5.1.5->-r requirements.txt (line 2)) (0.5.3) Requirement already satisfied: colorama>=0.4.4 in /Users/mariacam/.pyenv/versions/3.13.0/lib/python3.13/site-packages (from djlint==1.36.4->-r requirements.txt (line 3)) (0.4.6) Requirement already satisfied: cssbeautifier>=1.14.4 in /Users/mariacam/.pyenv/versions/3.13.0/lib/python3.13/site-packages (from djlint==1.36.4->-r requirements.txt (line 3)) (1.15.1) Requirement already satisfied: jsbeautifier>=1.14.4 in /Users/mariacam/.pyenv/versions/3.13.0/lib/python3.13/site-packages (from djlint==1.36.4->-r requirements.txt (line 3)) (1.15.1) Requirement already satisfied: json5>=0.9.11 in /Users/mariacam/.pyenv/versions/3.13.0/lib/python3.13/site-packages (from djlint==1.36.4->-r requirements.txt (line 3)) (0.10.0) Requirement already satisfied: pathspec>=0.12 in /Users/mariacam/.pyenv/versions/3.13.0/lib/python3.13/site-packages (from djlint==1.36.4->-r requirements.txt (line 3)) (0.12.1) Requirement already satisfied: regex>=2023 in /Users/mariacam/.pyenv/versions/3.13.0/lib/python3.13/site-packages (from djlint==1.36.4->-r requirements.txt (line 3)) (2024.11.6) Requirement already satisfied: editorconfig>=0.12.2 in /Users/mariacam/.pyenv/versions/3.13.0/lib/python3.13/site-packages (from cssbeautifier>=1.14.4->djlint==1.36.4->-r requirements.txt (line 3)) (0.17.0) Using cached click-8.1.8-py3-none-any.whl (98 kB) Installing collected packages: click Attempting uninstall: click Found existing installation: click 8.0.1 Uninstalling click-8.0.1: Successfully uninstalled click-8.0.1 Successfully installed click-8.1.8

Conclusion

I technically was not able to upgrade all packages in my requirements.txt file in "one fell swoop" (it is not possible), but I did get the information I needed in "one fell swoop at a time". The pip install --upgrade -r requirements.txt command informed me what dependency conflicts existed in my requirements.txt file by returning an ERROR: ResolutionImpossible error, and the pip install --upgrade <packagename> command updated an individual package to its latest version.