[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:
http://igotgenes.blogspot.co.uk/2010/01/interactive-sandboxes-using-ipyt
hon.html
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
(Intel)]
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
details.
%guiref -> A brief reference about the graphical user
interface.
------------------------------------------------------------------------
---
ImportError Traceback (most recent
call last)
...\ipython-0.12.1-py2.7.egg\IPython\zmq\ipkernel.pyc in
init_kernel(self)
592 if self.pylab:
593 try:
--> 594 gui, backend =
pylabtools.find_gui_and_backend(self.pylab)
595 shell.enable_pylab(gui,
import_all=self.pylab_import_all)
596 except Exception:
...\ipython-0.12.1-py2.7.egg\IPython\core\pylabtools.pyc in
find_gui_and_backend(gui)
194 """
195
--> 196 import matplotlib
197
198 if gui and gui != 'auto':
ImportError: No module named matplotlib
Error initializing pylab, pylab mode will not be active
VIRTUAL_ENV ->
d:\Dev\python\venv\veiv_img_proc\Lib\site-packages
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,
Adam
-------------- 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