Réinstallation de pip sur session

Bonjour,

Petit soucis technique,
J'ai voulu upgrade pip sur le cluster pour installer un package que j'utilise en local, mais au milieu du processus d'installation j'ai forcer l'arrêt et maintenant pip ne fonctionne plus sur ma session.
Quand je réinstalle pip sans les privilèges administrateur avec la commande: wget https://bootstrap.pypa.io/get-pip.py && python get-pip.py --user
pip ne marche pas correctement, dans le sens où la commande ne trouve pas les librairies Python.
Est-ce qu'un administrateur peut supprimer et réinstaller pip sur ma session (aye@core.cluster.france-bioinformatique.fr) ?

Cordialement

Bonjour Alex,

Je ne suis pas sûr de bien saisir l'erreur mais il me semble que cela vient simplement du lancement de pip.
En effet, une version de pip est déjà présente dans le système et est utilisé par défaut.
Si vous souhaitez utiliser pip installé dans votre home (https://bootstrap.pypa.io/get-pip.py && python get-pip.py --user), il faut spécifier le chemin (pip a été installé dans ~/.local/bin/):

~/.local/bin/pip

ou modifier votre PATH:

export PATH=~/.local/bin:$PATH

Est-ce bien la façon dont vous procédez ?
Si ça ne fonctionne toujours pas, pouvez-vous nous copier/coller ici l'erreur obtenue ?

Bonne journée

Après avoir reproduit le problème sur une autre session.
Il s'avère que c'est juste le fait de upgrade pip qui fait bugger.
J'ai utiliser la commande: 'pip install --upgrade pip --user'
quand je rappel pip pour installer un package:

$pip install biopython --user
Traceback (most recent call last):
  File "/usr/bin/pip", line 10, in <module>
    sys.exit(main())
TypeError: 'module' object is not callable

En appelant sur .local/bin, pip ne marche pas, le message d'erreur en fin.

Si c'est long à réparer, est-ce possible de simplement réinitialiser les sessions aye@core.cluster.france-bioinformatique.fr et gbohl@core.cluster.france-bioinformatique.fr ?
Comme j'ai télécharger les fichiers en local.
Ensuite, comment upgrade pip correctement ? Afin d'installer les packages:
-numpy
-biopython
-psutil
-ray
et d'autres à l'avenir

Le message d'erreur tronqué lorsque je lance pip depuis ~/.local/bin (j’ai surtout enlever les nombreux message copying/creating indiqué par [...]):

[gbohl@clust-slurm-client ~]$ .local/bin/pip install biopython --user
DEPRECATION: Python 2.7 will reach the end of its life on January 1st, 2020. Please upgrade your Python as Python 2.7 won't be maintained after that date. A future version of pip will drop support for Python 2.7. More details about Python 2 support in pip, can be found at https://pip.pypa.io/en/latest/development/release-process/#python-2-support
Collecting biopython
  Using cached https://files.pythonhosted.org/packages/33/55/becf2b99556588d22b542f3412990bfc79b674e198d9bc58f7bbc333439e/biopython-1.75.tar.gz
Requirement already satisfied: numpy in ./.local/lib/python2.7/site-packages (from biopython) (1.16.5)
Building wheels for collected packages: biopython
  Building wheel for biopython (setup.py) ... error
  ERROR: Command errored out with exit status 1:
   command: /bin/python -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/tmp/pip-install-7l6oDq/biopython/setup.py'"'"'; __file__='"'"'/tmp/pip-install-7l6oDq/biopython/setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' bdist_wheel -d /tmp/pip-wheel-3i8Ud2 --python-tag cp27
       cwd: /tmp/pip-install-7l6oDq/biopython/
  Complete output (721 lines):
  ==================================================================
  WARNING: Biopython will drop support for Python 2.7 in early 2020.
  ==================================================================
  running bdist_wheel
  running build
  running build_py
  creating build
  creating build/lib.linux-x86_64-2.7
  creating build/lib.linux-x86_64-2.7/Bio
  copying Bio/File.py -> build/lib.linux-x86_64-2.7/Bio
  copying Bio/Index.py -> build/lib.linux-x86_64-2.7/Bio
  […]
  copying Bio/KDTree/Neighbor.h -> build/lib.linux-x86_64-2.7/Bio/KDTree
  running build_ext
  building 'Bio.Align._aligners' extension
  creating build/temp.linux-x86_64-2.7
  creating build/temp.linux-x86_64-2.7/Bio
  creating build/temp.linux-x86_64-2.7/Bio/Align
  gcc -pthread -fno-strict-aliasing -O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector-strong --param=ssp-buffer-size=4 -grecord-gcc-switches -m64 -mtune=generic -D_GNU_SOURCE -fPIC -fwrapv -DNDEBUG -O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector-strong --param=ssp-buffer-size=4 -grecord-gcc-switches -m64 -mtune=generic -D_GNU_SOURCE -fPIC -fwrapv -fPIC -I/usr/include/python2.7 -c Bio/Align/_aligners.c -o build/temp.linux-x86_64-2.7/Bio/Align/_aligners.o
  Bio/Align/_aligners.c:11:20: fatal error: Python.h: No such file or directory
   #include "Python.h"
                      ^
  compilation terminated.
  error: command 'gcc' failed with exit status 1
  ----------------------------------------
  ERROR: Failed building wheel for biopython
  Running setup.py clean for biopython
Failed to build biopython
Installing collected packages: biopython
    Running setup.py install for biopython ... error
    ERROR: Command errored out with exit status 1:
     command: /bin/python -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/tmp/pip-install-7l6oDq/biopython/setup.py'"'"'; __file__='"'"'/tmp/pip-install-7l6oDq/biopython/setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' install --record /tmp/pip-record-ss_I2f/install-record.txt --single-version-externally-managed --compile --user --prefix=
         cwd: /tmp/pip-install-7l6oDq/biopython/
    Complete output (721 lines):
    ==================================================================
    WARNING: Biopython will drop support for Python 2.7 in early 2020.
    ==================================================================
    running install
    running build
    running build_py
    creating build
    creating build/lib.linux-x86_64-2.7
    creating build/lib.linux-x86_64-2.7/Bio
    copying Bio/File.py -> build/lib.linux-x86_64-2.7/Bio
    […]
    copying Bio/motifs/applications/__init__.py -> build/lib.linux-x86_64-2.7/Bio/motifs/applications
    copying Bio/motifs/applications/_xxmotif.py -> build/lib.linux-x86_64-2.7/Bio/motifs/applications
    creating build/lib.linux-x86_64-2.7/Bio/motifs/jaspar
    copying Bio/motifs/jaspar/__init__.py -> build/lib.linux-x86_64-2.7/Bio/motifs/jaspar
    running egg_info
    writing requirements to biopython.egg-info/requires.txt
    writing biopython.egg-info/PKG-INFO
    writing top-level names to biopython.egg-info/top_level.txt
    writing dependency_links to biopython.egg-info/dependency_links.txt
    reading manifest file 'biopython.egg-info/SOURCES.txt'
    reading manifest template 'MANIFEST.in'
    warning: no previously-included files found matching 'Tests/Gck/DGVC_GCK.zip'
    warning: no previously-included files matching '*.pyc' found anywhere in distribution
    warning: no previously-included files matching '*.pyo' found anywhere in distribution
    warning: no previously-included files matching '*.py{}' found anywhere in distribution
    warning: no previously-included files matching '*.py-e' found anywhere in distribution
    warning: no previously-included files found matching 'Bio/Align/substitution_matrices/data/README.txt'
    writing manifest file 'biopython.egg-info/SOURCES.txt'
    copying Bio/cpairwise2module.c -> build/lib.linux-x86_64-2.7/Bio
    copying Bio/trie.c -> build/lib.linux-x86_64-2.7/Bio
    copying Bio/trie.h -> build/lib.linux-x86_64-2.7/Bio
    copying Bio/triemodule.c -> build/lib.linux-x86_64-2.7/Bio
    copying Bio/Align/_aligners.c -> build/lib.linux-x86_64-2.7/Bio/Align
    creating build/lib.linux-x86_64-2.7/Bio/Entrez/DTDs
    copying Bio/Entrez/DTDs/Docsum_3_0.dtd -> build/lib.linux-x86_64-2.7/Bio/Entrez/DTDs
    […]
    copying Bio/KDTree/Neighbor.h -> build/lib.linux-x86_64-2.7/Bio/KDTree
    running build_ext
    building 'Bio.Align._aligners' extension
    creating build/temp.linux-x86_64-2.7
    creating build/temp.linux-x86_64-2.7/Bio
    creating build/temp.linux-x86_64-2.7/Bio/Align
    gcc -pthread -fno-strict-aliasing -O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector-strong --param=ssp-buffer-size=4 -grecord-gcc-switches -m64 -mtune=generic -D_GNU_SOURCE -fPIC -fwrapv -DNDEBUG -O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector-strong --param=ssp-buffer-size=4 -grecord-gcc-switches -m64 -mtune=generic -D_GNU_SOURCE -fPIC -fwrapv -fPIC -I/usr/include/python2.7 -c Bio/Align/_aligners.c -o build/temp.linux-x86_64-2.7/Bio/Align/_aligners.o
    Bio/Align/_aligners.c:11:20: fatal error: Python.h: No such file or directory
     #include "Python.h"
                        ^
    compilation terminated.
    error: command 'gcc' failed with exit status 1
    ----------------------------------------
ERROR: Command errored out with exit status 1: /bin/python -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/tmp/pip-install-7l6oDq/biopython/setup.py'"'"'; __file__='"'"'/tmp/pip-install-7l6oDq/biopython/setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' install --record /tmp/pip-record-ss_I2f/install-record.txt --single-version-externally-managed --compile --user --prefix= Check the logs for full command output.
[gbohl@clust-slurm-client ~]$

Merci pour ce retour complet.

Je n'arrive pas à reproduire exactement le problème. Toutefois, je note bien un problème avec pip sur la version python 2.7 (discuté ci-dessous).

Il n'y a pas de sessions à "réinitialiser". Tout est stocké dans votre répertoire /home.
Vous pouvez éventuellement supprimer le répertoire .local utilisé par pip (avec le répertoire .cache): rm -rf ~/.local.

A noter que la version python fournit par le système par défaut n'est pas celle à privilégier.
Nous vous invitons plutôt à utiliser les versions en module.

$ module available python
------------------------- /shared/software/modulefiles -------------------------
python/2.7  python/3.7  

# Charge python 2.7
$ module load python/2.7

Ces versions ont déjà les package numpy et biopython (cf python/2.7 ou python/3.7).

Vous pouvez ensuite installer ray et psutils avec pip dans votre /home.
Mais, comme je le disais, j'ai noté un problème avec pip sur la version 2.7.
Il ne faut pas faire pip install ray --user mais:

python -m pip install ray --user
python -m pip install psutil --user

De même pour upgrade pip

python -m pip install --upgrade pip

Pouvez-vous essayer avec cette méthode ?

Je ne suis pas très familier avec pip, ni python et je n'ai pas encore compris d'où venait le problème.
Je vous propose de continuer à en discuter ici si on trouve une explication.

Nous pouvons aussi si besoin installer pour vous ces packages ou vous pouvez directement nous proposer des modifications sur le dépôt conda-env: https://gitlab.com/ifb-elixirfr/cluster/conda-env/

1 « J'aime »

J'ai supprimer le dossier ~/.local et ~.cache, puis lancer les commandes pip avec le module python 3.7.
Tout semble tourner correctement.

Merci beaucoup !