Issue
I created a virtual environment using this command:
/usr/bin/python2.7 -m virtualenv venv
It mostly works, but using venv/bin/pip2.7
prints the following warning:
DEPRECATION: Python 2.7 reached the end of its life on January 1st, 2020. Please upgrade your Python as Python 2.7 is no longer maintained. pip 21.0 will drop support for Python 2.7 in January 2021. More details about Python 2 support in pip can be found at https://pip.pypa.io/en/latest/development/release-process/#python-2-support pip 21.0 will remove support for this functionality.
regardless of the command options, in both Ubuntu16 and Ubuntu20.
Including the above warning in a product is unacceptable and can only lead to confusion. (The warning is factually incorrect because Ubuntu20 supports Python 2.7 and pip2.7
through at least 2030. As with all popular programming languages, Python 2.7 is likely to be supported far into the future, until a newer compatible language comes along to supercede it.)
How do I disable the warning?
Update
It appears that this is a bug in pip versions 19+. How do I tell virtualenv
to install pip 18?
Solution
This installs pip 18.1
in a Python 2.7 environment without printing any warnings:
/usr/bin/python2.7 -m virtualenv --no-pip venv
git clone https://github.com/pypa/pip.git pip
(cd pip ; git checkout -b 18.1 18.1)
(cd pip ; ../venv/bin/python setup.py install)
venv/bin/pip list
Answered By - personal_cloud Answer Checked By - Timothy Miller (WPSolving Admin)