Activating virtual environment:

Go to the folder where your virtual environment is located, typically the root folder of your project, and type one of these two:

  • source venv/bin/activate on Unix/Linux-based systems
  • venv\Scripts\activate on Windows

This gives us the security that we are not working in the wrong virtualenv and mixing packets in the environment.

Forcing reinstall of the packages:

  • Upgrade can be done by adding: --upgrade or -U
  • Forcing reinstall of the packages can be done by adding: --force-reinstall

In your case (once the environment is activated):

python -m pip install -U --force-reinstall pack setuptools Django

Step by step instructions:

  1. Deactivate and delete the old virtual environment
  2. Create new environment using
    python -m virtualenv venv
    for python 2 or
    python -m venv venv

    for python 3.x. That’s the only point where you might want to use for example python3 or some absolute path instead. Later use the code as is.
  3. Activating the virtual environment
    source venv/bin/activate
  4. python -m pip install -U pip
    If you have issue with
    ImportError: No module named _internal
    than probably you are using an old version of pip.
    Do this:

    python -m pip install --upgrade pip
  5. python -m pip install -U --force-reinstall -r requirements.txt-U --force-reinstall
    is a bit of an overkill in case of fresh environment, but it will do no harm
  6. Go to the place where your manage.py is located and start the server using
    python manage.py runserver