-1

When trying to sudo pip install ansible on mac OS 10.12 I get the error:

The directory '/Users/myuser/Library/Caches/pip/http' or its parent directory is not owned by the current user and the cache has been disabled. Please check the permissions and owner of that directory. If executing pip with sudo, you may want sudo's -H flag.

The directory '/Users/myuser/Library/Caches/pip' or its parent directory is not owned by the current user and caching wheels has been disabled. check the permissions and owner of that directory. If executing pip with sudo, you may want sudo's -H flag.

I checked the owner of the current and listed directories using ls -l and they are all the same. (The first ls is the parent directory of website where I am trying to run the install)

My-Mac:Artivest myuser$ ls -l
total 0
drwxr-xr-x   9 myuser  staff   306 Jul 23 11:12 developer_tools
drwxr-xr-x   2 myuser  staff    68 Jul 23 11:32 modules
drwxr-xr-x   3 myuser  staff   102 Jul 23 11:29 virtualbox-images
drwxr-xr-x  54 myuser  staff  1836 Jul 23 11:48 website
My-Mac:Artivest myuser$ cd /Users/myuser/Library/Caches/pip
My-Mac:pip myuser$ ls -l
total 8
drwx------  8 myuser  staff  272 Jul 23 12:20 http
-rw-r--r--  1 myuser  staff  113 Jul 23 11:00 selfcheck.json
My-Mac:pip myuser$ cd /Users/myuser/Library/Caches/pip/http
My-Mac:http myuser$ ls -l
total 0
drwx------  3 myuser  staff  102 Jul 23 12:20 1
drwx------  3 myuser  staff  102 Jul 23 11:00 9
drwx------  5 myuser  staff  170 Jul 23 12:20 a
drwx------  3 myuser  staff  102 Jul 23 11:00 b
drwx------  3 myuser  staff  102 Jul 23 12:20 e
drwx------  3 myuser  staff  102 Jul 23 11:00 f
My-Mac:http myuser$ 

How can I get past this error?

mhatch
  • 4,441
  • 6
  • 36
  • 62

1 Answers1

0

First I would suggest installing python using brew, then you could try:

$ pip install --upgrade --user ansible

This will install ansible within your $HOME if using python 3 it will be in /Library/Python/3.7/bin or if using python 2 in ~/Library/Python/2.7/bin

nbari
  • 25,603
  • 10
  • 76
  • 131