Ipython: erreur de plantage

Créé le 20 janv. 2021  ·  4Commentaires  ·  Source: ipython/ipython

Dans [3] : nn.relu
Traceback (dernier appel le plus récent) :
Fichier "/home/hcl/miniconda3/envs/pytorch/lib/python3.7/site-packages/IPython/terminal/ptutils.py", ligne 113, dans get_completions
rendement de self._get_completions (corps, décalage, curseur_position, self.ipy_completer)
Fichier "/home/hcl/miniconda3/envs/pytorch/lib/python3.7/site-packages/IPython/terminal/ptutils.py", ligne 129, dans _get_completions
pour c dans les complétions :
Fichier "/home/hcl/miniconda3/envs/pytorch/lib/python3.7/site-packages/IPython/core/completer.py", ligne 438, dans _deduplicate_completions
complétions = liste(complétions)
Fichier "/home/hcl/miniconda3/envs/pytorch/lib/python3.7/site-packages/IPython/core/completer.py", ligne 1818, dans les complétions
pour c dans self._completions(text, offset, _timeout=self.jedi_compute_type_timeout/1000):
Fichier "/home/hcl/miniconda3/envs/pytorch/lib/python3.7/site-packages/IPython/core/completer.py", ligne 1862, dans _completions
full_text=full_text, curseur_line=curseur_ligne, curseur_pos=curseur_colonne)
Fichier "/home/hcl/miniconda3/envs/pytorch/lib/python3.7/site-packages/IPython/core/completer.py", ligne 2030, dans _complete
curseur_pos, curseur_ligne, texte_intégral)
Fichier "/home/hcl/miniconda3/envs/pytorch/lib/python3.7/site-packages/IPython/core/completer.py", ligne 1374, dans _jedi_matches
text[:offset], namespaces, column=cursor_column, line=cursor_line + 1)
Fichier "/home/hcl/miniconda3/envs/pytorch/lib/python3.7/site-packages/jedi/api/__init__.py", ligne 726, dans __init__
projet=Projet(Chemin.cwd()), **kwds)
TypeError : __init__() a reçu un argument de mot clé inattendu 'column'

Lors du traitement de l'exception ci-dessus, une autre exception s'est produite :

Traceback (dernier appel le plus récent) :
Fichier "/home/hcl/miniconda3/envs/pytorch/bin/ipython", ligne 8, dans
sys.exit(start_ipython())
Fichier "/home/hcl/miniconda3/envs/pytorch/lib/python3.7/site-packages/IPython/__init__.py", ligne 126, dans start_ipython
return launch_new_instance(argv=argv, *kwargs)Fichier "/home/hcl/miniconda3/envs/pytorch/lib/python3.7/site-packages/traitlets/config/application.py", ligne 845, dans launch_instanceapp.start()Fichier "/home/hcl/miniconda3/envs/pytorch/lib/python3.7/site-packages/IPython/terminal/ipapp.py", ligne 356, au débutself.shell.mainloop()Fichier "/home/hcl/miniconda3/envs/pytorch/lib/python3.7/site-packages/IPython/terminal/interactiveshell.py", ligne 564, dans mainloopself.interact()Fichier "/home/hcl/miniconda3/envs/pytorch/lib/python3.7/site-packages/IPython/terminal/interactiveshell.py", ligne 547, dans interactcode = self.prompt_for_code()Fichier "/home/hcl/miniconda3/envs/pytorch/lib/python3.7/site-packages/IPython/terminal/interactiveshell.py", ligne 475, dans prompt_for_code* self._extra_prompt_options())
Fichier "/home/hcl/miniconda3/envs/pytorch/lib/python3.7/site-packages/prompt_toolkit/shortcuts/prompt.py", ligne 1013, dans l'invite
retourner self.app.run(set_exception_handler=set_exception_handler)
Fichier "/home/hcl/miniconda3/envs/pytorch/lib/python3.7/site-packages/prompt_toolkit/application/application.py", ligne 817, en exécution
self.run_async(pre_run=pre_run, set_exception_handler=set_exception_handler)
Fichier "/home/hcl/miniconda3/envs/pytorch/lib/python3.7/asyncio/base_events.py", ligne 584, dans run_until_complete
retourner future.result()
Fichier "/home/hcl/miniconda3/envs/pytorch/lib/python3.7/site-packages/prompt_toolkit/application/application.py", ligne 783, dans run_async
retourner attendre _run_async2()
Fichier "/home/hcl/miniconda3/envs/pytorch/lib/python3.7/site-packages/prompt_toolkit/application/application.py", ligne 771, dans _run_async2
attendre self.cancel_and_wait_for_background_tasks()
Fichier "/home/hcl/miniconda3/envs/pytorch/lib/python3.7/site-packages/prompt_toolkit/application/application.py", ligne 872, dans cancel_and_wait_for_background_tasks
attendre la tâche
Fichier "/home/hcl/miniconda3/envs/pytorch/lib/python3.7/site-packages/prompt_toolkit/buffer.py", ligne 1854, dans new_coroutine
attendre coroutine( a, * kw)
Fichier "/home/hcl/miniconda3/envs/pytorch/lib/python3.7/site-packages/prompt_toolkit/buffer.py", ligne 1684, dans async_completer
document, complete_event
Fichier "/home/hcl/miniconda3/envs/pytorch/lib/python3.7/site-packages/prompt_toolkit/completion/base.py", ligne 270, dans get_completions_async
document, complete_event
Fichier "/home/hcl/miniconda3/envs/pytorch/lib/python3.7/site-packages/prompt_toolkit/completion/base.py", ligne 196, dans get_completions_async
pour l'élément dans self.get_completions(document, complete_event):
Fichier "/home/hcl/miniconda3/envs/pytorch/lib/python3.7/site-packages/IPython/terminal/ptutils.py", ligne 116, dans get_completions
exc_type, exc_value, exc_tb = sys.exc_info()
NameError : le nom 'sys' n'est pas défini

