[IPython-User] Standalone build of IPython

Paul Moore p.f.moore@gmail....
Fri Mar 22 10:39:36 CDT 2013


This probably isn't precisely news to anyone, but I hadn't really
thought much about it and was impressed to find that it worked. It is
possible to run console IPython "standalone", without needing to
install it into your Python environment. This is particularly useful
if you want to use IPython in multiple virtual environments.

The simplest way of setting this up is:

Create a new directory (say, IPy)
pip install --target IPy ipython

On Windows, you probably also want pyreadline. For Python 2, you can
just install it into IPy (untested). If you're using Python 3, as I
am, this is a bit messy as you need to pip install the version from
github (there's no released version that's Python 3 compatible :-().
You have to install it into the Python environment you're using to
build the standalone version (so that ipython sees its dependency is
satisfied) as well as into IPy (for runtime)

As a final tidy-up, go into IPy and copy IPython\__main__.py up one
level into the IPy directory (to make the IPy directory itself
runnable). Now you can run IPython simply by doing "python IPy". Or if
you prefer, cd into IPy, zip up the contents, and you have a
single-file runnable copy of IPython.

As far as I am aware, the resulting code will work on any version of
Python that is the same major version as you used to build it (i.e.,
you need an IPython2 and an IPython3) but you do *not* need separate
versions for each minor version, or each installation.

I hope this is of use to someone.

Paul.

PS I haven't tried to do this for more complex builds like the QT
console or the notebook. Because these use C extensions, you would
need a single version for each minor version, and you couldn't zip the
resulting build up, so the benefits are much less obvious.


More information about the IPython-User mailing list