Installing PIP & Virutalenv in “sudo” free way

Recently, I needed to install a python native module in my build environment.  My build environment had python made available by auto mounting an NFS python installation. As this mount is shared with many users, I only have read-access to it.

Instead of polluting the build environment, I wanted a clean way to install this python module. Obviously, virtualenv is the right way to go, but unfortunately, the shared python installation didn’t have any of virtualenv, pip, setuptools  pre-installed.

So, after googling a bit and looking at the documentation of pip, setuptools and this excellent stackoverflow link,  here is the solution I came up with:

  • Install setuptools first into user local

$wget https://bitbucket.org/pypa/setuptools/raw/bootstrap/ez_setup.py
$python ez_setup.py –user

  • Install setuptools first into user local

$curl -O https://raw.github.com/pypa/pip/master/contrib/get-pip.py

$python get-pip.py –user

That should have installed both setuptools and pip into user home directory (~/.local on linux). Put the ~/.local/bin directory on the path and move to next step

  • Install virtualenv into user local

$pip install –user virtualenv

 

That’s it. Now you have pip and virtualenv installed into user local directory without modifying global python installation. 

One thought on “Installing PIP & Virutalenv in “sudo” free way

  1. Pingback: Installing pip on OS X without sudo | Organized systems

Leave a comment