Skip to content

QtInProcessKernelManager.start_kernel fails on Python 3.8 #400

@astrofrog

Description

@astrofrog

The following example works with Python 3.7 but not 3.8, on Windows:

from qtconsole.inprocess import QtInProcessKernelManager

kernel_manager = QtInProcessKernelManager()
kernel_manager.start_kernel()

With Python 3.8 I get:

Traceback (most recent call last):                                                                                                                                              
    File "C:\Users\Thomas Robitaille\.conda\envs\py38c\lib\site-packages\traitlets\traitlets.py", line 528, in get                                                              
        value = obj._trait_values[self.name]                                                                                                                                      
KeyError: 'iopub_socket'        
                                                                                                                                                                                                                                                                                                                        
During handling of the above exception, another exception occurred:                                                                                                                                                                                                                                                                                         Traceback (most recent call last):                                                                                                                                                  
    File "C:\Users\Thomas Robitaille\.conda\envs\py38c\lib\site-packages\traitlets\traitlets.py", line 528, in get                                                          
        value = obj._trait_values[self.name]                                                                                                                                      
KeyError: 'iopub_thread'                     
                                                                                                                                                                                                                                                                                                           
During handling of the above exception, another exception occurred:                                                                                                                                                                                                                                                                                         
Traceback (most recent call last):                                                                                                                                              
File "test_terminal.py", line 4, in <module>                                                                                                                                    kernel_manager.start_kernel()                                                                                                                                               
File "C:\Users\Thomas Robitaille\.conda\envs\py38c\lib\site-packages\ipykernel\inprocess\manager.py", line 46, in start_kernel                                              
    self.kernel = InProcessKernel(parent=self, session=self.session)                                                                                                            
File "C:\Users\Thomas Robitaille\.conda\envs\py38c\lib\site-packages\ipykernel\inprocess\ipkernel.py", line 72, in __init__                                                 
    super(InProcessKernel, self).__init__(**traits)                                                                                                                            
File "C:\Users\Thomas Robitaille\.conda\envs\py38c\lib\site-packages\ipykernel\ipkernel.py", line 71, in __init__                                                           
    self.shell.displayhook.pub_socket = self.iopub_socket                                                                                                                       
File "C:\Users\Thomas Robitaille\.conda\envs\py38c\lib\site-packages\traitlets\traitlets.py", line 556, in __get__                                                          
    return self.get(obj, cls)                                                                                                                                                   
File "C:\Users\Thomas Robitaille\.conda\envs\py38c\lib\site-packages\traitlets\traitlets.py", line 535, in get                                                              
    value = self._validate(obj, dynamic_default())                                                                                                                              
File "C:\Users\Thomas Robitaille\.conda\envs\py38c\lib\site-packages\ipykernel\inprocess\ipkernel.py", line 67, in _default_iopub_socket                                    
    return self.iopub_thread.background_socket                                                                                                                                  
File "C:\Users\Thomas Robitaille\.conda\envs\py38c\lib\site-packages\traitlets\traitlets.py", line 556, in __get__                                                          
    return self.get(obj, cls)                                                                                                                                                   
File "C:\Users\Thomas Robitaille\.conda\envs\py38c\lib\site-packages\traitlets\traitlets.py", line 535, in get                                                              
    value = self._validate(obj, dynamic_default())                                                                                                                              
File "C:\Users\Thomas Robitaille\.conda\envs\py38c\lib\site-packages\ipykernel\inprocess\ipkernel.py", line 59, in _default_iopub_thread                                    
    thread = IOPubThread(self._underlying_iopub_socket)                                                                                                                         
File "C:\Users\Thomas Robitaille\.conda\envs\py38c\lib\site-packages\ipykernel\iostream.py", line 71, in __init__                                                           
    self._setup_event_pipe()                                                                                                                                                    
File "C:\Users\Thomas Robitaille\.conda\envs\py38c\lib\site-packages\ipykernel\iostream.py", line 90, in _setup_event_pipe                                                  
    self._event_puller = ZMQStream(pipe_in, self.io_loop)                                                                                                                       
