[Résolu n°2] Un problème avec Ipython3

Forum de support pour les utilisateurs francophones

Moderator: Laurent85

Forum rules
Topics in this forum are automatically closed 6 months after creation.
jpapot

[Résolu n°2] Un problème avec Ipython3

Post by jpapot »

Bonjour.

J'ai installé ipython3 (le notebook) via synaptic, mais quand je le lance, un shell s'ouvre puis se ferme immédiatement. Pas le temps de faire du python !
Je ne sais pas quel est le problème, peut-être ai-je fait une erreur (?) dans l'installation.
Je joins une image des paquets installés :
Capture d’écran_2019-09-06_14-53-45.png
Merci pour votre aide si vous avez une idée.
Belle journée à tous (et toutes).

JP
Last edited by LockBot on Wed Dec 28, 2022 7:16 am, edited 4 times in total.
Reason: Topic automatically closed 6 months after creation. New replies are no longer allowed.
Laurent85
Level 17
Level 17
Posts: 7081
Joined: Tue May 26, 2015 10:11 am

Re: Un problème avec Ipython3

Post by Laurent85 »

Bonjour JP,
Il se passe quoi quand tu le lances d'un terminal, des messages ?

Code: Select all

ipython notebook
Image
jpapot

Re: Un problème avec Ipython3

Post by jpapot »

Salut Laurent.

J'ai écrit un peu vite le message précédent. Il s'agit bien de la version ipython3 classique (et pas le notebook) qui pose problème.
Autant la version pour python2 démarre sans souci, autant il ne semble pas trouver la version 3, alors qu'elle semble installée (d'après Synaptic) :
Capture d’écran_2019-09-07_12-39-11.png
Voilà.
Merci !

Bon week-end.
JP
Laurent85
Level 17
Level 17
Posts: 7081
Joined: Tue May 26, 2015 10:11 am

Re: Un problème avec Ipython3

Post by Laurent85 »

Quel est le retour de :

Code: Select all

ls -adl /usr/lib/*/dist-packages/IPython/*
du -sc /usr/lib/*/dist-packages/IPython
Image
jpapot

Re: Un problème avec Ipython3

Post by jpapot »

Ça donne ça :

Code: Select all

