Search code examples
pythonpip

python pip silent install


Is there a way to do a silent install with pip?

For some more background I'm using fabric to do server deployments and I want to be able to setup a new server or update an existing one without any interaction and some of the packages require a y/n response.


Solution

  • A silent install is possible by using the quiet (short: q) flag:

    pip install somepackage --quiet
    

    This hides installation messages. As per its documentation, note that this option is additive, and can be specified up to 3 times to remove messages of increasing levels of importance (warning, error, critical).

    Additionally, you may want to add an exists-action option for a default behaviour when multiple choices exist. Finally, if you're in a Linux/Unix-like OS, you may want to also force "always yes" using the yes command:

    yes | pip install somepackage -q -q -q --exists-action i
    

    where exists-action i stands for ignore, and 3 quiets hide every message.

    This truly has its mouth shut!