FS#50109 - [ipython] crash on startup

Attached to Project: Community Packages
Opened by Faule Socke (socke) - Wednesday, 20 July 2016, 10:37 GMT
Last edited by Kyle Keen (keenerd) - Wednesday, 20 July 2016, 17:49 GMT
Task Type Bug Report
Category Packages
Status Closed
Assigned To Kyle Keen (keenerd)
Architecture All
Severity High
Priority Normal
Reported Version
Due in Version Undecided
Due Date Undecided
Percent Complete 100%
Votes 0
Private No

Details

Description:

Since ipython-5.0.0, it crashes on every startup with the message:

Traceback (most recent call last):
File "/usr/bin/ipython", line 4, in <module>
from IPython import start_ipython
File "/usr/lib/python3.5/site-packages/IPython/__init__.py", line 49, in <module>
from .terminal.embed import embed
File "/usr/lib/python3.5/site-packages/IPython/terminal/embed.py", line 17, in <module>
from IPython.terminal.interactiveshell import TerminalInteractiveShell
File "/usr/lib/python3.5/site-packages/IPython/terminal/interactiveshell.py", line 14, in <module>
from prompt_toolkit.enums import DEFAULT_BUFFER, EditingMode
ImportError: cannot import name 'EditingMode'

Probably an issue with the community/python-prompt_toolkit package. Works when I downgrade ipython to 4.2.0-2.

Additional info:
* package version(s):
* ipython 5.0.0-2
* python-prompt_toolkit 1.0.3-1


Steps to reproduce:
Install ipython in recent version and start it.
This task depends upon

Closed by  Kyle Keen (keenerd)
Wednesday, 20 July 2016, 17:49 GMT
Reason for closing:  Not a bug
Additional comments about closing:  pip
Comment by Kyle Keen (keenerd) - Wednesday, 20 July 2016, 12:41 GMT
Works fine for me. More digging is going to be needed to figure out why it doesn't work on your system.
Comment by Kyle Keen (keenerd) - Wednesday, 20 July 2016, 14:42 GMT
It appears "cannot import name" could happen for several reasons.

The simplest is caused by a mismatch between the pyc and py files. Should not be possible with the standard build procedure, and would have affected me too.

Next possibility is a circular reference. Also seems unlikely because that would have affected me during testing, before release.

The other cause I came across was "name shadowing". More about it here: http://python-notes.curiousefficiency.org/en/latest/python_concepts/import_traps.html#the-name-shadowing-trap

Have you installed anything or messed around with PYTHONPATH in such a way that could cause shadowing?
Comment by Moez Bouhlel (lejenome) - Wednesday, 20 July 2016, 15:16 GMT
Had same issue, it was caused by an outdated prompt-toolkit installed localy by pip.
to find if you have an outdated version:
$ pip list --outdated --local | grep prompt-toolkit
Comment by Faule Socke (socke) - Wednesday, 20 July 2016, 17:21 GMT
You were right. For some reason I had the prompt_toolkit installed locally. After removing that, it works pretty fine. Can be closed.

Loading...