IdentifiantMot de passe
Loading...
Mot de passe oublié ?Je m'inscris ! (gratuit)
Navigation

Inscrivez-vous gratuitement
pour pouvoir participer, suivre les réponses en temps réel, voter pour les messages, poser vos propres questions et recevoir la newsletter

Python Discussion :

installation de rpy-1.0.3 RuntimeError("Couldn't obtain version number from output\n" RuntimeError


Sujet :

Python

  1. #1
    Membre éclairé Avatar de ben.IT
    Homme Profil pro
    Inscrit en
    Janvier 2009
    Messages
    431
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Âge : 37
    Localisation : France, Puy de Dôme (Auvergne)

    Informations forums :
    Inscription : Janvier 2009
    Messages : 431
    Par défaut installation de rpy-1.0.3 RuntimeError("Couldn't obtain version number from output\n" RuntimeError
    Bonjour à tous,
    hello world, c'est la première fois que je mets les pieds dans le forum python

    Je suis en train d'installer le module rpy, du moins j'essaye
    J'obtiens l'erreur suivante :

    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
     
    python setup.py install
    RHOMES= []
    DEBUG= True
    Setting RHOMES to  ['/usr/local/lib/R']
    Traceback (most recent call last):
      File "setup.py", line 109, in <module>
        RVERSION = rpy_tools.get_R_VERSION(RHOME, force_exec=True)
      File "/home/bmasson/rpy-1.0.3/rpy_tools.py", line 103, in get_R_VERSION
        raise RuntimeError("Couldn't obtain version number from output\n"
    RuntimeError: Couldn't obtain version number from output
    of `R --version'.
    J'ai suivi le README et effectué les instructions préconisées mais en vain :
    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
     
     Then, configure the path to the R library.  You have several ways to do
        this (substitute RHOME with the path where R is installed, usually
        /usr/local/lib/R):
     
    	o make a link to RHOME/bin/libR.so in /usr/local/lib or /usr/lib, then
              run 'ldconfig',
     
    	o or, put the following line in your .bashrc (or equivalent):
     
                export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:RHOME/bin

    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    lrwxrwxrwx  1 root root      28 May 30 16:31 libR.so -> /usr/local/lib/R/lib/libR.so
    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/usr/local/lib/R/bin
    Pour finir :
    Voici le résultat de la commande lorsque j'effectue R --version :
    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
    R --version
    R version 2.13.0 (2011-04-13)
    Copyright (C) 2011 The R Foundation for Statistical Computing
    ISBN 3-900051-07-0
    Platform: i686-pc-linux-gnu (32-bit)
    Est ce que quelqu'un peut m'aider ?

    merci d'avance,
    ben

  2. #2
    Membre émérite
    Homme Profil pro
    heu...
    Inscrit en
    Octobre 2007
    Messages
    648
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Localisation : France, Essonne (Île de France)

    Informations professionnelles :
    Activité : heu...

    Informations forums :
    Inscription : Octobre 2007
    Messages : 648
    Par défaut
    je ne pourrais pas t'aider au delà de ce que je vais te dire...
    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
    6
    7
    Traceback (most recent call last):
      File "setup.py", line 109, in <module>
        RVERSION = rpy_tools.get_R_VERSION(RHOME, force_exec=True)
      File "/home/bmasson/rpy-1.0.3/rpy_tools.py", line 103, in get_R_VERSION
        raise RuntimeError("Couldn't obtain version number from output\n"
    RuntimeError: Couldn't obtain version number from output
    of `R --version'.
    Il faut aller explorer le fichier rpy_tools.py à la ligne 103. En fait, un peu plus haut que cette ligne pour analyser la condition qui lève l'exception, peut-être est-ce simplement une étourderie. Auquel cas, la résolution pourrait être triviale. Il n'y a aucune garantie que cela soit le cas, mais la potentielle facilité de résolution d'une telle erreur fait que cela vaut le coup de regarder.

  3. #3
    Membre éclairé Avatar de ben.IT
    Homme Profil pro
    Inscrit en
    Janvier 2009
    Messages
    431
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Âge : 37
    Localisation : France, Puy de Dôme (Auvergne)

    Informations forums :
    Inscription : Janvier 2009
    Messages : 431
    Par défaut
    Salut N;tox et merci de ta réposne,
    voici l'extrait du fichier setup.py :
    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
     # configure the R paths                                                                                                                   
        #if sys.platform=="darwin":                                                                                                               
        #  version =                                                                                                                              
        #  if os.symlink("/Library/Frameworks/R.framework/Versions/Current")                                                                      
        #  if RHOME.endswith('/'):                                                                                                                
        #    RHOME = RHOME[:-1]                                                                                                                 
        #  print "RHOME=",os.path.join(os.path.dirname(RHOME),                                                                                    
        #                              os.readlink(RHOME) )                                                                                       
        #  sys.exit()                                                                                                                             
    
    
        RVERSION = rpy_tools.get_R_VERSION(RHOME, force_exec=True)
        RVER     = rpy_tools.get_R_VERSION_CODE(RVERSION)
    La ligne 109 est en gras
    J'avais essayé de remplacé la ligne 109 par :
    L'erreur disparait mais l'étape de compilation crash

  4. #4
    Membre émérite
    Homme Profil pro
    heu...
    Inscrit en
    Octobre 2007
    Messages
    648
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Localisation : France, Essonne (Île de France)

    Informations professionnelles :
    Activité : heu...

    Informations forums :
    Inscription : Octobre 2007
    Messages : 648
    Par défaut
    Je t'invite à relire mon post précédent :
    Il faut aller explorer le fichier rpy_tools.py à la ligne 103. En fait, un peu plus haut que cette ligne

  5. #5
    Membre éclairé Avatar de ben.IT
    Homme Profil pro
    Inscrit en
    Janvier 2009
    Messages
    431
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Âge : 37
    Localisation : France, Puy de Dôme (Auvergne)

    Informations forums :
    Inscription : Janvier 2009
    Messages : 431
    Par défaut
    Voici l'extrait de rpy_tools.py :

    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
     # step 2: Try executing R to determine the version                                                                                          
      if not rver:
        if (not RHOME) or (not os.path.exists(RHOME)):
          RHOME = get_R_HOME(force_exec)
    
        rexec = os.path.join(RHOME, 'bin', 'R')
        stat, output = getstatusoutput('"%s" --version' % rexec )
        if stat or len(output)<=0:
          raise RuntimeError("Couldn't execute the R interpreter" +
                             " `%s'.\n" % rexec )
        # edd 05 Apr 2006  version = re.search("R +([0-9]\.[0-9]\.[0-9])", output)                                                                
        version = re.search(" +([0-9]\.[0-9]\.[0-9])", output)
        if not version:
          raise RuntimeError("Couldn't obtain version number from output\n"
                                   "of `R --version'.\n")
        rver = version.group(1)
    
      return rver.strip()
    Visiblement, le module rpy ne détermine pas ma version de R ..

  6. #6
    Membre émérite
    Homme Profil pro
    heu...
    Inscrit en
    Octobre 2007
    Messages
    648
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Localisation : France, Essonne (Île de France)

    Informations professionnelles :
    Activité : heu...

    Informations forums :
    Inscription : Octobre 2007
    Messages : 648
    Par défaut
    Oui, c'est bien ce que dit le message d'erreur. Tu peux néanmoins ajouter des print pour essayer de mieux voir pourquoi ça couille, et si ça se joue simplement au niveau de la regex employée, ou si c'est autre chose encore.
    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
     # step 2: Try executing R to determine the version                                                                                          
      if not rver:
        if (not RHOME) or (not os.path.exists(RHOME)):
          RHOME = get_R_HOME(force_exec)
    
        rexec = os.path.join(RHOME, 'bin', 'R')
        stat, output = getstatusoutput('"%s" --version' % rexec )
        print 'BEGIN DEBUG : \n\tstat : %s\n\t%s\nEND DEBUG'%(stat,output)
        if stat or len(output)<=0:
          raise RuntimeError("Couldn't execute the R interpreter" +
                             " `%s'.\n" % rexec )
        # edd 05 Apr 2006  version = re.search("R +([0-9]\.[0-9]\.[0-9])", output)                                                                
        version = re.search(" +([0-9]\.[0-9]\.[0-9])", output)
        if not version:
          raise RuntimeError("Couldn't obtain version number from output\n"
                                   "of `R --version'.\n")
        rver = version.group(1)
    
      return rver.strip()

  7. #7
    Membre éclairé Avatar de ben.IT
    Homme Profil pro
    Inscrit en
    Janvier 2009
    Messages
    431
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Âge : 37
    Localisation : France, Puy de Dôme (Auvergne)

    Informations forums :
    Inscription : Janvier 2009
    Messages : 431
    Par défaut
    j'ai ajoutée ton print, voici :
    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    23
    24
    RHOMES= ['/usr/local/lib/R']
    DEBUG= True
    BEGIN DEBUG : 
    	stat : 0
    	R version 2.13.0 (2011-04-13)
    Copyright (C) 2011 The R Foundation for Statistical Computing
    ISBN 3-900051-07-0
    Platform: i686-pc-linux-gnu (32-bit)
    
    R is free software and comes with ABSOLUTELY NO WARRANTY.
    You are welcome to redistribute it under the terms of the
    GNU General Public License version 2.
    For more information about these matters see
    http://www.gnu.org/licenses/.
    
    END DEBUG
    Traceback (most recent call last):
      File "setup.py", line 109, in <module>
        RVERSION = rpy_tools.get_R_VERSION(RHOME, force_exec=True)
      File "/home/bmasson/rpy-1.0.3/rpy_tools.py", line 104, in get_R_VERSION
        raise RuntimeError("Couldn't obtain version number from output\n"
    RuntimeError: Couldn't obtain version number from output
    of `R --version'.
    C'est la regex qui n'arrive pas à chopper le motif nombre.nombre.nombre -> 2.13.0 :
    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    print '\n\nDEBUG 2 : %s \n\n'%(version)
        if not version:
          raise RuntimeError("Couldn't obtain version number from output\n"
                                   "of `R --version'.\n")
    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    23
    24
    25
    26
    27
    28
    29
    30
     
    python setup.py make
    RHOMES= ['/usr/local/lib/R']
    DEBUG= True
    BEGIN DEBUG : 
    	stat : 0
    	R version 2.13.0 (2011-04-13)
    Copyright (C) 2011 The R Foundation for Statistical Computing
    ISBN 3-900051-07-0
    Platform: i686-pc-linux-gnu (32-bit)
     
    R is free software and comes with ABSOLUTELY NO WARRANTY.
    You are welcome to redistribute it under the terms of the
    GNU General Public License version 2.
    For more information about these matters see
    http://www.gnu.org/licenses/.
     
    END DEBUG
     
     
    DEBUG 2 : None 
     
     
    Traceback (most recent call last):
      File "setup.py", line 109, in <module>
        RVERSION = rpy_tools.get_R_VERSION(RHOME, force_exec=True)
      File "/home/bmasson/rpy-1.0.3/rpy_tools.py", line 105, in get_R_VERSION
        raise RuntimeError("Couldn't obtain version number from output\n"
    RuntimeError: Couldn't obtain version number from output
    of `R --version'.

  8. #8
    Membre éclairé Avatar de ben.IT
    Homme Profil pro
    Inscrit en
    Janvier 2009
    Messages
    431
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Âge : 37
    Localisation : France, Puy de Dôme (Auvergne)

    Informations forums :
    Inscription : Janvier 2009
    Messages : 431
    Par défaut
    j'ai fixer en dur
    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
      # step 2: Try executing R to determine the version                                                                                         
      if not rver:
        if (not RHOME) or (not os.path.exists(RHOME)):
          RHOME = get_R_HOME(force_exec)
    
        rexec = os.path.join(RHOME, 'bin', 'R')
        stat, output = getstatusoutput('"%s" --version' % rexec )
        print 'BEGIN DEBUG : \n\tstat : %s\n\t%s\nEND DEBUG'%(stat,output) #bm                                                                   
        if stat or len(output)<=0:
          raise RuntimeError("Couldn't execute the R interpreter" +
                             " `%s'.\n" % rexec )
        # edd 05 Apr 2006  version = re.search("R +([0-9]\.[0-9]\.[0-9])", output)                                                               
        version = re.search(" +([0-9]\.[0-9]\.[0-9])", output)
        version = "2.13.0"
        print '\n\nDEBUG 2 : %s \n\n'%(version)
        if not version:
          raise RuntimeError("Couldn't obtain version number from output\n"
                                   "of `R --version'.\n")
        #rver = version.group(1)                                                                                                                 
        rver = "2.13.0"
    return rver.strip()
    je passe les instructions qui lancaient une exception mais la compilation plante :

    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    23
    24
    25
    26
    27
    28
    29
    30
    31
    32
    33
    34
    35
    36
    37
    38
    39
    40
    41
    42
    43
    44
    45
    46
    47
    48
    49
    50
    51
    52
    53
    54
    55
    56
     
    python setup.py bdist
    RHOMES= ['/usr/local/lib/R']
    DEBUG= True
    BEGIN DEBUG : 
    	stat : 0
    	R version 2.13.0 (2011-04-13)
    Copyright (C) 2011 The R Foundation for Statistical Computing
    ISBN 3-900051-07-0
    Platform: i686-pc-linux-gnu (32-bit)
     
    R is free software and comes with ABSOLUTELY NO WARRANTY.
    You are welcome to redistribute it under the terms of the
    GNU General Public License version 2.
    For more information about these matters see
    http://www.gnu.org/licenses/.
     
    END DEBUG
     
     
    DEBUG 2 : 2.13.0 
     
     
    ### Using R verion 2.13.0 installed at /usr/local/lib/R ###
    RHOME= /usr/local/lib/R
    copying src/rpymodule.c -> src/rpymodule2130.c
    copying src/R_eval.c -> src/R_eval2130.c
    copying src/io.c -> src/io2130.c
    running bdist
    running bdist_dumb
    running build
    running build_py
    creating build
    creating build/lib.linux-i686-2.6
    copying rpy.py -> build/lib.linux-i686-2.6
    copying rpy_io.py -> build/lib.linux-i686-2.6
    copying rpy_version.py -> build/lib.linux-i686-2.6
    copying rpy_tools.py -> build/lib.linux-i686-2.6
    copying rpy_options.py -> build/lib.linux-i686-2.6
    copying rpy_wintools.py -> build/lib.linux-i686-2.6
    running build_ext
    building '_rpy2130' extension
    creating build/temp.linux-i686-2.6
    creating build/temp.linux-i686-2.6/src
    gcc -pthread -fno-strict-aliasing -g -O2 -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -fPIC -DWITH_NUMERIC=3 -DPY_ARRAY_TYPES_PREFIX=PyArray_ -DRPY_SHNAME=_rpy2130 -DINIT_RPY=init_rpy2130 -UPRE_2_2 -I/usr/local/lib/R/include -Isrc -I/usr/share/R/include -I/usr/local/lib/python2.6/site-packages/numpy/core/include -I/usr/local/include/python2.6 -c src/rpymodule2130.c -o build/temp.linux-i686-2.6/src/rpymodule2130.o -shared
    In file included from /usr/local/lib/R/include/Rdefines.h:29:0,
                     from src/RPy.h:52,
                     from src/rpymodule2130.c:51:
    /usr/local/lib/R/include/Rinternals.h:657:1: warning: function declaration isn’t a prototype
    In file included from src/RPy.h:57:0,
                     from src/rpymodule2130.c:51:
    /usr/local/lib/R/include/R_ext/Rdynload.h:26:1: warning: function declaration isn’t a prototype
    In file included from src/rpymodule2130.c:51:0:
    src/RPy.h:77:51: fatal error: Rdevices.h: No such file or directory
    compilation terminated.
    error: command 'gcc' failed with exit status 1
    je sèche

    Si quelqu'un a déja procéder à l'install de rpy ...

    ben

  9. #9
    Membre émérite
    Homme Profil pro
    heu...
    Inscrit en
    Octobre 2007
    Messages
    648
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Localisation : France, Essonne (Île de France)

    Informations professionnelles :
    Activité : heu...

    Informations forums :
    Inscription : Octobre 2007
    Messages : 648
    Par défaut
    Bon, tout d'abord, modifons la regex, je trouve ça bien plus propre que de mettre la version en dur.
    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    # step 2: Try executing R to determine the version                                                                                          
      if not rver:
        if (not RHOME) or (not os.path.exists(RHOME)):
          RHOME = get_R_HOME(force_exec)
     
        rexec = os.path.join(RHOME, 'bin', 'R')
        stat, output = getstatusoutput('"%s" --version' % rexec )
        print 'BEGIN DEBUG : \n\tstat : %s\n\t%s\nEND DEBUG'%(stat,output)
        if stat or len(output)<=0:
          raise RuntimeError("Couldn't execute the R interpreter" +
                             " `%s'.\n" % rexec )
        # edd 05 Apr 2006  version = re.search("R +([0-9]\.[0-9]\.[0-9])", output)                                                                
        version = re.search(" (\d+?\.\d+?\.\d+?) ", output)
        if not version:
          raise RuntimeError("Couldn't obtain version number from output\n"
                                   "of `R --version'.\n")
        rver = version.group(1)
     
      return rver.strip()
    Bon, ça déjà, ça devrait aller.

    Ensuite:
    [...]In file included from src/rpymodule2130.c:51:0:
    src/RPy.h:77:51: fatal error: Rdevices.h: No such file or directory[...]
    Ici, soit le dit fichier n'est pas inclu, et là faut contacter l'auteur, soit c'est un faute de frappe, auquel cas il faut retrouver le fichier pour verifier son nom exact, et le corriger (sois le nom du fichier directement (pas prudent), soit les références au dit fichier dans les différents fichiers cités).

    A tous les coups, Rdevices.h s'appelle en fait RDevices.h ou Rdevice.h ou encore RDevice.h...

  10. #10
    Membre éclairé Avatar de ben.IT
    Homme Profil pro
    Inscrit en
    Janvier 2009
    Messages
    431
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Âge : 37
    Localisation : France, Puy de Dôme (Auvergne)

    Informations forums :
    Inscription : Janvier 2009
    Messages : 431
    Par défaut
    merci pour le regex, elle fixe le problème.
    Maintenant reste, le problème du fichier manquant Rdevices.h.

    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
     
    find / -name Rdevices.h
    /home/benoit/R-2.13.0/src/include/Rdevices.h
    Ce fichier est présent dans la tarball de l'installation de R ...

  11. #11
    Membre émérite
    Homme Profil pro
    heu...
    Inscrit en
    Octobre 2007
    Messages
    648
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Localisation : France, Essonne (Île de France)

    Informations professionnelles :
    Activité : heu...

    Informations forums :
    Inscription : Octobre 2007
    Messages : 648
    Par défaut
    He bien comme on s'aventure dans le terrain du debug C, je ne puis t'aider d'avantage, à partir de là tu peux aller dans la section C, ou bien contacter l'auteur et lui faire part de tes soucis...

    Bon courage

  12. #12
    Membre émérite
    Homme Profil pro
    heu...
    Inscrit en
    Octobre 2007
    Messages
    648
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Localisation : France, Essonne (Île de France)

    Informations professionnelles :
    Activité : heu...

    Informations forums :
    Inscription : Octobre 2007
    Messages : 648
    Par défaut
    Juste une question maintenant que j'ai été faire un tour sur la page du projet... Pourquoi es-tu encore à la version 1.0.3, alors qu'il en est actuellement à la 2.1.9, quasi à la 2.2.0. ? contrainte technique ?

  13. #13
    Membre éclairé Avatar de ben.IT
    Homme Profil pro
    Inscrit en
    Janvier 2009
    Messages
    431
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Âge : 37
    Localisation : France, Puy de Dôme (Auvergne)

    Informations forums :
    Inscription : Janvier 2009
    Messages : 431
    Par défaut
    Oui, j'ai besoin de rpy 1.X pour le déploiement d'une nouvelle application web développée en python ...

Discussions similaires

  1. Réponses: 0
    Dernier message: 30/05/2011, 15h37
  2. pb installation RPy
    Par louba63 dans le forum Déploiement/Installation
    Réponses: 2
    Dernier message: 12/06/2008, 08h32

Partager

Partager
  • Envoyer la discussion sur Viadeo
  • Envoyer la discussion sur Twitter
  • Envoyer la discussion sur Google
  • Envoyer la discussion sur Facebook
  • Envoyer la discussion sur Digg
  • Envoyer la discussion sur Delicious
  • Envoyer la discussion sur MySpace
  • Envoyer la discussion sur Yahoo