jpp@jpp-System-Product-Name ~ $ ls -adl /usr/lib/*/dist-packages/IPython/*
drwxr-xr-x  3 root root  4096 mai   21  2018 /usr/lib/python2.7/dist-packages/IPython/config
-rw-r--r--  1 root root 14989 févr.  9  2015 /usr/lib/python2.7/dist-packages/IPython/consoleapp.py
-rw-r--r--  1 root root 11900 mai   21  2018 /usr/lib/python2.7/dist-packages/IPython/consoleapp.pyc
drwxr-xr-x  3 root root  4096 mai   21  2018 /usr/lib/python2.7/dist-packages/IPython/core
-rw-r--r--  1 root root   638 févr.  9  2015 /usr/lib/python2.7/dist-packages/IPython/display.py
-rw-r--r--  1 root root   291 mai   21  2018 /usr/lib/python2.7/dist-packages/IPython/display.pyc
drwxr-xr-x  2 root root  4096 mai   21  2018 /usr/lib/python2.7/dist-packages/IPython/extensions
drwxr-xr-x 11 root root  4096 mai   21  2018 /usr/lib/python2.7/dist-packages/IPython/external
-rw-r--r--  1 root root  3192 févr.  9  2015 /usr/lib/python2.7/dist-packages/IPython/frontend.py
-rw-r--r--  1 root root  2062 mai   21  2018 /usr/lib/python2.7/dist-packages/IPython/frontend.pyc
drwxr-xr-x 10 root root  4096 août  31 21:21 /usr/lib/python2.7/dist-packages/IPython/html
-rw-r--r--  1 root root  5677 févr.  9  2015 /usr/lib/python2.7/dist-packages/IPython/__init__.py
-rw-r--r--  1 root root  5092 mai   21  2018 /usr/lib/python2.7/dist-packages/IPython/__init__.pyc
drwxr-xr-x  7 root root  4096 mai   21  2018 /usr/lib/python2.7/dist-packages/IPython/kernel
drwxr-xr-x  2 root root  4096 mai   21  2018 /usr/lib/python2.7/dist-packages/IPython/lib
-rw-r--r--  1 root root   464 févr.  9  2015 /usr/lib/python2.7/dist-packages/IPython/__main__.py
-rw-r--r--  1 root root   270 mai   21  2018 /usr/lib/python2.7/dist-packages/IPython/__main__.pyc
drwxr-xr-x  9 root root  4096 mai   21  2018 /usr/lib/python2.7/dist-packages/IPython/nbconvert
drwxr-xr-x  6 root root  4096 mai   21  2018 /usr/lib/python2.7/dist-packages/IPython/nbformat
drwxr-xr-x  6 root root  4096 mai   21  2018 /usr/lib/python2.7/dist-packages/IPython/parallel
drwxr-xr-x  3 root root  4096 sept.  5 18:29 /usr/lib/python2.7/dist-packages/IPython/qt
drwxr-xr-x  2 root root  4096 mai   21  2018 /usr/lib/python2.7/dist-packages/IPython/sphinxext
drwxr-xr-x  3 root root  4096 mai   21  2018 /usr/lib/python2.7/dist-packages/IPython/terminal
drwxr-xr-x  3 root root  4096 mai   21  2018 /usr/lib/python2.7/dist-packages/IPython/testing
drwxr-xr-x  2 root root  4096 mai   21  2018 /usr/lib/python2.7/dist-packages/IPython/utils
drwxr-xr-x  4 root root  4096 mai   21  2018 /usr/lib/python3/dist-packages/IPython/config
-rw-r--r--  1 root root 14989 févr.  9  2015 /usr/lib/python3/dist-packages/IPython/consoleapp.py
drwxr-xr-x  4 root root  4096 mai   21  2018 /usr/lib/python3/dist-packages/IPython/core
-rw-r--r--  1 root root   638 févr.  9  2015 /usr/lib/python3/dist-packages/IPython/display.py
drwxr-xr-x  3 root root  4096 mai   21  2018 /usr/lib/python3/dist-packages/IPython/extensions
drwxr-xr-x 12 root root  4096 mai   21  2018 /usr/lib/python3/dist-packages/IPython/external
-rw-r--r--  1 root root  3192 févr.  9  2015 /usr/lib/python3/dist-packages/IPython/frontend.py
drwxr-xr-x 11 root root  4096 sept.  5 18:27 /usr/lib/python3/dist-packages/IPython/html
-rw-r--r--  1 root root  5677 févr.  9  2015 /usr/lib/python3/dist-packages/IPython/__init__.py
drwxr-xr-x  8 root root  4096 mai   21  2018 /usr/lib/python3/dist-packages/IPython/kernel
drwxr-xr-x  3 root root  4096 mai   21  2018 /usr/lib/python3/dist-packages/IPython/lib
-rw-r--r--  1 root root   464 févr.  9  2015 /usr/lib/python3/dist-packages/IPython/__main__.py
drwxr-xr-x 10 root root  4096 mai   21  2018 /usr/lib/python3/dist-packages/IPython/nbconvert
drwxr-xr-x  7 root root  4096 mai   21  2018 /usr/lib/python3/dist-packages/IPython/nbformat
drwxr-xr-x  7 root root  4096 mai   21  2018 /usr/lib/python3/dist-packages/IPython/parallel
drwxr-xr-x  2 root root  4096 mai   21  2018 /usr/lib/python3/dist-packages/IPython/__pycache__
drwxr-xr-x  4 root root  4096 août  30 21:30 /usr/lib/python3/dist-packages/IPython/qt
drwxr-xr-x  3 root root  4096 mai   21  2018 /usr/lib/python3/dist-packages/IPython/sphinxext
drwxr-xr-x  4 root root  4096 mai   21  2018 /usr/lib/python3/dist-packages/IPython/terminal
drwxr-xr-x  4 root root  4096 mai   21  2018 /usr/lib/python3/dist-packages/IPython/testing
drwxr-xr-x  3 root root  4096 mai   21  2018 /usr/lib/python3/dist-packages/IPython/utils
jpp@jpp-System-Product-Name ~ $ du -sc /usr/lib/*/dist-packages/IPython
9152	/usr/lib/python2.7/dist-packages/IPython
9240	/usr/lib/python3/dist-packages/IPython
18392	total
Laurent85
Level 17
Level 17
Posts: 7081
Joined: Tue May 26, 2015 10:11 am

Re: Un problème avec Ipython3

Post by Laurent85 »

C'est une énigme. IPython est installé, le chemin du module est correct pourtant python3 dit ne pas le trouver.
python3 fonctionne ?

Code: Select all

python3
Ça ne marche pas en démarrant ipython3 à partir d'une console python3 ?

Code: Select all

python3
>>> from IPython import start_ipython
>>> start_ipython()
Image
jpapot

Re: Un problème avec Ipython3

Post by jpapot »

Voici ce que j'obtiens :
Capture d’écran_2019-09-09_14-02-43.png
Je m'interroge : n'y a -t-il pas un conflit entre deux versions de Python3 installées ? Et ce serait ça qui mettrait le bazar ?
Peut-être faut-il remettre de l'ordre dans tout ça ?

