Guy
Guy

Reputation: 13296

pip: to sudo or not to sudo

I am trying to install pip and I am drowning in conflicting answers in StackOverflow (pls read remark at end for duplicated questions).

The instructions said to download get-pip.py and run it using phyton:

python get-pip.py

When I follow the instructions as is I get: enter image description here

When I use the --user option:

python get-pip.py --user

Other problem arises later and anyhow it is not endorsed:

The pip developers are considering making --user the default for all installs, including get-pip.py installs of pip, but at this time, --user installs for pip itself, should not be considered to be fully tested or endorsed. For discussion, see Issue 1668.

So I go the sudo way:

sudo python get-pip.py

It is successful but with a warning: enter image description here

So I use the -H flag after deleting the previous installation:

sudo -H python get-pip.py

Everything seems fine and I have access to pip:

enter image description here

And then I try to install the virualenv package:

pip install --upgrade virtualenv

And get a permission denied error:

IOError: [Errno 13] Permission denied: '/Library/Python/2.7/site-packages/virtualenv.py'

As several answers in StackOverflow discourages the use of sudo when installing pip packages I am stuck here. How to proceed?

-- Please don't mark as duplicate as so many questions in StackOverflow have conflicting answers and none, from the dozen or so I read, seems to direct to how to solve this issue.

Upvotes: 3

Views: 2082

Answers (1)

Guy
Guy

Reputation: 13296

As said by @Bakuriu in the comments: The quotes I provided say that installing pip itself with --user is not officially supported, but installing other packages is 100% fine!. So just use the --user option for virtualenv.

Upvotes: 2

Related Questions