Skip to content

Instantly share code, notes, and snippets.

@bast
Last active August 29, 2015 14:05
Show Gist options
  • Save bast/548e6d7f28519e3425e3 to your computer and use it in GitHub Desktop.
Save bast/548e6d7f28519e3425e3 to your computer and use it in GitHub Desktop.
How to build ipython into venv out of almost nothing.
# Copyright (c) 2015 Radovan Bast
# Licensed under the MIT license - http://opensource.org/licenses/MIT
#------------------------------------------------------------------------------
# step 1: bootstrap a venv out of almost nothing
#------------------------------------------------------------------------------
# temporary directory, will be erased after we are done
TEMP_DIR=`mktemp -d`
# final venv directory
VENV_DIR=~/venv
# normally nothing to edit below except perhaps versions
export PYTHONPATH=$TEMP_DIR/local/lib/python2.7/site-packages/:$PYTHONPATH
export PATH=$TEMP_DIR/local/bin:$PATH
module add python
cd $TEMP_DIR
wget --no-check-certificate https://pypi.python.org/packages/source/s/setuptools/setuptools-5.7.tar.gz#md5=81f980854a239d60d074d6ba052e21ed
tar xvzf setuptools-5.7.tar.gz
cd setuptools-5.7/
mkdir -p $TEMP_DIR/local/lib/python2.7/site-packages/
python setup.py install --prefix=$TEMP_DIR/local
easy_install --prefix=$TEMP_DIR/local virtualenv
virtualenv $VENV_DIR
cd ~
# clean up
# rm -rf $TEMP_DIR
#------------------------------------------------------------------------------
# step 2: now log out, log in again, and install ipython
#------------------------------------------------------------------------------
source ~/venv/bin/activate
module add python
easy_install ipython
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment