# Making Ipython Play Nice with Virtualenv

Warning: This is a very old post so comments may not be valid anymore

I have recently created a virtualenv based on the Enthought Python Distribution for some startup ideas I’d like to develop futher. Until now I’ve been using the standard virtualenv python executable from within Sublime Text 2 with not issues at all until yesterday when I was using Ipython and could not load a package I’ve using the whole week.

By default Ipython is not virtualenv aware and I thought that I will have to go through tears of pain to make ipython understand virtualenvs. - luckily I’ve found this post with a clear and simple explanation.

Furthermore, If you have Ipython 0.12.1 (not sure if earlier versions support this) then is even easier! All you need to do is to save the following piece of code in ~/.ipython/profile_default/startup/.

~/.ipython/profile_default/startup/ is the IPython startup directory.

.py and .ipy files in this directory will be run prior to any code or files specified via the exec_lines or exec_files configurables whenever you load this profile.

Files will be run in lexicographical order, so you can control the execution order of files with a prefix, e.g.

00-first.py
50-middle.py
99-last.ipy


I have saved mine as 00-virtualenv.py and now Ipython is able to look at my virtualenv packages:

Happy days are back again! Enjoy!!