Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What is the -H flag for pip?

Tags:

python

pip

When using sudo pip install ... with pip version 6.0.4 or greater, I get some warnings like:

The directory '/home/drevicko/.cache/pip/log' or its parent directory is not owned by the current user and the debug log has been disabled. Please check the permissions and owner of that directory. If executing pip with sudo, you may want the -H flag.

This warning appears to have been added in 6.0.4, but the -H flag doesn't appear in the pip install docs nor in the docs on pip's general options.

So, what is the -H flag and why do I need it when using sudo pip install ...?

like image 556
drevicko Avatar asked Feb 20 '15 00:02

drevicko


People also ask

What is flag in pip?

The --user flag to pip install tells Pip to install packages in some specific directories within your home directory. This is a good way to have your own default Python environment that adds to the packages within your system directories, and therefore, does not affect the system Python installation.

What is the E flag for pip install?

In case you run into problems with pip install or with changing version, here are some tips: The -e flag (“editable”) results in the the source code remaining in the directory $CLAW , which includes all the Fortran packages as well as Python source.

What is exclamation before pip?

It means run it as a shell command rather than a notebook command.

What is the command for pip?

For the full list of pip options, simply run pip --help in your terminal and the command will return the usage information. Usage:pip <command> [options]Commands: install Install packages.


1 Answers

The -H flag is actually for the sudo command and not for pip. As taken from the docs

The -H (HOME) option requests that the security policy set the HOME environment variable to the home directory of the target user (root by default) as specified by the password database. Depending on the policy, this may be the default behavior.

A look at this question might provide more insight into what could be happening.

like image 55
Paul Thompson Avatar answered Sep 19 '22 06:09

Paul Thompson