Sharpie / qgis-ipython

An IPython console for Quantum GIS
4 stars 3 forks source link

Can import IPython and pygments 0.12, but still can't run plugin #3

Open AlisterH opened 12 years ago

AlisterH commented 12 years ago

With QGIS master on Windows I can do this in the python console:

To access Quantum GIS environment from this console
use qgis.utils.iface object (instance of QgisInterface class).

>>> import IPython
>>> import pygments
>>>

But when I try to run the plugin I get the message "Could not load IPython components. Please make sure IPython version 0.12 or newer is installed along with the Pygments module."

Any idea what the problem is?

Sharpie commented 12 years ago

Haven't done much testing on Windows. What does the following give you:

import sys
sys.version
AlisterH commented 12 years ago

'2.7.2 (default, Jun 12 2011, 15:08:59) [MSC v.1500 32 bit (Intel)]'

Sharpie commented 12 years ago

And you have IPython, pyzmq and Pygments installed?

AlisterH commented 12 years ago

I didn't see anything about installing pyzmq. After installing that and restarting QGIS I no longer get the error message... but the IPython console doesn't actually open. Or is it supposed to take over the normal QGIS python console?

Sharpie commented 12 years ago

A separate program should launch that contains the IPython console. Last time I worked on this project, the Windows version of QGIS was still stuck with Python 2.5 which was incapable of running the latest versions of IPython.

So, Windows is completely untested territory at this point.

AlisterH commented 12 years ago

FWIW I get the same behaviour on Arch Linux. I see this if I start QGIS from a terminal:

[IPKernelApp] To connect another client to this kernel, use:
[IPKernelApp] --existing kernel-21185.json
---------------------------------------------------------------------------
OSError                                   Traceback (most recent call last)
/root/.qgis/python/plugins/ipython_console/ipython_plugin.pyc in launch_console(self=<ipython_console.ipython_plugin.QGIS_IPython object>)
     98             self.init_kernel()
     99 
--> 100         self.kernel.new_qt_console()
        self.kernel.new_qt_console = <bound method InternalIPKernel.new_qt_console of <ipython_console.ipython.internal_ipkernel.InternalIPKernel object at 0xd47884c>>
    101 

/root/.qgis/python/plugins/ipython_console/ipython/internal_ipkernel.pyc in new_qt_console(self=<ipython_console.ipython.internal_ipkernel.InternalIPKernel object>, evt=None)
     74 
     75     def new_qt_console(self, evt=None):
---> 76         self.consoles.append(subprocess.Popen(self._qtconsole_cmd))
        self.consoles.append = <built-in method append of list object at 0xd13a6ac>
        global subprocess.Popen = <class 'subprocess.Popen'>
        self._qtconsole_cmd = ['ipython', 'qtconsole', '--existing', u'kernel-21185.json']
     77 
     78     def cleanup_consoles(self, evt=None):

/usr/lib/python2.7/subprocess.pyc in __init__(self=<subprocess.Popen object>, args=['ipython', 'qtconsole', '--existing', u'kernel-21185.json'], bufsize=0, executable=None, stdin=None, stdout=None, stderr=None, preexec_fn=None, close_fds=False, shell=False, cwd=None, env=None, universal_newlines=False, startupinfo=None, creationflags=0)
    677                             p2cread, p2cwrite,
    678                             c2pread, c2pwrite,
--> 679                             errread, errwrite)
        errread = None
        errwrite = None
    680 
    681         if mswindows:

/usr/lib/python2.7/subprocess.pyc in _execute_child(self=<subprocess.Popen object>, args=['ipython', 'qtconsole', '--existing', u'kernel-21185.json'], executable='ipython', preexec_fn=None, close_fds=False, cwd=None, env=None, universal_newlines=False, startupinfo=None, creationflags=0, shell=False, p2cread=None, p2cwrite=None, c2pread=None, c2pwrite=None, errread=None, errwrite=None)
   1247                     if fd is not None:
   1248                         os.close(fd)
-> 1249                 raise child_exception
        child_exception = OSError(2, 'No such file or directory')
   1250 
   1251 

OSError: [Errno 2] No such file or directory
Warning: QMainWindow::saveState(): 'objectName' not set for QToolBar 0xcc22120 'Vector field controller'
[root@archie /]# qgis
Warning: loading of qgis translation failed [/usr/share/qgis/i18n//qgis_en_NZ]
Warning: loading of qt translation failed [/usr/share/qt/translations/qt_en_NZ]
Qwt5 imported
matplotlib imported
[IPKernelApp] To connect another client to this kernel, use:
[IPKernelApp] --existing kernel-21216.json
---------------------------------------------------------------------------
OSError                                   Traceback (most recent call last)
/root/.qgis/python/plugins/ipython_console/ipython_plugin.pyc in launch_console(self=<ipython_console.ipython_plugin.QGIS_IPython object>)
     98             self.init_kernel()
     99 
--> 100         self.kernel.new_qt_console()
        self.kernel.new_qt_console = <bound method InternalIPKernel.new_qt_console of <ipython_console.ipython.internal_ipkernel.InternalIPKernel object at 0xcf9f84c>>
    101 

/root/.qgis/python/plugins/ipython_console/ipython/internal_ipkernel.pyc in new_qt_console(self=<ipython_console.ipython.internal_ipkernel.InternalIPKernel object>, evt=None)
     74 
     75     def new_qt_console(self, evt=None):
---> 76         self.consoles.append(subprocess.Popen(self._qtconsole_cmd))
        self.consoles.append = <built-in method append of list object at 0xcc616ac>
        global subprocess.Popen = <class 'subprocess.Popen'>
        self._qtconsole_cmd = ['ipython', 'qtconsole', '--existing', u'kernel-21216.json']
     77 
     78     def cleanup_consoles(self, evt=None):

/usr/lib/python2.7/subprocess.pyc in __init__(self=<subprocess.Popen object>, args=['ipython', 'qtconsole', '--existing', u'kernel-21216.json'], bufsize=0, executable=None, stdin=None, stdout=None, stderr=None, preexec_fn=None, close_fds=False, shell=False, cwd=None, env=None, universal_newlines=False, startupinfo=None, creationflags=0)
    677                             p2cread, p2cwrite,
    678                             c2pread, c2pwrite,
--> 679                             errread, errwrite)
        errread = None
        errwrite = None
    680 
    681         if mswindows:

/usr/lib/python2.7/subprocess.pyc in _execute_child(self=<subprocess.Popen object>, args=['ipython', 'qtconsole', '--existing', u'kernel-21216.json'], executable='ipython', preexec_fn=None, close_fds=False, cwd=None, env=None, universal_newlines=False, startupinfo=None, creationflags=0, shell=False, p2cread=None, p2cwrite=None, c2pread=None, c2pwrite=None, errread=None, errwrite=None)
   1247                     if fd is not None:
   1248                         os.close(fd)
-> 1249                 raise child_exception
        child_exception = OSError(2, 'No such file or directory')
   1250 
   1251 

OSError: [Errno 2] No such file or directory