[IPython-dev] Qt console making great strides, please use it and let us know what works, what doesn't

Dave Hirschfeld dave.hirschfeld at gmail.com
Mon Apr 11 07:49:22 EDT 2011


Fernando Perez <fperez.net <at> gmail.com> writes:

> now that our codebase is starting to settle down into the shape the
> next release will look like, it would be great if we start getting
> more feedback.  In particular, Evan Patterson has done a great job of
> fine-tuning the Qt console so that it's a really useful tool for
> everyday work, and while we've tried to be much more disciplined about
> testing things now, the reality of GUI apps is that some things are
> very difficult to test short of humans using them.
> 
> So if you would like to start using it, and reporting what doesn't
> work either here or even better, on the bug tracker, that would be
> great.  Evan today just merged a change that fixes what in my eyes was
> one of the major usability issues left: when you moved out of a cell
> you had already edited, you lost your unexecuted changes.  This could
> be very annoying in practice, but now the console automatically
> remembers these changes.  I think with this issue fixed, it makes for
> a great environment to experiment and work in.  My favorite way to
> start it is with this alias:
> 
> alias iqlab='ipython-qtconsole --paging vsplit --pylab'
> 
> and sometimes I'll add "inline" if I want inline figures (I'm working
> on a patch to allow toggling of inline/floating figures at runtime,
> but it's not ready yet).
> 
> So use it, pound on it, let us know how it goes.  We'd like this to be
> really a production-ready tool when 0.11 goes out.
> 
> A big thanks to Evan for the great work he's done and being so
> responsive, as well as Mark and others who have pitched in with the Qt
> code.
> 
> And as always, a pull request is even better than a bug report!
> 
> Cheers,
> 
> f
> 

Thanks to everyone involved for all the hard work, I've been eagerly awaiting
the 0.11 release but thought I would try to help out on the feedback front by
jumping in early.

I'm currently running Python 2.6.5 (r265:79096, Mar 19 2010, 21:48:26) [MSC
v.1500 32 bit (Intel)] on Win7 x64 from the Python (x,y) distribution.

I'm sure I remembered a discussion about installing 0.11/pyzmq on list but I
couldn't find it so I went to the documentation and found:

http://ipython.github.com/ipython-doc/dev/install/install.html#installing-the-development-version

...which is obviously a bit out of date. Nevertheless I figured I would just
install ZMQ/PyZMQ/IPython from source and see how I went.

Compiling ZMQ was fine, however when trying the configure stage of pyzmq it
couldn't find the libzmq.lib as it wasn't copied to the zeromq-2.1.4\lib
directory. The solution was to simply copy the lib file from the zmq build
directory to the lib directory where the dll was located:

C:\dev\src\pyzmq>python setup.py configure --zmq=C:\dev\src\zeromq-2.1.4
running configure
******************************************
Configure: Autodetecting ZMQ settings...
    Custom ZMQ dir:       C:\dev\src\zeromq-2.1.4
c:\Program Files (x86)\Microsoft Visual Studio 9.0\VC\BIN\cl.exe /c /nologo /Ox
    /MD /W3 /GS- /DNDEBUG -IC:\dev\src\zeromq-2.1.4\include -Izmq\utils 
    -Izmq\core -Izmq\devices /Tcdetect\vers.c /Fodetect\vers.obj vers.c
c:\Program Files (x86)\Microsoft Visual Studio 9.0\VC\BIN\link.exe /nologo 
    /INCREMENTAL:NO /LIBPATH:C:\dev\src\zeromq-2.1.4\lib libzmq.lib 
    detect\vers.obj /OUT:detect\vers.exe /MANIFESTFILE:detect\vers.exe.manifest
C:\dev\src\zeromq-2.1.4\lib\libzmq.lib : fatal error LNK1107: 
    invalid or corrupt file: cannot read at 0x2C0
Fatal:
    Failed to compile ZMQ test program.  Please check to make sure:

    * You have a C compiler installed
    * A development version of Python is installed (including header files)
    * A development version of ZeroMQ >= 2.1.0 is installed (including header files)
    * If ZMQ is not in a default location, supply the argument --zmq=<path>
******************************************

C:\dev\src\pyzmq>ls C:/dev/src/zeromq-2.1.4/lib
libzmq.dll

