Control the pip version in virtualenv Control the pip version in virtualenv python python

Control the pip version in virtualenv


From reading the source of virtualenv, it looks like pip is installed from a source tarfile included with virtualenv. In virtualenv 1.10.1, it is pip-1.4.1.tar.gz in the site-packages/virtualenv_support directory (it gets setuptools from the same place). You could feasibly replace that archive to control the version; virtualenv.py, at least the version I have, doesn't care which version of pip is there:

    if not no_pip:        install_sdist('Pip', 'pip-*.tar.gz', py_executable, search_dirs)

You could also pass the --no-pip option and then install the version you want from source.

In virtualenv 1.11, it looks for a wheel file (e.g. pip-*.whl) instead of a tar.gz, but other than that it acts the same way (thanks @wim for the update).


For me, I just upgraded pip/virtualenv/virtualenvwrapper on my machine (not inside the virtualenv). Subsequently created virtualenvs had the updated version.

deactivatepip install --upgrade pip virtualenv virtualenvwrappermkvirtualenv ...


You cannot downgrade pip using pip, the solution is to install a specific version in your virtual environment:

virtualenv env -p python3.6 --no-pipsource env/bin/activatecurl https://bootstrap.pypa.io/get-pip.py -o get-pip.pypython get-pip.py pip==18.1

This will allow you to keep using --process-dependency-links that was removed in pip 19.