How to suppress pip upgrade warning?

or just use the command line flag

pip --disable-pip-version-check [normal stuff here]

There are many options (2021 update)...

Use a command line flag

pip <command> --disable-pip-version-check [options]

Configure pip from the command line

pip config set global.disable-pip-version-check true

Set an environment variable

export PIP_DISABLE_PIP_VERSION_CHECK=1

Use a config file

Create a pip configuration file and set disable-pip-version-check to true

[global]
disable-pip-version-check = True

On many linux the default location for the pip configuration file is $HOME/.config/pip/pip.conf. Locations for Windows, macOS, and virtualenvs are too various to detail here. Refer to the docs:

https://pip.pypa.io/en/stable/user_guide/#config-file


Just adding to @sorin's answer

inside Dockerfile add these 2 lines to disable both pip version check and cache.

FROM python:3.6.10

ARG PIP_DISABLE_PIP_VERSION_CHECK=1
ARG PIP_NO_CACHE_DIR=1

RUN pip3 install -r requirements.txt
# ...

Another less intrusive and not directly documented but fully support way to disable the version check is to define:

export PIP_DISABLE_PIP_VERSION_CHECK=1

Tags:

Python

Pip