pythonmacosanacondaipythonminiconda

iPython gives error for unexpected keyword argument 'inputhook'


I installed Python 3 on a new Mac using Miniconda and have the following setup:

When I try to run iPython in the terminal I receive the following error:

Traceback (most recent call last):
  File "/Users/g72/miniconda3/bin/ipython", line 11, in <module>
    sys.exit(start_ipython())
  File "/Users/g72/miniconda3/lib/python3.7/site-packages/IPython/__init__.py", line 125, in start_ipython
    return launch_new_instance(argv=argv, **kwargs)
  File "/Users/g72/miniconda3/lib/python3.7/site-packages/traitlets/config/application.py", line 663, in launch_instance
    app.initialize(argv)
  File "</Users/g72/miniconda3/lib/python3.7/site-packages/decorator.py:decorator-gen-113>", line 2, in initialize
  File "/Users/g72/miniconda3/lib/python3.7/site-packages/traitlets/config/application.py", line 87, in catch_config_error
    return method(app, *args, **kwargs)
  File "/Users/g72/miniconda3/lib/python3.7/site-packages/IPython/terminal/ipapp.py", line 317, in initialize
    self.init_shell()
  File "/Users/g72/miniconda3/lib/python3.7/site-packages/IPython/terminal/ipapp.py", line 333, in init_shell
    ipython_dir=self.ipython_dir, user_ns=self.user_ns)
  File "/Users/g72/miniconda3/lib/python3.7/site-packages/traitlets/config/configurable.py", line 412, in instance
    inst = cls(*args, **kwargs)
  File "/Users/g72/miniconda3/lib/python3.7/site-packages/IPython/terminal/interactiveshell.py", line 464, in __init__
    self.init_prompt_toolkit_cli()
  File "/Users/g72/miniconda3/lib/python3.7/site-packages/IPython/terminal/interactiveshell.py", line 296, in init_prompt_toolkit_cli
    **self._extra_prompt_options())
TypeError: __init__() got an unexpected keyword argument 'inputhook'

If you suspect this is an IPython bug, please report it at:
    https://github.com/ipython/ipython/issues
or send an email to the mailing list at ipython-dev@python.org

You can print a more detailed traceback right now with "%tb", or use "%debug"
to interactively debug it.

Extra-detailed tracebacks for bug-reporting purposes can be enabled via:
    c.Application.verbose_crash=True

The error appears to be related to an __init__() method keyword argument 'inputhook'. Any suggestions on how to fix this?


Solution

  • It may be this issue, or a new related since it should be fixed: https://github.com/ipython/ipython/issues/11962

    Downgrading prompt_toolkit worked for us: conda install prompt_toolkit==2.0.10

    Edit: kmario23's response (upgrade IPython installation) is now preferable if possible!