Qu'en penses-tu ?
JP
Laurent85
Level 17
Level 17
Posts: 7081
Joined: Tue May 26, 2015 10:11 am

Re: Un problème avec Ipython3

Post by Laurent85 »

jpapot wrote: Mon Sep 09, 2019 8:07 am Je m'interroge : n'y a -t-il pas un conflit entre deux versions de Python3 installées ? Et ce serait ça qui mettrait le bazar ?
Ça doit être la bonne piste.

La commande from..., c'est avec 2 majuscules pour IPython :

Code: Select all

>>> from IPython import start_ipython
>>> start_ipython()
Fais le test dans la console des 2 versions de python3 pour voir laquelle fonctionne.
Image
jpapot

Re: Un problème avec Ipython3

Post by jpapot »

Bingo :
Capture d’écran_2019-09-09_14-02-43.png
ipython3 démarre avec python3.5 qui doit être la version installée avec le dépot de linuxmint (?).
Par contre la commande ipython3 envoie vers la version de python3 la plus récente semble-t-il : python3.7 (installée depuis la source python)

Que proposes-tu ?
-> désinstaller cette version 3.7 ? Et si oui qu'est-ce que je tape ?
-> faire comprendre au système que si je tape ipython3, il doit aller vers la version 3.5 ?
-> installer ipython3 dans la version 3.7 ? Comment ?
-> autre chose peut-être ...

Merci Laurent, le IPython avec 2 majuscules, mon cerveau ne le voyait même pas !!!
JP
jpapot

Re: Un problème avec Ipython3

Post by jpapot »

Oula !!!

J'ai un gros doute ...
Si je lance IPython depuis Python3.5, je me retrouve avec ipython2.4.1. Ça ne veut pas dire que je suis en python2 ???

Ce n'est pas bien clair ...
Laurent85
Level 17
Level 17
Posts: 7081
Joined: Tue May 26, 2015 10:11 am

Re: Un problème avec Ipython3

Post by Laurent85 »

jpapot wrote: Mon Sep 09, 2019 10:58 am Que proposes-tu ?
Une modification la plus neutre possible.
Copie et modifie le script qui lance ipython3 pour qu'il utilise la version spécifique python 3.5 :

Code: Select all

sudo cp /usr/bin/ipython3 /usr/local/bin
sudo xed /usr/local/bin/ipython3
Première ligne à modifier comme ceci :

Code: Select all

#!/usr/bin/env python3.5
En lançant ipython3 ensuite la bonne version de python sera utilisée.
Image
jpapot

Re: Un problème avec Ipython3

Post by jpapot »

Salut Laurent.

La manip a bien fonctionné. ipython3 est maintenant bien accessible directement depuis le shell.
La seule chose que je voudrais comprendre : il y a deux paquets ipython dans les dépots (pour chaque version de python), mais c'est la même version ipython2.4.1 qui apparaît. Le n° de version d'ipython n'a donc rien à voir avec la version de python utilisée.
J'imagine que ce ne sont pas les mêmes équipes qui développent.

Un exemple avec un calcul d'intégrale :
Capture d’écran_2019-09-10_07-55-50.png
En tout cas une fois de plus merci. Une intervention a minima, parfait. Less is more !

Bonne journée.
JP
Laurent85
Level 17
Level 17
Posts: 7081
Joined: Tue May 26, 2015 10:11 am

Re: Un problème avec Ipython3

Post by Laurent85 »

jpapot wrote: Tue Sep 10, 2019 1:57 am La seule chose que je voudrais comprendre : il y a deux paquets ipython dans les dépots (pour chaque version de python), mais c'est la même version ipython2.4.1 qui apparaît. Le n° de version d'ipython n'a donc rien à voir avec la version de python utilisée.
J'avais oublier de répondre là-dessus c'est ça effectivement.
Un exemple avec un calcul d'intégrale :
C'est moins mal de tête avec python :lol:

Bonne journée à toi
Image
jpapot

Re: Un problème avec Ipython3

Post by jpapot »

Re-bonjour Laurent.

Suite à l'upgrade de Mint 18.3 vers Mint 19, puis la mise à niveau vers 19.3, je constate que Ipython3 ne fonctionne plus.
J'ai tenté la manip que tu m'avais proposée le 9 septembre dernier, mais ça n'a rien donné ...
Si je fais tes deux commandes :

Code: Select all

sudo cp /usr/bin/ipython3 /usr/local/bin
sudo xed /usr/local/bin/ipython3
... et que je remplace la première ligne par ça :

Code: Select all

#!/usr/bin/env python3.5
J'obtiens ça dans la console :

