Error With Installing Virtualenv With Pip and Homebrew

10,159

Solution 1

Ok! I managed to fix this myself.

I deleted all the virtualenv related things from /usr/local/bin (they had been installed under root for some reason and this was causing my permission issues.).

Then I did a pip uninstall virtualenv to get rid of other instances of virtualenv, as there was still one in /usr/local/lib/python2.7/site-packages/

Then a simple pip install virtualenv and things work fine now!

Solution 2

Most likely HomeBrew does some magic so that running brew install allows writing to /usr/local/bin, but this privilege is not available to normal commands. This is a guess, I didn't investigate this further.

Install virtualenv with brew:

 brew install pyenv-virtualenv
Share:
10,159
DorkRawk
Author by

DorkRawk

I write code, draw comics, and make music.

Updated on June 04, 2022

Comments

  • DorkRawk
    DorkRawk almost 2 years

    I am trying to get a nice clean Python environment setup on OSX 10.9. I've installed Python with Homebrew and set my PATH variables so...

    > which python
    /usr/local/bin/python
    

    and

    > which pip
    /usr/local/bin/pip
    

    so when I look at my /usr/local/bin :

    pip -> ../Cellar/python/2.7.6/bin/pip
    python -> ../Cellar/python/2.7.6/bin/python
    

    then when I run:

    > pip install virtualenv
    

    I get permission errors on /usr/local/bin/virtualenv:

    ...
    running install_scripts
    
    Installing virtualenv script to /usr/local/bin
    
    error: /usr/local/bin/virtualenv: Permission denied
    

    I thought that by using Homebrew I could use pip and avoid using sudo to install virtualenv. Am I doing something wrong here?