pip installでpermission deniedが出てsudoや–userでも上手く行かない

pip installした時にpermission deniedが起きた。


pip install hogehoge --user

が、またpermission denied.


sudo pip install hogehoge


そこで、rootのホームディレクトリを-Hフラグで上書きしてみた所、pip installも現在のユーザーでのimportも上手く出来た。

-H, --set-home

Request that the security policy set the HOME environment variable to the home directory specified by the target user’s password database entry. Depending on the policy, this may be the default behavior.

sudo -H pip install hogehoge


Permission denied errors when pip install package · Issue #4667 · kubeflow/kubeflow
Steps to reproduce: Perform fresh installation of kubeflow v0.7.1 in the GCP with IAM Launched new notebook service On the home Jupyter page: New -> Terminal pi...
What is the -H flag for 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 directo...