Pip install -r requirements.txt error: externally-managed-environment

Hi All, I am trying to create CICD pipe line for a python application and the jenkins build is failing with this error… How do I resolve it?

Thanks
Asha

If you’re using Jenkins with a recent version of Ubuntu, then you directly use pip to globally install python packages – python is not installed in such a way that it will work. You need to install python packages in one of two ways:

  1. You can create a virtual environment, and then use the pip from the venv; this will work fine.
  2. You can install python packages using APT to install them globally, but not pip.