Code: Select all

** (xed:9764): WARNING **: 16:17:21.394: Set document metadata failed: La définition de l’attribut metadata::xed-spell-language n’est pas prise en charge

** (xed:9764): WARNING **: 16:17:21.394: Set document metadata failed: La définition de l’attribut metadata::xed-encoding n’est pas prise en charge

** (xed:9764): WARNING **: 16:17:26.018: Set document metadata failed: La définition de l’attribut metadata::xed-position n’est pas prise en charge
Que se passe-t-il ? D'ailleurs, depuis cette manip, ipython ne fonctionne plus non plus :(

Merci pour ton aide.
Bonne journée.
JP
Laurent85
Level 17
Level 17
Posts: 7081
Joined: Tue May 26, 2015 10:11 am

Re: Un problème avec Ipython3

Post by Laurent85 »

Bonjour JP,
Les messages concernent xed l'éditeur, j'ignore pourquoi mais c'est sans conséquence. J'ai testé ipython3 sur LM 19.3 ça marche. Quel est le retour de

Code: Select all

/usr/bin/ipython3
Image
jpapot

Re: Un problème avec Ipython3

Post by jpapot »

!?!?

Code: Select all

jpp@jpp-System-Product-Name ~ $ /usr/bin/ipython3
Traceback (most recent call last):
  File "<string>", line 1, in <module>
ModuleNotFoundError: No module named 'IPython'
Alors j'ai installé le paquet ipython avec Synaptic, sans succès ...
J'ai ça installé, il manque quelque chose ?

Capture d’écran_2020-04-23_17-37-09.png
Laurent85
Level 17
Level 17
Posts: 7081
Joined: Tue May 26, 2015 10:11 am

Re: Un problème avec Ipython3

Post by Laurent85 »

En parcourant à nouveau le fil de discussion il y avait à l'origine du problème une version de python provenant d'un dépôt externe.

Code: Select all

apt search ~i'python3$' ~i'python3\.'
Image
jpapot

Re: Un problème avec Ipython3

Post by jpapot »

Code: Select all

jpp@jpp-System-Product-Name ~ $ apt search ~i'python3$' ~i'python3\.'
i   bpython3                        - fancy interface to the Python 3 interprete
i A hexchat-python3                 - Python 3 plugin for HexChat               
i A idle-python3.6                  - IDE for Python (v3.6) using Tkinter       
i   ipython3                        - Enhanced interactive Python 3 shell       
i   libpython3.5                    - Shared Python runtime library (version 3.5
i   libpython3.5-dbg                - Debug Build of the Python Interpreter (ver
i   libpython3.5-dev                - Header files and a static library for Pyth
i   libpython3.5-minimal            - Minimal subset of the Python language (ver
i   libpython3.5-stdlib             - Interactive high-level object-oriented lan
i A libpython3.6                    - Shared Python runtime library (version 3.6
i A libpython3.6-dbg                - Debug Build of the Python Interpreter (ver
i A libpython3.6-dev                - Header files and a static library for Pyth
i A libpython3.6-minimal            - Minimal subset of the Python language (ver
i A libpython3.6-stdlib             - Interactive high-level object-oriented lan
i   python3                         - interactive high-level object-oriented lan
i   python3.5                       - Interactive high-level object-oriented lan
i   python3.5-dbg                   - Debug Build of the Python Interpreter (ver
i   python3.5-dev                   - Header files and a static library for Pyth
i   python3.5-minimal               - Minimal subset of the Python language (ver
i A python3.6                       - Interactive high-level object-oriented lan
i A python3.6-dbg                   - Debug Build of the Python Interpreter (ver
i A python3.6-dev                   - Header files and a static library for Pyth
i A python3.6-minimal               - Minimal subset of the Python language (ver
Laurent85
Level 17
Level 17
Posts: 7081
Joined: Tue May 26, 2015 10:11 am

Re: Un problème avec Ipython3

Post by Laurent85 »

La version python 3.5 installée provenant d'une autre source est la cause du dysfonctionnement. Elle sert à quoi d'ailleurs ?

Procède de cette façon :

Code: Select all

sudo cp /usr/bin/ipython3 /usr/local/bin
xed admin:/usr/local/bin/ipython3
Modifie la ligne comme suit:

Code: Select all

VERSION="3.6"
Image
jpapot

Re: Un problème avec Ipython3

Post by jpapot »

Bravo Laurent !

Ça fonctionne :
Capture d’écran_2020-04-23_21-35-35.png
Je ne sais plus pourquoi j'ai cette version de python 3.5 ???

Comment puis-je m'en débarasser ?
Locked

Return to “Français - French”