jupyter / jupyter_console

Jupyter Terminal Console
http://jupyter-console.readthedocs.io/en/latest/
BSD 3-Clause "New" or "Revised" License
250 stars 146 forks source link

jupyter console --simple-prompt crashes after update to Python 3.9.8 #254

Closed pietvo closed 3 years ago

pietvo commented 3 years ago

I updated this week from Python 3.9.7 to Python 3.9.8, using macports on MacOS Catalina (10.15.7), and now jupyter-3.9 console --simple-prompt crashes. jupyter-3.9 is just a symlink to /opt/local/Library/Frameworks/Python.framework/Versions/3.9/bin/jupyter

The same happens with jupyter-console-3.9 --simple-prompt (with a similar symlink).

Without the --simple-prompt it runs without problems. I need the --simple-prompt for use within Emacs, but it also crashes in a terminal session. The crash seems to be in argparse. I don't have any jupyter or ipython specific configuration files as far as I can see.

Installed versions:

py39-jupyter 1.0.0 py39-jupyter_client 6.1.12 py39-jupyter_console 6.4.0 py39-jupyter_core 4.7.1 py39-jupyter_packaging 0.8.2 py39-jupyter_server 1.6.0 py39-jupyterlab 3.0.13 py39-jupyterlab_pygments 0.1.2 py39-jupyterlab_server 2.4.0 py39-jupyterlab_widgets 1.0.2

Crash report

% jupyter-3.9 console --simple-prompt
Traceback (most recent call last):
  File "/opt/local/Library/Frameworks/Python.framework/Versions/3.9/bin/jupyter-console", line 33, in <module>
    sys.exit(load_entry_point('jupyter-console==6.4.0', 'console_scripts', 'jupyter-console')())
  File "/opt/local/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/site-packages/jupyter_core/application.py", line 254, in launch_instance
    return super(JupyterApp, cls).launch_instance(argv=argv, **kwargs)
  File "/opt/local/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/site-packages/traitlets/config/application.py", line 845, in launch_instance
    app.initialize(argv)
  File "/opt/local/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/site-packages/traitlets/config/application.py", line 88, in inner
    return method(app, *args, **kwargs)
  File "/opt/local/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/site-packages/jupyter_console/app.py", line 132, in initialize
    super(ZMQTerminalIPythonApp, self).initialize(argv)
  File "/opt/local/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/site-packages/traitlets/config/application.py", line 88, in inner
    return method(app, *args, **kwargs)
  File "/opt/local/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/site-packages/jupyter_core/application.py", line 225, in initialize
    self.parse_command_line(argv)
  File "/opt/local/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/site-packages/jupyter_console/app.py", line 99, in parse_command_line
    super(ZMQTerminalIPythonApp, self).parse_command_line(argv)
  File "/opt/local/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/site-packages/traitlets/config/application.py", line 88, in inner
    return method(app, *args, **kwargs)
  File "/opt/local/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/site-packages/traitlets/config/application.py", line 709, in parse_command_line
    self.cli_config = deepcopy(loader.load_config())
  File "/opt/local/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/site-packages/traitlets/config/loader.py", line 851, in load_config
    self._parse_args(argv)
  File "/opt/local/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/site-packages/traitlets/config/loader.py", line 908, in _parse_args
    self.parsed_data = self.parser.parse_args(to_parse)
  File "/opt/local/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/argparse.py", line 1822, in parse_args
    args, argv = self.parse_known_args(args, namespace)
  File "/opt/local/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/site-packages/traitlets/config/loader.py", line 768, in parse_known_args
    return super().parse_known_args(args, namespace)
  File "/opt/local/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/argparse.py", line 1850, in parse_known_args
    namespace, args = self._parse_known_args(args, namespace)
  File "/opt/local/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/argparse.py", line 2064, in _parse_known_args
    start_index = consume_optional(start_index)
  File "/opt/local/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/argparse.py", line 2004, in consume_optional
    take_action(action, args, option_string)
  File "/opt/local/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/argparse.py", line 1932, in take_action
    action(self, namespace, argument_values, option_string)
  File "/opt/local/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/site-packages/traitlets/config/loader.py", line 933, in __call__
    namespace._flags.append(self.flag)
AttributeError: 'Namespace' object has no attribute '_flags'
pietvo commented 3 years ago

The problem appears to be solved by upgrading ipython/traitlets to version 5.1.1