File "C:\Users\Thomas Robitaille\.conda\envs\py38c\lib\site-packages\zmq\eventloop\zmqstream.py", line 127, in __init__                                                    
     self._init_io_state()                                                                                                                                                       
File "C:\Users\Thomas Robitaille\.conda\envs\py38c\lib\site-packages\zmq\eventloop\zmqstream.py", line 546, in _init_io_state                                               
    self.io_loop.add_handler(self.socket, self._handle_events, self.io_loop.READ)                                                                                               
File "C:\Users\Thomas Robitaille\.conda\envs\py38c\lib\site-packages\tornado\platform\asyncio.py", line 99, in add_handler                                                 
     self.asyncio_loop.add_reader(fd, self._handle_events, fd, IOLoop.READ)                                                                                                      File "C:\Users\Thomas Robitaille\.conda\envs\py38c\lib\asyncio\events.py", line 501, in add_reader                                                                           
   raise NotImplementedError                                                                                                                                                 
NotImplementedError    

I made environments with e.g.:

conda create -n py38 python=3.8
conda activate py38
pip install qtpy pyqt5 qtconsole

and similarly for Python 3.7. The output of conda list for the failing environment is:

# packages in environment at C:\Users\Thomas Robitaille\.conda\envs\py38c:                                                                                                    
#                                                                                                                                                                             
# Name                    Version                   Build  Channel                                                                                                            
backcall                  0.1.0                    pypi_0    pypi                                                                                                             
ca-certificates           2019.11.27                    0                                                                                                                     
certifi                   2019.11.28               py38_0                                                                                                                     
colorama                  0.4.3                    pypi_0    pypi                                                                                                             
decorator                 4.4.1                    pypi_0    pypi                                                                                                             
ipykernel                 5.1.3                    pypi_0    pypi                                                                                                             
ipython                   7.11.1                   pypi_0    pypi                                                                                                             
ipython-genutils          0.2.0                    pypi_0    pypi                                                                                                             
jedi                      0.15.2                   pypi_0    pypi                                                                                                             
jupyter-client            5.3.4                    pypi_0    pypi                                                                                                             
jupyter-core              4.6.1                    pypi_0    pypi                                                                                                             
openssl                   1.1.1d               he774522_3                                                                                                                     
parso                     0.5.2                    pypi_0    pypi                                                                                                             
pickleshare               0.7.5                    pypi_0    pypi                                                                                                             
pip                       19.3.1                   py38_0                                                                                                                     
prompt-toolkit            3.0.2                    pypi_0    pypi                                                                                                             
pygments                  2.5.2                    pypi_0    pypi                                                                                                             
pyqt5                     5.14.1                   pypi_0    pypi                                                                                                             
pyqt5-sip                 12.7.0                   pypi_0    pypi                                                                                                             
python                    3.8.0                hff0d562_2                                                                                                                     
python-dateutil           2.8.1                    pypi_0    pypi                                                                                                             
pywin32                   227                      pypi_0    pypi                                                                                                             
pyzmq                     18.1.1                   pypi_0    pypi                                                                                                             
qtconsole                 4.6.0                    pypi_0    pypi                                                                                                             
qtpy                      1.9.0                    pypi_0    pypi                                                                                                             
setuptools                44.0.0                   py38_0                                                                                                                     
six                       1.13.0                   pypi_0    pypi                                                                                                             
sqlite                    3.30.1               he774522_0                                                                                                                     
tornado                   6.0.3                    pypi_0    pypi                                                                                                             
traitlets                 4.3.3                    pypi_0    pypi                                                                                                             
vc                        14.1                 h0510ff6_4                                                                                                                     
vs2015_runtime            14.16.27012          hf0eaf9b_1                                                                                                                     
wcwidth                   0.1.8                    pypi_0    pypi                                                                                                             
wheel                     0.33.6                   py38_0                                                                                                                     
wincertstore              0.2                      py38_0        

Just to be clear, this is on Windows

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions