2016-08-09 7 views
0

Ich benutze Python 3.4.3 unter Ubuntu 14.04 und möchte Call R-Code verwenden, um einige Ergebnisse zu erhalten. Ich kenne die Existenz einiger Pakete wie pyper und rpy2, aber sie sehen nur mit python2 kompatibel aus. 'sudo PIP3 installieren rpy2' ich die folgen bekommenPython3 - benutze/wrappe R-Funktion

Exception information: 
Traceback (most recent call last): 
    File "/usr/lib/python3/dist-packages/pip/basecommand.py", line 122, in main 
    status = self.run(options, args) 
    File "/usr/lib/python3/dist-packages/pip/commands/install.py", line 283, in run 
    requirement_set.install(install_options, global_options, root=options.root_path) 
    File "/usr/lib/python3/dist-packages/pip/req.py", line 1436, in install 
    requirement.install(install_options, global_options, *args, **kwargs) 
    File "/usr/lib/python3/dist-packages/pip/req.py", line 707, in install 
    cwd=self.source_dir, filter_stdout=self._filter_install, show_stdout=False) 
    File "/usr/lib/python3/dist-packages/pip/util.py", line 715, in call_subprocess 
    % (command_desc, proc.returncode, cwd)) 
pip.exceptions.InstallationError: Command /usr/bin/python3 -c "import setuptools, tokenize;__file__='/tmp/pip_build_user/rpy2/setup.py';exec(compile(getattr(tokenize, 'open', open)(__file__).read().replace('\r\n', '\n'), __file__, 'exec'))" install --record /tmp/pip-8hhbkgev-record/install-record.txt --single-version-externally-managed --compile failed with error code 1 in /tmp/pip_build_user/rpy2 

Gibt es eine Möglichkeit R Code in Python 3.4.3 zu verwenden Durch die Eingabe von?

+0

Haben Sie versucht, aus rpy2 mit * Rad * zu installieren [C. Gohlke Website] (http://www.lfd.uci.edu/~gohlke/pythonlibs/)? Ich denke, es gibt ein paar mehr Tricks, um die Installation unter Windows zu erreichen, siehe http://StackOverflow.com/a/32983656/5050917 zum Beispiel. – mgc

Antwort

0

rpy ist in der Tat kompatibel mit Python 2 und Python 3. http://rpy2.readthedocs.io/en/version_2.8.x/overview.html#requirements

Requirements

Currently the development is done on UNIX-like operating systems with the following software versions. Those are the recommended versions to run rpy2 with.

  • Python 3.5, with intended compatibility with 2.7 and > 3.3
+0

Also warum der Pip installieren rpy2 funktioniert, während Pip3 installieren rpy2 nicht? Datei "/usr/lib/python3/dist-packages/pip/util.py", Zeile 715, in call_subprocess % (command_desc, proc.returncode, cwd)) pip.exceptions.InstallationError: Befehl/usr/bin/python3 -c "import setuptools, tokenize; __ Datei __ = '/ tmp/pip_build_user/rpy2/setup.py'; exec (kompilieren (getattr (tokenize, 'öffnen', öffnen) (__ file __). read(). replace (' \ r \ n ',' \ n '), __datei__,' exec ')) "install --record /tmp/pip-8hhbkgev-record/install-record.txt --einzelne Version-extern-verwaltet --compile gescheitert mit Fehlercode 1 in/tmp/pip_build_user/rpy2 – user1403546

+0

Sind Sie sicher, dass es nicht für Python 3 installiert ist, wenn Sie 'pip install rpy2' verwenden? Manchmal, wenn ein Paket sowohl mit Python 2 als auch mit 3 kompatibel ist, reicht für beide Versionen nur die Verwendung von pip install aus. – Jokab

+0

Haben Sie versucht, Binärdateien manuell zu kompilieren, * dh * ohne pip3, oder vorkompilierte Binärdateien herunterzuladen? Ich hatte ein ähnliches Problem mit einem anderen Paket und es stellte sich heraus, dass bei einem Repository etwas schief gelaufen ist. Nicht so üblich für große Projekte, aber es passiert. – Synedraacus