I ran into a problem today trying to install python libraries on server which I don’t have admin rights. Not happy but got a solution around. This way its easier to maintain the environment myself. Hopefully someone can make a software that manages software environment in user space on linux.
Install python 2.7.10 under your user/.localpython
Replace the USER_NAME with your own username.
mkdir ~/src
mkdir ~/.localpython
cd ~/src
wget https://www.python.org/ftp/python/2.7.10/Python-2.7.10.tgz
tar -zxvf Python-2.7.10.tgz
cd Python-2.7.10
./configure -prefix=/home/USER_NAME/.localpython
make
make install
Install virtualenv
cd ~/src
wget https://pypi.python.org/packages/source/v/virtualenv/virtualenv-13.1.2.tar.gz#md5=b989598f068d64b32dead530eb25589a
tar -zxvf virtualenv-13.1.2.tar.gz
cd virtualenv-13.1.2
~/.localpython/bin/python setup.py install
install per
cd ~/src
wget https://pypi.python.org/packages/source/p/pbr/pbr-1.8.1.tar.gz#md5=c8f9285e1a4ca6f9654c529b158baa3a
tar -zxvf pbr-1.8.1.tar.gz
cd pbr-1.8.1
~/.localpython/bin/python setup.py install
install virtualenvwrapper
cd ~/src
wget https://pypi.python.org/packages/source/v/virtualenvwrapper/virtualenvwrapper-4.7.1.tar.gz#md5=3789e0998818d9a8a4ec01cfe2a339b2
tar -zxvf virtualenvwrapper-4.7.1.tar.gz
cd virtualenvwrapper-4.7.1
~/.localpython/bin/python setup.py install
install stevedore (dependency for virtualenvwrapper
cd ~/src
wget https://pypi.python.org/packages/source/s/stevedore/stevedore-1.9.0.tar.gz#md5=53e2bc3b49dd9c920cfce7f63822b1a5
tar -zxvf stevedore-1.9.0.tar.gz
cd stevedore-1.9.0
~/.localpython/bin/python setup.py install
Now last step:
Edit your ~/.bashrc file so your python distribution is the one when you type which python
command. Add the following lines at the top.
export PATH="/home/USER_NAME/.localpython/bin:$PATH"
export WORKON_HOME=~/.virtualenvs
export PROJECT_HOME=~/Devel
source /home/USER_NAME/.localpython/bin/virtualenvwrapper.sh
exit your server and log in again. You should be good to go to make mkvirtualenv and do whatever you want.
The above guide is tested on my University cluster where python2.6 was installed however i don’t have control over custom libraries. I could use virtualenv though.