{"id":207,"date":"2015-11-06T20:38:22","date_gmt":"2015-11-06T19:38:22","guid":{"rendered":"https:\/\/blogs.fu-berlin.de\/gruenstaeudl\/?p=207"},"modified":"2015-11-06T20:44:11","modified_gmt":"2015-11-06T19:44:11","slug":"python-version-of-rpython","status":"publish","type":"post","link":"https:\/\/blogs.fu-berlin.de\/gruenstaeudl\/2015\/11\/06\/python-version-of-rpython\/","title":{"rendered":"Python version of rPython"},"content":{"rendered":"<p><strong>R shell vs. RStudio<\/strong><\/p>\n<p>&nbsp;<\/p>\n<p><em>NOTE: This blog post originally appeared on 12-Nov-2014 on the blog I kept when I was a postdoctoral researcher at the Ohio State University. I am reposting it here because several people have asked me about this very topic lately.<\/em><\/p>\n<p>&nbsp;<\/p>\n<p>On several occasions I have wondered which criterion the R package <em>rPython<\/em> employs to set the version of Python it interacts with. According to the installation file of <em>rPython<\/em>, &#8220;[b]y default, the package will be installed using the Python version given by $ python &#8211;version&#8221;. That seemed to be only part of the story, I thought, since my Linux system has Python 2.7.8 set as the default Python version, yet installations of the package\u00a0via <em>RStudio<\/em> resulted in Python 3.4.1 being utilized by <em>rPython<\/em>:<\/p>\n<div style=\"background-color: #ffebdb\">\n<p style=\"padding-left: 30px\"><code>&gt; library(rPython)<br \/>\n&gt; python.exec(\"import sys; info=sys.version\")<br \/>\n&gt; python.get(\"info\")<br \/>\n[1] \"3.4.2 (default, Oct 8 2014, 13:44:52) \\n[GCC 4.9.1 20140903 (prerelease)]\"<\/code><\/p>\n<\/div>\n<p>What eluded me, however, was to evaluate if the command &#8220;python \u2013version&#8221; would return <em>Python 2.7.8<\/em>, when run from <em>RStudio<\/em>, from where I usually install my R packages! Guess what: It does not.<em>RStudio<\/em> and the <em>R shell<\/em> invoke the bash shell differently, as evidenced by the following example:<\/p>\n<p>In <em>RStudio<\/em>:<\/p>\n<div style=\"background-color: #ffebdb\">\n<p style=\"padding-left: 30px\"><code>&gt; system(\"python --version\")<br \/>\nPython 3.4.2 <\/code><\/p>\n<\/div>\n<p>In <em>R shell<\/em>:<\/p>\n<div style=\"background-color: #ffebdb\">\n<p style=\"padding-left: 30px\"><code>&gt; system(\"python --version\")<br \/>\nPython 2.7.8 <\/code><\/p>\n<\/div>\n<p>Hence, if I wish to have <em>rPython<\/em> interact with Python 2.7.8, I must install the package from the <em>R shell<\/em>.<\/p>\n<p>&nbsp;<\/p>\n","protected":false},"excerpt":{"rendered":"<p>R shell vs. RStudio &nbsp; NOTE: This blog post originally appeared on 12-Nov-2014 on the blog I kept when I was a postdoctoral researcher at the Ohio State University. I am reposting it here because several people have asked me about this very topic lately. &nbsp; On several occasions I have wondered which criterion the [&hellip;]<\/p>\n","protected":false},"author":2306,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[9],"tags":[],"class_list":["post-207","post","type-post","status-publish","format-standard","hentry","category-allgemein"],"_links":{"self":[{"href":"https:\/\/blogs.fu-berlin.de\/gruenstaeudl\/wp-json\/wp\/v2\/posts\/207","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/blogs.fu-berlin.de\/gruenstaeudl\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/blogs.fu-berlin.de\/gruenstaeudl\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/blogs.fu-berlin.de\/gruenstaeudl\/wp-json\/wp\/v2\/users\/2306"}],"replies":[{"embeddable":true,"href":"https:\/\/blogs.fu-berlin.de\/gruenstaeudl\/wp-json\/wp\/v2\/comments?post=207"}],"version-history":[{"count":8,"href":"https:\/\/blogs.fu-berlin.de\/gruenstaeudl\/wp-json\/wp\/v2\/posts\/207\/revisions"}],"predecessor-version":[{"id":215,"href":"https:\/\/blogs.fu-berlin.de\/gruenstaeudl\/wp-json\/wp\/v2\/posts\/207\/revisions\/215"}],"wp:attachment":[{"href":"https:\/\/blogs.fu-berlin.de\/gruenstaeudl\/wp-json\/wp\/v2\/media?parent=207"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/blogs.fu-berlin.de\/gruenstaeudl\/wp-json\/wp\/v2\/categories?post=207"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/blogs.fu-berlin.de\/gruenstaeudl\/wp-json\/wp\/v2\/tags?post=207"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}