[IPython-User] Pylab inline in windows virtualenv

Adam Davis addavis@fosterandpartners....
Tue Aug 7 03:29:15 CDT 2012

I am trying to invoke ipython as:

Ipython qtconsole --pylab=inline

>From within a virtual_env on Windows 7. Previously, I was having trouble
with IPython 'recognizing' the virtual_env -- it was starting from the
virtualenv's interpreter but not including the virtual_env's PYTHONPATH
directories in sys.path. I worked around this issue by including a
startup script in my IPython profile to append the appropriate
directories to IPython's sys.path, using a modified version of the
script shown here:


This worked well until I tried to use pylab inline. I have installed
matplotlib in the virtual_env, rather than the system's default site
directory. If I start IPython qtconsole without the --pylab=inline flag,
then I can do:

	In [1]: import matplotlib

	In [2]: matplotlib
	Out[2]: <module 'matplotlib' from ...>

However, when I try to use the --pylab=inline flag, it would seem the
path changing script isn't called until after the qtconsole has already
tried to import matplotlib:

	Python 2.7.2 (default, Jun 12 2011, 15:08:59) [MSC v.1500 32 bit
	Type "copyright", "credits" or "license" for more information.

	IPython 0.12.1 -- 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
	%guiref   -> A brief reference about the graphical user
	ImportError                               Traceback (most recent
call last)
	...\ipython-0.12.1-py2.7.egg\IPython\zmq\ipkernel.pyc in
	    592         if self.pylab:
	    593             try:
	--> 594                 gui, backend =
	    595                 shell.enable_pylab(gui,
	    596             except Exception:

	...\ipython-0.12.1-py2.7.egg\IPython\core\pylabtools.pyc in
	    194     """
	--> 196     import matplotlib
	    198     if gui and gui != 'auto':

	ImportError: No module named matplotlib
	Error initializing pylab, pylab mode will not be active

Can anyone suggest a better way to get IPython to work properly with
virtual_env on Windows, or a better way to invoke pylab with the
qtconsole back-end?

Thanks and regards,


-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.scipy.org/pipermail/ipython-user/attachments/20120807/8ac72211/attachment.html 

More information about the IPython-User mailing list