C:\dev\src\pyzmq>ls C:/dev/src/zeromq-2.1.4/include
zmq.h  zmq.hpp  zmq_utils.h

C:\dev\src\pyzmq>ls C:/dev/src/zeromq-2.1.4/builds/msvc/Release/*.lib
libzmq.lib

C:\dev\src\pyzmq>python setup.py configure --zmq=C:\dev\src\zeromq-2.1.4
running configure
******************************************
Configure: Autodetecting ZMQ settings...
    Custom ZMQ dir:       C:\dev\src\zeromq-2.1.4
c:\Program Files (x86)\Microsoft Visual Studio 9.0\VC\BIN\cl.exe /c /nologo /Ox 
    /MD /W3 /GS- /DNDEBUG -IC:\dev\src\zeromq-2.1.4\include -Izmq\utils 
    -Izmq\core -Izmq\devices /Tcdetect\vers.c /Fodetect\vers.obj vers.c
c:\Program Files (x86)\Microsoft Visual Studio 9.0\VC\BIN\link.exe /nologo 
    /INCREMENTAL:NO /LIBPATH:C:\dev\src\zeromq-2.1.4\lib libzmq.lib 
    detect\vers.obj /OUT:detect\vers.exe /MANIFESTFILE:detect\vers.exe.manifest
C:\Program Files\Microsoft SDKs\Windows\v6.0A\bin\mt.exe -nologo -manifest 
    detect\vers.exe.manifest -outputresource:detect\vers.exe;1
    ZMQ version detected: 2.1.4
******************************************

Unfortunately trying to import zmq failed as the libzmq dll wasn't copied to the
site-packages directory when running python setup.py install. Copying the dll
over fixed the problem:

In [2]: import zmq
---------------------------------------------------------------------------
WindowsError                              Traceback (most recent call last)

C:\dev\src\<ipython console> in <module>()

C:\dev\bin\Python26\lib\site-packages\zmq\__init__.py in <module>()
     28     import os, ctypes
     29     here = os.path.dirname(__file__)
---> 30     ctypes.cdll.LoadLibrary(os.path.join(here, 'libzmq.dll'))
     31
     32 from zmq.utils import initthreads # initialize threads

<snip>

WindowsError: [Error 126] The specified module could not be found

In [3]: debug
> c:\dev\bin\python26\lib\ctypes\__init__.py(431)LoadLibrary()
    430     def LoadLibrary(self, name):
--> 431         return self._dlltype(name)
    432

ipdb> name
'C:\\dev\\bin\\Python26\\lib\\site-packages\\zmq\\libzmq.dll'
ipdb> up
> c:\dev\bin\python26\lib\site-packages\zmq\__init__.py(30)<module>()
     29     here = os.path.dirname(__file__)
---> 30     ctypes.cdll.LoadLibrary(os.path.join(here, 'libzmq.dll'))
     31

ipdb> print here
None
ipdb> print __file__
None

In [4]: !cp C:\dev\src\zeromq-2.1.4\lib\libzmq.dll 
    C:\dev\bin\Python26\Lib\site-packages\zmq

In [5]: import zmq

In [6]:

Installing IPython from source went fine, again using python setup.py install.
At this stage I was at a bit of a loss as to how to test it, my normal ipython
shortcut seemed to still load up my old version 10.1. I found a file
"ipython-qtconsole" in my Python26/Scripts directory but without a suffix or
associated .bat file it wasn't directly executable. This was easily resolved by
creating a bat file iqlab.bat with the contents:

@"C:\dev\bin\Python26\python.exe" 
"C:\dev\bin\Python26\scripts\ipython-qtconsole" 
--paging vsplit --pylab inline %*

The only other point to note was that my version of sip didn't have the setapi
function requiring me to update my PyQt4 install. After that however I now have
a working qtconsole - it looks great! Inline figures and sympy pretty-printing
(using %load_ext sympy_printing) work beautifully.

Just one question - in "normal" IPython the ability to define magics and
pre-import functions into the namespace using the ipy_user_conf files is very
handy - is it possibly to define magics and imports for the new qtconsole?

Let me know if there any specific I can do to help with the testing.

Thanks,
Dave








More information about the IPython-dev mailing list