If you run ipython directly on the commandline without having it installed inside the virtualenv you are working on you may get some awkward behaviour since iPython will be running a mix of environments (system wide + virtualenv) … normally you would see an warning as follows
1 2 3 4 5 6 7 8 9 10 11 12 |
WARNING: Attempting to work in a virtualenv. If you encounter problems, please install IPython inside the virtualenv. Python 2.7.3 (default, Jan 2 2013, 13:56:14) Type "copyright", "credits" or "license" for more information. IPython 0.13.2 -- An enhanced Interactive Python. ? -> Introduction and overview of IPython's features. %quickref -> Quick reference. help -> Python's own help system. object? -> Details about 'object', use 'object??' for extra details. In [1]: |
To avoid this I use an alias that makes sure iPython is loaded from inside the venv … here it is:
1 |
alias ipy="python -c 'import IPython; IPython.frontend.terminal.ipapp.launch_new_instance()'" |
Edit: as of ipython 1.0 this is the new alias
1 |
alias ipy="python -c 'import IPython; IPython.terminal.ipapp.launch_new_instance()'" |
now running ipy I will know for sure that I am running within the venv.