Search code examples
djangovirtualenvpip

How can I upgrade specific packages using pip and a requirements file?


I'm using pip with a requirements file, in a virtualenv, for my Django projects. I'm trying to upgrade some packages, notably Django itself, and I'm getting an error about source code conflicts:

Source in <virtualenv>/build/Django has version 1.2.3 that conflicts with Django==1.2.4 (from -r requirements/apps.txt (line 3))

That's after updating the version number of Django from 1.2.3 to 1.2.4 in my requirements file. I'm using this command to actually do the upgrade:

pip --install --upgrade -E `<virtualenv dir`> --requirement `<requirements file`>

I can't find any flag that triggers a total package re-download. I even tried running an uninstall command first, and then the install, but no dice. Am I missing something?


Solution

  • 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