Python threading vs multiprocessing package

1. Threading package actually slows down your system because of GIL
2. Multithreading packages make use of processes and can have the expected speed gain
If you want to pass global dictionary, use Manager.dict()

403 forbidden permission denied (publickey) error etc when pushing files to Github fix.

Tried to push a project onto github and faced sooooooo much annoying errors.
1. Use ssh instead of https
ssh-keygen -t rsa -C ""
2. Press enter all the way until the end.
3. Vi into your public key usually at ~/.ssh/
4. copy all text from public key and put it into your github account settings–ssh keys.
5. push using ssh you should be all set and you should not see any of the errors again.

Install new version of python and set up virtualenvwrapper under your user account (e.g. you don’t have admin rights)

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
tar -zxvf Python-2.7.10.tgz
cd Python-2.7.10

./configure -prefix=/home/USER_NAME/.localpython
make install

Install virtualenv

cd ~/src
tar -zxvf virtualenv-13.1.2.tar.gz
cd virtualenv-13.1.2
~/.localpython/bin/python install

install per

cd ~/src
tar -zxvf pbr-1.8.1.tar.gz
cd pbr-1.8.1
~/.localpython/bin/python install


install virtualenvwrapper

cd ~/src
tar -zxvf virtualenvwrapper-4.7.1.tar.gz
cd virtualenvwrapper-4.7.1
~/.localpython/bin/python install

install stevedore (dependency for virtualenvwrapper

cd ~/src
tar -zxvf stevedore-1.9.0.tar.gz
cd stevedore-1.9.0
~/.localpython/bin/python 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/

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.