Ipython: Absturzfehler

Erstellt am 20. Jan. 2021  ·  4Kommentare  ·  Quelle: ipython/ipython

In [3]: nn.relu
Traceback (letzter Aufruf zuletzt):
Datei „/home/hcl/miniconda3/envs/pytorch/lib/python3.7/site-packages/IPython/terminal/ptutils.py“, Zeile 113, in get_completions
Ertrag aus self._get_completions(body, offset, cursor_position, self.ipy_completer)
Datei „/home/hcl/miniconda3/envs/pytorch/lib/python3.7/site-packages/IPython/terminal/ptutils.py“, Zeile 129, in _get_completions
für c in Ergänzungen:
Datei „/home/hcl/miniconda3/envs/pytorch/lib/python3.7/site-packages/IPython/core/completer.py“, Zeile 438, in _deduplicate_completions
Vervollständigungen = Liste(Vervollständigungen)
Datei „/home/hcl/miniconda3/envs/pytorch/lib/python3.7/site-packages/IPython/core/completer.py“, Zeile 1818, in Vervollständigungen
für c in self._completions(text, offset, _timeout=self.jedi_compute_type_timeout/1000):
Datei „/home/hcl/miniconda3/envs/pytorch/lib/python3.7/site-packages/IPython/core/completer.py“, Zeile 1862, in _completions
full_text=full_text, cursor_line=cursor_line, cursor_pos=cursor_column)
Datei „/home/hcl/miniconda3/envs/pytorch/lib/python3.7/site-packages/IPython/core/completer.py“, Zeile 2030, in _complete
Cursorposition, Cursorzeile, Volltext)
Datei „/home/hcl/miniconda3/envs/pytorch/lib/python3.7/site-packages/IPython/core/completer.py“, Zeile 1374, in _jedi_matches
text[:offset], namespaces, column=cursor_column, line=cursor_line + 1)
Datei „/home/hcl/miniconda3/envs/pytorch/lib/python3.7/site-packages/jedi/api/__init__.py“, Zeile 726, in __init__
project=Projekt(Pfad.cwd()), **kwds)
TypeError: __init__() hat ein unerwartetes Schlüsselwortargument 'Spalte' erhalten

Während der Behandlung der obigen Ausnahme ist eine weitere Ausnahme aufgetreten:

Traceback (letzter Aufruf zuletzt):
Datei "/home/hcl/miniconda3/envs/pytorch/bin/ipython", Zeile 8, in
sys.exit(start_ipython())
Datei „/home/hcl/miniconda3/envs/pytorch/lib/python3.7/site-packages/IPython/__init__.py“, Zeile 126, in start_ipython
return launch_new_instance(argv=argv, *kwargs)Datei „/home/hcl/miniconda3/envs/pytorch/lib/python3.7/site-packages/traitlets/config/application.py“, Zeile 845, in launch_instanceapp.start()Datei "/home/hcl/miniconda3/envs/pytorch/lib/python3.7/site-packages/IPython/terminal/ipapp.py", Zeile 356, in startself.shell.mainloop()Datei „/home/hcl/miniconda3/envs/pytorch/lib/python3.7/site-packages/IPython/terminal/interactiveshell.py“, Zeile 564, in mainloopself.interact()Datei „/home/hcl/miniconda3/envs/pytorch/lib/python3.7/site-packages/IPython/terminal/interactiveshell.py“, Zeile 547, in „interactioncode = self.prompt_for_code()Datei „/home/hcl/miniconda3/envs/pytorch/lib/python3.7/site-packages/IPython/terminal/interactiveshell.py“, Zeile 475, in prompt_for_code* self._extra_prompt_options())
Datei „/home/hcl/miniconda3/envs/pytorch/lib/python3.7/site-packages/prompt_toolkit/shortcuts/prompt.py“, Zeile 1013, in prompt
return self.app.run(set_exception_handler=set_exception_handler)
Datei „/home/hcl/miniconda3/envs/pytorch/lib/python3.7/site-packages/prompt_toolkit/application/application.py“, Zeile 817, in Ausführung
self.run_async(pre_run=pre_run, set_exception_handler=set_exception_handler)
Datei „/home/hcl/miniconda3/envs/pytorch/lib/python3.7/asyncio/base_events.py“, Zeile 584, in run_until_complete
return future.result()
Datei „/home/hcl/miniconda3/envs/pytorch/lib/python3.7/site-packages/prompt_toolkit/application/application.py“, Zeile 783, in run_async
zurück warten _run_async2()
Datei „/home/hcl/miniconda3/envs/pytorch/lib/python3.7/site-packages/prompt_toolkit/application/application.py“, Zeile 771, in _run_async2
warte auf self.cancel_and_wait_for_background_tasks()
Datei „/home/hcl/miniconda3/envs/pytorch/lib/python3.7/site-packages/prompt_toolkit/application/application.py“, Zeile 872, in cancel_and_wait_for_background_tasks
Aufgabe erwarten
Datei „/home/hcl/miniconda3/envs/pytorch/lib/python3.7/site-packages/prompt_toolkit/buffer.py“, Zeile 1854, in new_coroutine
Erwarte Coroutine( a, * kw)
Datei „/home/hcl/miniconda3/envs/pytorch/lib/python3.7/site-packages/prompt_toolkit/buffer.py“, Zeile 1684, in async_completer
Dokument, vollständiges_Ereignis
Datei „/home/hcl/miniconda3/envs/pytorch/lib/python3.7/site-packages/prompt_toolkit/completion/base.py“, Zeile 270, in get_completions_async
Dokument, vollständiges_Ereignis
Datei „/home/hcl/miniconda3/envs/pytorch/lib/python3.7/site-packages/prompt_toolkit/completion/base.py“, Zeile 196, in get_completions_async
für Artikel in self.get_completions(document, complete_event):
Datei „/home/hcl/miniconda3/envs/pytorch/lib/python3.7/site-packages/IPython/terminal/ptutils.py“, Zeile 116, in get_completions
exc_type, exc_value, exc_tb = sys.exc_info()
NameError: Name „sys“ ist nicht definiert

