Upgrading Python pip

I’m wondering if there is a way to upgrade pip. I understand Morpheus creates virtual environment dynamically every time a task gets run, and for some reason pip version is always 9.0.1.

The task is using PYTHON PATH: /usr/bin/python3, and pip version is 21.3.1.

Thank you.

I imagine you’re running on CentOS/RHEL 7.9. pip 9.0.1 is what got shipped with python-virtualenv-15.1.0-7.el7_9.noarch. That version gets installed by default on every virtualenv that is created. There’s currently no way in a Morpheus python task to override anything to do with pip or virtualenv, save for the python binary that gets used.

A bit of a hacky workaround is to point /bin/virtualenv to a new one. I tested this in my lab, and it worked with both python2 and 3.6. The bad news is that even python 3.6 has been out of security support for almost 2 years now.

I just installed python36-virtualenv and copied /bin/virtualenv-3 onto /bin/virtualenv. This is easily undone as /bin/virtualenv-2 was the original.

You could potentially use this method to install whatever virtualenv you wanted and point /bin/virtualenv to that.