Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ipython_kernel example broken with IPython4 #62

Closed
jonathanrocher opened this issue Feb 9, 2016 · 1 comment · Fixed by #80
Closed

ipython_kernel example broken with IPython4 #62

jonathanrocher opened this issue Feb 9, 2016 · 1 comment · Fixed by #80

Comments

@jonathanrocher
Copy link
Contributor

When trying to open the ipython kernel view from the example app, while having ipython4 installed, I get an error while trying to read a security file:

---------------------------------------------------------------------------
IOError                                   Traceback (most recent call last)
/home/jrocher/Projects/ETS_source/pyface/pyface/ui/qt4/action/action_item.pyc in _qt4_on_triggered(self=<pyface.ui.qt4.action.action_item._MenuItem object>)
    161 
    162             else:
--> 163                 self.controller.perform(action, action_event)
        self.controller.perform = <bound method TaskActionController.perform of <pyface.tasks.action.task_action_controller.TaskActionController object at 0x7f97466604d0>>
        action = <envisage.plugins.ipython_kernel.actions.StartQtConsoleAction object at 0x7f9746660710>
        action_event = <pyface.action.action_event.ActionEvent object at 0x7f972ad7b0b0>
    164 
    165         else:

/home/jrocher/Projects/ETS_source/pyface/pyface/tasks/action/task_action_controller.pyc in perform(self=<pyface.tasks.action.task_action_controller.TaskActionController object>, action=<envisage.plugins.ipython_kernel.actions.StartQtConsoleAction object>, event=<pyface.action.action_event.ActionEvent object>)
     29         """
     30         event.task = self.task
---> 31         return action.perform(event)
        action.perform = <bound method StartQtConsoleAction.perform of <envisage.plugins.ipython_kernel.actions.StartQtConsoleAction object at 0x7f9746660710>>
        event = <pyface.action.action_event.ActionEvent object at 0x7f972ad7b0b0>
     32 
     33     def add_to_menu(self, item):

/home/jrocher/Projects/ETS_source/envisage/envisage/plugins/ipython_kernel/actions.pyc in perform(self=<envisage.plugins.ipython_kernel.actions.StartQtConsoleAction object>, event=<pyface.action.action_event.ActionEvent object>)
     16 
     17     def perform(self, event=None):
---> 18         self.kernel.new_qt_console()
        self.kernel.new_qt_console = <bound method InternalIPKernel.new_qt_console of <envisage.plugins.ipython_kernel.internal_ipkernel.InternalIPKernel object at 0x7f97466605f0>>

/home/jrocher/Projects/ETS_source/envisage/envisage/plugins/ipython_kernel/internal_ipkernel.pyc in new_qt_console(self=<envisage.plugins.ipython_kernel.internal_ipkernel.InternalIPKernel object>)
     71         console = connect_qtconsole(
     72             self.ipkernel.connection_file, profile=self.ipkernel.profile,
---> 73             argv=['--no-confirm-exit'],
        global argv = undefined
     74         )
     75         self.consoles.append(console)

/home/jrocher/Enthought/Canopy_64bit/User/lib/python2.7/site-packages/ipykernel/connect.pyc in connect_qtconsole(connection_file=u'kernel-27690.json', argv=['--no-confirm-exit'], profile=u'default')
    160         cf = get_connection_file()
    161     else:
--> 162         cf = find_connection_file(connection_file, profile=profile)
        cf = undefined
        global find_connection_file = <function find_connection_file at 0x7f9747a16b18>
        connection_file = u'kernel-27690.json'
        profile = u'default'
    163 
    164     cmd = ';'.join([

/home/jrocher/Enthought/Canopy_64bit/User/lib/python2.7/site-packages/ipykernel/connect.pyc in find_connection_file(filename=u'kernel-27690.json', profile=u'default')
     83     security_dir = profile_dir.security_dir
     84     
---> 85     return jupyter_client.find_connection_file(filename, path=['.', security_dir])
        global jupyter_client.find_connection_file = <function find_connection_file at 0x7f974834aa28>
        filename = u'kernel-27690.json'
        global path = undefined
        security_dir = u'/home/jrocher/.ipython/profile_default/security'
     86 
     87 

/home/jrocher/Enthought/Canopy_64bit/User/lib/python2.7/site-packages/jupyter_client/connect.pyc in find_connection_file(filename=u'kernel-27690.json', path=['.', u'/home/jrocher/.ipython/profile_default/security'], profile=None)
    183     
    184     if not matches:
--> 185         raise IOError("Could not find %r in %r" % (filename, path))
        global IOError = undefined
        filename = u'kernel-27690.json'
        path = ['.', u'/home/jrocher/.ipython/profile_default/security']
    186     elif len(matches) == 1:
    187         return matches[0]

IOError: Could not find u'kernel-27690.json' in ['.', u'/home/jrocher/.ipython/profile_default/security']

FYI, there are some warnings when starting the example:

$ python example.py 
DEBUG:envisage.application:---------- application starting ----------
DEBUG:envisage.plugin_manager:plugin envisage.core starting
DEBUG:envisage.provider_extension_registry:extensions to <envisage.preferences> <[[], [], [], [], []]>
DEBUG:apptools.preferences.preferences:loading preferences from </home/jrocher/.enthought/example.ipython_kernel/preferences.ini>
DEBUG:envisage.provider_extension_registry:extensions to <envisage.class_load_hooks> <[[], [], [], [], []]>
DEBUG:envisage.provider_extension_registry:extensions to <envisage.categories> <[[], [], [], [], []]>
DEBUG:envisage.provider_extension_registry:extensions to <envisage.service_offers> <[[], [], [<envisage.service_offer.ServiceOffer object at 0x7f974ae72290>], [], [<envisage.service_offer.ServiceOffer object at 0x7f974ae724d0>]]>
DEBUG:envisage.service_registry:service <1> registered envisage.plugins.ipython_kernel.internal_ipkernel.InternalIPKernel
DEBUG:envisage.service_registry:service <2> registered envisage.ui.tasks.preferences_dialog.PreferencesDialog
DEBUG:envisage.plugin_manager:plugin envisage.core started
DEBUG:envisage.plugin_manager:plugin example.plugins.ipython_kernel starting
DEBUG:envisage.plugin_manager:plugin example.plugins.ipython_kernel started
DEBUG:envisage.plugin_manager:plugin envisage.plugins.ipython_kernel starting
DEBUG:envisage.plugin_manager:plugin envisage.plugins.ipython_kernel started
DEBUG:envisage.plugin_manager:plugin envisage.plugins.ipython_kernel_ui starting
DEBUG:envisage.plugin_manager:plugin envisage.plugins.ipython_kernel_ui started
DEBUG:envisage.plugin_manager:plugin envisage.ui.tasks starting
DEBUG:envisage.plugin_manager:plugin envisage.ui.tasks started
DEBUG:envisage.application:---------- application started ----------
DEBUG:envisage.ui.tasks.tasks_application:Tasks state location is /home/jrocher/.enthought/example.ipython_kernel/tasks/qt4
Default tasks
DEBUG:envisage.provider_extension_registry:extensions to <envisage.ui.tasks.tasks> <[[], [<envisage.ui.tasks.task_factory.TaskFactory object at 0x7f974ae9a890>], [], [], []]>
/home/jrocher/Enthought/Canopy_64bit/User/lib/python2.7/site-packages/IPython/kernel/__init__.py:13: ShimWarning: The `IPython.kernel` package has been deprecated. You should import from ipykernel or jupyter_client instead.
  "You should import from ipykernel or jupyter_client instead.", ShimWarning)
DEBUG:envisage.provider_extension_registry:extensions to <envisage.ui.tasks.task_extensions> <[[], [], [], [<envisage.ui.tasks.task_extension.TaskExtension object at 0x7f9747989230>], [<envisage.ui.tasks.task_extension.TaskExtension object at 0x7f97479895f0>]]>
DEBUG:envisage.provider_extension_registry:extensions to <ipython_plugin.namespace> <[[], [('app', <__main__.ExampleApplication object at 0x7f974ae9a590>)], [], [], []]>
NOTE: When using the `ipython kernel` entry point, Ctrl-C will not work.

To exit, you will have to explicitly quit this process, by either sending
"quit" from a client, or using Ctrl-\ in UNIX-like environments.

To read more about this, see https://github.com/ipython/ipython/issues/2049


To connect another client to this kernel, use:
    --existing kernel-27690.json
INFO:__main__:APPLICATION INITIALIZED
@jonathanrocher
Copy link
Contributor Author

I found a couple of ways to avoid the issue (not claiming they are the best):

  1. downgrade ipython to version 2.4.
  2. don't pass any connection file or profile to the connect_qtconsole function in (or comment out) https://github.com/enthought/envisage/blob/master/envisage/plugins/ipython_kernel/internal_ipkernel.py#L72 .

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant