82๐
First make sure you have checked the most voted answer.
Iโm not sure if itโs exactly your problem, but in my case, I wasnโt able to upgrade Django to 1.2.4 โ I was always finishing with 1.2.3 version, so I uninstalled Django with:
<virtualenv>/bin/pip uninstall Django
Then I removed <virtualenv>/build/Django
directory and finally I installed the proper version with:
<virtualenv>/bin/pip install Django
1643๐
I ran the following command and it upgraded from 1.2.3 to 1.4.0
pip install Django --upgrade
Shortcut for upgrade:
pip install Django -U
Note: if the package you are upgrading has any requirements this command will additionally upgrade all the requirements to the latest versions available. In recent versions of pip, you can prevent this behavior by specifying --upgrade-strategy only-if-needed
. With that flag, dependencies will not be upgraded unless the installed versions of the dependent packages no longer satisfy the requirements of the upgraded package.
- [Django]-Running Django with FastCGI or with mod_python
- [Django]-Django 1.5 custom User model error. "Manager isn't available; User has been swapped"
- [Django]-Django south migration โ Adding FULLTEXT indexes
80๐
According to pip documentation example 3:
pip install --upgrade django
But based on my experience, using this method will also upgrade any package related to it. Example:
Assume you want to upgrade somepackage
that require Django >= 1.2.4
using this kind of method it will also upgrade somepackage
and django
to the newest update. Just to be safe, do:
# Assume you want to keep Django 1.2.4
pip install --upgrade somepackage django==1.2.4
Doing this will upgrade somepackage
and keeping Django to the 1.2.4 version.
- [Django]-Django-allauth: Linking multiple social accounts to a single user
- [Django]-Django: show the count of related objects in admin list_display
- [Django]-Django custom management commands: AttributeError: 'module' object has no attribute 'Command'
42๐
The shortcut command for --upgrade
:
pip install Django --upgrade
Is:
pip install Django -U
- [Django]-Pagination in Django-Rest-Framework using API-View
- [Django]-New url format in Django 1.9
- [Django]-Images from ImageField in Django don't load in template
29๐
If you only want to upgrade one specific package called somepackage
, the command you should use in recent versions of pip is
pip install --upgrade --upgrade-strategy only-if-needed somepackage
This is very useful when you develop an application in Django that currently will only work with a specific version of Django (say Django=1.9.x) and want to upgrade some dependent package with a bug-fix/new feature and the upgraded package depends on Django (but it works with, say, any version of Django after 1.5).
The default behavior of pip install --upgrade django-some-package
would be to upgrade Django to the latest version available which could otherwise break your application, though with the --upgrade-strategy only-if-needed
dependent packages will now only be upgraded as necessary.
- [Django]-How to change empty_label for modelForm choice field?
- [Django]-Django CMS fails to synch db or migrate
- [Django]-Celery missed heartbeat (on_node_lost)
18๐
If you upgrade a package, the old one will be uninstalled.
A convenient way to do this is to use this pip-upgrader which also updates the versions in your requirements.txt
file for the chosen packages (or all packages).
Installation
pip install pip-upgrader
Usage
Activate your virtualenv (important, because it will also install the new versions of upgraded packages in current virtualenv).
cd
into your project directory, and then run:
pip-upgrade
Advanced usage
If the requirements are placed in a non-standard location, send them as arguments:
pip-upgrade path/to/requirements.txt
If you already know what package you want to upgrade, simply send them as arguments:
pip-upgrade -p django -p celery -p dateutil
If you need to upgrade to pre-release / post-release version, add --prerelease
argument to your command.
Full disclosure: I wrote this package.
- [Django]-Django-Forms with json fields
- [Django]-Django aggregate or annotate
- [Django]-Is this the right way to do dependency injection in Django?
15๐
This solved the issue for me:
pip install -I --upgrade psutil --force
Afterwards just uninstall psutil with the new version and hop you can suddenly install the older version (:
- [Django]-Why there are two process when i run python manage.py runserver
- [Django]-How to change User representation in Django Admin when used as Foreign Key?
- [Django]-How to run celery as a daemon in production?
8๐
Defining a specific version to upgrade helped me instead of only the upgrade command.
pip3 install larapy-installer==0.4.01 -U
- [Django]-Django migration fails with "__fake__.DoesNotExist: Permission matching query does not exist."
- [Django]-Pulling data to the template from an external database with django
- [Django]-Django Template Language: Using a for loop with else
4๐
Normally, pip will clean up after itself and remove the contents of the build directory. The only time it doesnโt do this is if:
- You used the
--no-install
option - You are using editable packages
- The installation was cancelled or was otherwise interrupted.
In all other cases, you shouldnโt have build
directory thatโs clogging your environment.
- [Django]-Remove pk field from django serialized objects
- [Django]-Storing an Integer Array in a Django Database
- [Django]-Django get objects not referenced by foreign key
2๐
to upgrade your package
pip install --upgrade YOUR_PACKAGE_NAME==VERSION
from requirement file
pip install --upgrade -r requiremnet.txt
- [Django]-Django Rest Framework custom response message
- [Django]-Django models: default value for column
- [Django]-Why is factory_boy superior to using the ORM directly in tests?
- [Django]-Django admin default filter
- [Django]-How to resize an ImageField image before saving it in python Django model
- [Django]-How to tell if a task has already been queued in django-celery?