Wenn Sie vermuten, dass dies ein Fehler in IPython 7.19.0 ist, melden Sie ihn bitte unter:
https://github.com/ipython/ipython/issues
oder senden Sie eine E-Mail an die Mailingliste unter [email protected]

Sie können jetzt ein detaillierteres Traceback mit "%tb" drucken oder "%debug" verwenden.
um es interaktiv zu debuggen.

Extra-detaillierte Tracebacks für Bug-Reporting-Zwecke können aktiviert werden über:
%config Application.verbose_crash=Wahr

Hilfreichster Kommentar

Auslesen des Tracebacks:

  1. Die Importe sys und traceback fehlen in IPython/terminal/ptutils.py , und dies ist das Problem, das den Absturz von Ipython verursacht;
  2. In jedi/api/__init__.py beschwert es sich, dass das Argument "Spalte" an Script.__init__ übergeben wird, das ein solches Argument nicht akzeptiert;
  3. Dieser Fehler kommt von IPython/core/completer.py , wo in Zeile 1373 ein neues jedi.Interpreter erstellt wird, an das ein "Spalten"-Argument übergeben wird, das es erstickt.

Die Methode zum Erstellen eines Script -Objekts hat sich zwischen jedi 0.17 und jedi 0.18 geändert:
In 0,17:

     def __init__(self, code=None, line=None, column=None, path=None,                                    
                 encoding=None, sys_path=None, environment=None,                                               
                 project=None, source=None):

in 0,18:

    def __init__(self, code=None, *, path=None, environment=None, project=None):

Wenn Sie jedi 0.17 anstelle von jedi 0.18 installieren, sollte die aktuelle Version von ipython funktionieren.
Das hat bei mir funktioniert:

pip uninstall jedi
pip install jedi==0.17.2

Alle 4 Kommentare

Die Wurzel dieses Problems liegt nicht an Ipython. Kommt eigentlich aus dem Paket jedi . Aber ipython hat auch einen diesbezüglichen Fehler. sys -Modul wurde in get_completions -Ausnahme nicht importiert.

Die Module sys und traceback wurden vor 7 Monaten hinzugefügt, aber nicht in Pypi aktualisiert. Aus diesem Grund bezieht sich dieser Fehler nicht auf ipython. Es ist ein Fehler in jedi .

Könnten Sie bitte genauere Informationen darüber geben, warum dies ein Problem in jedi ist?
Die neueste ipython -Version auf PyPI ist 7.19.0, die den fehlenden Import enthält, der - wie Sie bereits bemerkt haben - auf dem Master behoben, aber nicht veröffentlicht wurde.
https://github.com/ipython/ipython/blob/7.19.0/IPython/terminal/ptutils.py

Kein Import von sys
https://github.com/ipython/ipython/blob/223e783c447a773a497809646ca0d874ea10ceeb/IPython/terminal/ptutils.py#L20 -L24

Verwendung von sys
https://github.com/ipython/ipython/blob/223e783c447a773a497809646ca0d874ea10ceeb/IPython/terminal/ptutils.py#L116

Auslesen des Tracebacks:

  1. Die Importe sys und traceback fehlen in IPython/terminal/ptutils.py , und dies ist das Problem, das den Absturz von Ipython verursacht;
  2. In jedi/api/__init__.py beschwert es sich, dass das Argument "Spalte" an Script.__init__ übergeben wird, das ein solches Argument nicht akzeptiert;
  3. Dieser Fehler kommt von IPython/core/completer.py , wo in Zeile 1373 ein neues jedi.Interpreter erstellt wird, an das ein "Spalten"-Argument übergeben wird, das es erstickt.

Die Methode zum Erstellen eines Script -Objekts hat sich zwischen jedi 0.17 und jedi 0.18 geändert:
In 0,17:

     def __init__(self, code=None, line=None, column=None, path=None,                                    
                 encoding=None, sys_path=None, environment=None,                                               
                 project=None, source=None):

in 0,18:

    def __init__(self, code=None, *, path=None, environment=None, project=None):

Wenn Sie jedi 0.17 anstelle von jedi 0.18 installieren, sollte die aktuelle Version von ipython funktionieren.
Das hat bei mir funktioniert:

pip uninstall jedi
pip install jedi==0.17.2
War diese Seite hilfreich?
0 / 5 - 0 Bewertungen