2017-09-23 1 views
6

Ich versuche, das r-Paket namens "riesig" zu verwenden. Ich habe ein Problem in rpy2, dass ich versuche, dieses Paket zu installieren, die der Code läuft gut mit dem folgenden Code:rpy2 Fehler nach der Installation von r Paket

import rpy2.robjects.packages as rpackages 

# import R's utility package 
utils = rpackages.importr('utils') 

# select a mirror for R packages 
utils.chooseCRANmirror(ind=1) # select the first mirror in the list 

packnames = ('huge') 

# R vector of strings 
from rpy2.robjects.vectors import StrVector 

# Selectively install what needs to be install. 
# We are fancy, just because we can. 
names_to_install = ['huge'] 
if len(names_to_install) > 0: 
    utils.install_packages(StrVector(names_to_install)) 

Mit nur Warnungen, mir zu sagen, dass:

/home/johnzhou/anaconda3/envs/python35/lib/python3.5/site-packages/rpy2/rinterface/__init__.py:145: RRuntimeWarning: also installing the dependency ‘igraph’ 


    warnings.warn(x, RRuntimeWarning) 
/home/johnzhou/anaconda3/envs/python35/lib/python3.5/site-packages/rpy2/rinterface/__init__.py:145: RRuntimeWarning: trying URL 'https://cloud.r-project.org/src/contrib/igraph_1.1.2.tar.gz' 

    warnings.warn(x, RRuntimeWarning) 
/home/johnzhou/anaconda3/envs/python35/lib/python3.5/site-packages/rpy2/rinterface/__init__.py:145: RRuntimeWarning: Content type 'application/x-gzip' 
    warnings.warn(x, RRuntimeWarning) 
/home/johnzhou/anaconda3/envs/python35/lib/python3.5/site-packages/rpy2/rinterface/__init__.py:145: RRuntimeWarning: length 3376958 bytes (3.2 MB) 

    warnings.warn(x, RRuntimeWarning) 
/home/johnzhou/anaconda3/envs/python35/lib/python3.5/site-packages/rpy2/rinterface/__init__.py:145: RRuntimeWarning: = 
    warnings.warn(x, RRuntimeWarning) 
/home/johnzhou/anaconda3/envs/python35/lib/python3.5/site-packages/rpy2/rinterface/__init__.py:145: RRuntimeWarning: 

    warnings.warn(x, RRuntimeWarning) 
/home/johnzhou/anaconda3/envs/python35/lib/python3.5/site-packages/rpy2/rinterface/__init__.py:145: RRuntimeWarning: downloaded 3.2 MB 


    warnings.warn(x, RRuntimeWarning) 
/home/johnzhou/anaconda3/envs/python35/lib/python3.5/site-packages/rpy2/rinterface/__init__.py:145: RRuntimeWarning: trying URL 'https://cloud.r-project.org/src/contrib/huge_1.2.7.tar.gz' 

    warnings.warn(x, RRuntimeWarning) 
/home/johnzhou/anaconda3/envs/python35/lib/python3.5/site-packages/rpy2/rinterface/__init__.py:145: RRuntimeWarning: length 2946819 bytes (2.8 MB) 

    warnings.warn(x, RRuntimeWarning) 
/home/johnzhou/anaconda3/envs/python35/lib/python3.5/site-packages/rpy2/rinterface/__init__.py:145: RRuntimeWarning: downloaded 2.8 MB 


    warnings.warn(x, RRuntimeWarning) 
/home/johnzhou/anaconda3/envs/python35/lib/python3.5/site-packages/rpy2/rinterface/__init__.py:145: RRuntimeWarning: 
    warnings.warn(x, RRuntimeWarning) 
/home/johnzhou/anaconda3/envs/python35/lib/python3.5/site-packages/rpy2/rinterface/__init__.py:145: RRuntimeWarning: The downloaded source packages are in 
    ‘/tmp/RtmpOb6GhL/downloaded_packages’ 
    warnings.warn(x, RRuntimeWarning) 
/home/johnzhou/anaconda3/envs/python35/lib/python3.5/site-packages/rpy2/rinterface/__init__.py:145: RRuntimeWarning: Updating HTML index of packages in '.Library' 

    warnings.warn(x, RRuntimeWarning) 
/home/johnzhou/anaconda3/envs/python35/lib/python3.5/site-packages/rpy2/rinterface/__init__.py:145: RRuntimeWarning: Making 'packages.html' ... 
    warnings.warn(x, RRuntimeWarning) 
/home/johnzhou/anaconda3/envs/python35/lib/python3.5/site-packages/rpy2/rinterface/__init__.py:145: RRuntimeWarning: done 

    warnings.warn(x, RRuntimeWarning) 

jedoch wenn ich versuche, um das Paket zu laden, mit:

rpy2.robjects.packages.importr("huge") 

ich eine Fehlermeldung erhalten, wo es sagt mir, dass:

RRuntimeError        Traceback (most recent call last) 
<ipython-input-104-843fb8da3355> in <module>() 
----> 1 rpy2.robjects.packages.importr("huge") 

~/anaconda3/envs/python35/lib/python3.5/site-packages/rpy2/robjects/packages.py in importr(name, lib_loc, robject_translations, signature_translation, suppress_messages, on_conflict, symbol_r2python, symbol_check_after, data) 
    451  if _package_has_namespace(rname, 
    452        _system_file(package = rname)): 
--> 453   env = _get_namespace(rname) 
    454   version = _get_namespace_version(rname)[0] 
    455   exported_names = set(_get_namespace_exports(rname)) 

RRuntimeError: Error in loadNamespace(name) : there is no package called ‘huge’ 

Könnte mir bitte jemand helfen?

Dank

Antwort

0

Haben Sie die Bibliothek zu überprüfen versucht, wo Ihr Paket installiert wird?

ich vor wenigen Tagen hatte das gleiche Problem, und ich folgte diese Schritte 1. Check Bibliothekspfade mit .libPaths() in R 2. Versuchen Sie die Pakete in R-Konsole zu installieren install.packages mit (‚Paketnamen‘) 3. Überprüfen Sie, ob das Paket in den Pfaden installiert ist, die Sie als Ergebnis von Schritt 1 oben erhalten haben. 4. Wenn es in einer anderen Bibliothek installiert ist, dann führen Sie einfach eine einfache Kopie der Pakete aus diesem Verzeichnis in die Bibliotheken .libPaths() durch.

R versucht, für Bibliotheken in Standardverzeichnis zu suchen und Sie müssen nur in der Standardbibliothek, die Pakete setzen (Finden Sie es .libPaths() mit)

hoffe, es hilft

Verwandte Themen