How do I install an old version of Django on virtualenv?

PythonDjangoSetuptoolsVirtualenv

Python Problem Overview


I want to install some specific version of a package (in this case Django) inside the virtual environment. I can't figure it out.

I'm on Windows XP, and I created the virtual environment successfully, and I'm able to run it, but how am I supposed to install the Django version I want into it? I mean, I know to use the newly-created easy_install script, but how do I make it install Django 1.0.7? If I do easy_install django, it will install the latest version. I tried putting the version number 1.0.7 into this command in various ways, but nothing worked.

How do I do this?

Python Solutions


Solution 1 - Python

There was never a Django 1.0.7. The 1.0 series only went up to 1.0.4. You can see all the releases in the tags section of the Django code repository.

However to answer your question, don't use easy_install, use pip. (If it's not already installed, do easy_install pip, then never touch easy_install again). Now you can do:

pip install Django==1.0.4

Solution 2 - Python

+1 on the previous poster's reply: use pip if you can. But, in a pinch, the easiest way is to install an older version would be to download the tarball from the downloads page or, if you have subversion installed, do an svn export of the release you want (they are all tagged here).

Once you have the version of Django you want, just run the following command inside the django directory:

python setup.py install

This will install that version of Django in your virtualenv.

Solution 3 - Python

+1 for already mentioned solutions.

I just wanna add another solution.

To install a specific version of Django (say 1.10.x),

  1. Clone the Django repo from Github.

    git clone https://github.com/django/django.git

  2. Go into the directory and checkout to the specific branch.

    cd django

    git checkout origin/stable/1.10.x

  3. Run install command.

    python setup.py install

Solution 4 - Python

pip install "django>=2.2,<3" To install djnago 2.2

Solution 5 - Python

pip install django==(the desired version ex: 1.8.4)

This will allow you to install the desired version, and I tried on OS:Windows10 and it perfectly worked.

Attributions

All content for this solution is sourced from the original question on Stackoverflow.

The content on this page is licensed under the Attribution-ShareAlike 4.0 International (CC BY-SA 4.0) license.

Content TypeOriginal AuthorOriginal Content on Stackoverflow
QuestionRam RachumView Question on Stackoverflow
Solution 1 - PythonDaniel RosemanView Answer on Stackoverflow
Solution 2 - PythonmazelifeView Answer on Stackoverflow
Solution 3 - PythonTahir RazaView Answer on Stackoverflow
Solution 4 - PythonBartoszView Answer on Stackoverflow
Solution 5 - PythonR.SooraZView Answer on Stackoverflow