Spyder not starting with TypeError: __init__() missing 1 required positional argument

Viewed 454

My question seems to be related to this one, but my problem is worse, because Spyder 5 is not starting at all. Perhaps because it's running on Mac Os?

When running /Library/Frameworks/Python.framework/Versions/3.9/bin/spyder &, the splash screen briefly appears, then disappears again, and I get the error message:

MacIgor:~ igor$ No QCoreApplication instance found. Application patches not applied. You have to call load_stylesheet function after instantiation of QApplication to take effect. 
Traceback (most recent call last):
  File "/Library/Frameworks/Python.framework/Versions/3.9/bin/spyder", line 8, in <module>
    sys.exit(main())
  File "/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/site-packages/spyder/app/start.py", line 213, in main
    mainwindow.main(options, args)
  File "/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/site-packages/spyder/app/mainwindow.py", line 2293, in main
    mainwindow = create_window(app, splash, options, args)
  File "/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/site-packages/spyder/app/mainwindow.py", line 2155, in create_window
    main.pre_visible_setup()
  File "/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/site-packages/spyder/app/mainwindow.py", line 1186, in pre_visible_setup
    plugin_instance.before_mainwindow_visible()
  File "/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/site-packages/spyder/plugins/layout/plugin.py", line 133, in before_mainwindow_visible
    self.setup_layout(default=False)
  File "/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/site-packages/spyder/plugins/layout/plugin.py", line 237, in setup_layout
    self.set_window_settings(*settings)
  File "/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/site-packages/spyder/plugins/layout/plugin.py", line 435, in set_window_settings
    self.setup_layout(default=True)
  File "/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/site-packages/spyder/plugins/layout/plugin.py", line 210, in setup_layout
    self.setup_default_layouts('default', settings)
  File "/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/site-packages/spyder/plugins/layout/plugin.py", line 276, in setup_default_layouts
    layout.set_main_window_layout(self.main, self.get_dockable_plugins())
  File "/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/site-packages/spyder/plugins/layout/api.py", line 381, in set_main_window_layout
    plugin.toggle_view(area["visible"])
  File "/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/site-packages/spyder/plugins/ipythonconsole/plugin.py", line 508, in toggle_view
    self.create_new_client(give_focus=False)
  File "/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/site-packages/spyder/plugins/ipythonconsole/plugin.py", line 1007, in create_new_client
    self.connect_client_to_kernel(client, is_cython=is_cython,
  File "/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/site-packages/spyder/plugins/ipythonconsole/plugin.py", line 1041, in connect_client_to_kernel
    km, kc = self.create_kernel_manager_and_kernel_client(
  File "/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/site-packages/spyder/plugins/ipythonconsole/plugin.py", line 1506, in create_kernel_manager_and_kernel_client
    kernel_client.hb_channel.time_to_dead = 25.0
  File "/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/site-packages/jupyter_client/client.py", line 364, in hb_channel
    self._hb_channel = self.hb_channel_class(self.context, self.session, url)
  File "/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/site-packages/qtconsole/util.py", line 64, in __new__
    QClass.__init__(inst)
TypeError: __init__() missing 1 required positional argument: 'context'

I have used Spyder 4.* and Python 3.* before without problems, on Mac OS High Sierra. The problems started today after upgrading Python to 3.9.4 (used to be 3.7.7) and Spyder to 5.

Is there a workaround, is there anything else I should check/update?

1 Answers

(Spyder maintainer here) This is a problem generated by the latest version of jupyter_client. Until a new version is released, please install the last working version with the command:

pip install jupyter_client==6.1.12

Related