Si vous pensez qu'il s'agit d'un bogue IPython 7.19.0, veuillez le signaler à :
https://github.com/ipython/ipython/issues
ou envoyez un e-mail à la liste de diffusion à [email protected]

Vous pouvez imprimer une trace plus détaillée dès maintenant avec "%tb", ou utiliser "%debug"
pour le déboguer de manière interactive.

Des traces extra-détaillées à des fins de rapport de bogue peuvent être activées via :
%config Application.verbose_crash=Vrai

Commentaire le plus utile

Lecture de la trace:

  1. Les importations sys et traceback sont manquantes dans IPython/terminal/ptutils.py , et c'est le problème qui cause le plantage d'Ipython ;
  2. Dans jedi/api/__init__.py , il se plaint que l'argument "column" est passé à Script.__init__ , qui n'accepte pas un tel argument ;
  3. Cette erreur provient de IPython/core/completer.py , où à la ligne 1373 un nouveau jedi.Interpreter est créé, lui passant un argument "column", qui l'étouffe.

La façon de créer un objet Script a changé entre jedi 0.17 et jedi 0.18 :
En 0.17 :

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

en 0.18 :

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

Si vous installez jedi 0.17 au lieu de jedi 0.18, la version actuelle d'ipython devrait fonctionner.
Cela a fonctionné pour moi:

pip uninstall jedi
pip install jedi==0.17.2

Tous les 4 commentaires

La racine de ce problème n'est pas due à ipython. Vient en fait du paquet jedi . Mais ipython a également une erreur liée à cela. Module sys non importé dans l'exception get_completions .

Modules sys et traceback ajoutés il y a 7 mois mais pas mis à jour dans pypi. Pour cette raison, cette erreur n'est pas liée à ipython. C'est une erreur dans jedi .

Pourriez-vous s'il vous plaît donner des informations plus détaillées sur la raison pour laquelle il s'agit d'un problème dans jedi ?
La dernière version ipython sur PyPI est la 7.19.0 qui contient l'importation manquante qui est - comme vous l'avez déjà noté - corrigée sur le maître mais pas publiée.
https://github.com/ipython/ipython/blob/7.19.0/IPython/terminal/ptutils.py

Aucune importation de sys
https://github.com/ipython/ipython/blob/223e783c447a773a497809646ca0d874ea10ceeb/IPython/terminal/ptutils.py#L20 -L24

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

Lecture de la trace:

  1. Les importations sys et traceback sont manquantes dans IPython/terminal/ptutils.py , et c'est le problème qui cause le plantage d'Ipython ;
  2. Dans jedi/api/__init__.py , il se plaint que l'argument "column" est passé à Script.__init__ , qui n'accepte pas un tel argument ;
  3. Cette erreur provient de IPython/core/completer.py , où à la ligne 1373 un nouveau jedi.Interpreter est créé, lui passant un argument "column", qui l'étouffe.

La façon de créer un objet Script a changé entre jedi 0.17 et jedi 0.18 :
En 0.17 :

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

en 0.18 :

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

Si vous installez jedi 0.17 au lieu de jedi 0.18, la version actuelle d'ipython devrait fonctionner.
Cela a fonctionné pour moi:

pip uninstall jedi
pip install jedi==0.17.2
Cette page vous a été utile?
0 / 5 - 0 notes