Issue : in importr env = _get_namespace(rname) RRuntimeError

Issue #390 closed
created an issue

Hi Laurent,

I am trying to solve an issue about this lien : egcm = importr('egcm')

rpy2 works fine in Spyder but I can't import the R package using : egcm = importr('egcm')

My error is :

File "C:\Users\My Name\Anaconda3\lib\site-packages\rpy2\robjects\", line 453, in importr env = _get_namespace(rname) RRuntimeError

It does not work either for "from rpy2.robjects.lib import ggplot2", same error.

I have done what you recommended here : HERE and here : HERE

I have Python 3.5.2 |Anaconda 4.2.0 (64-bit)|

Thanks in advance for your help, Best

Comments (4)

  1. gordon reporter

    By changing my R_USER from this C:\Users\"your user name"\Anaconda\Lib\site-packages\rpy2

    to this : R_USER C:\Users\"your user name" I can now use importr for several packages that did not work previously such as urca.

    But the package I need; "egcm" still does not work... and I have the same error message

  2. gordon reporter


    I try to use rpy2 in Spyder. I have Python 3.5.2 |Anaconda 4.2.0 (64-bit).

    First, this works : import rpy2.robjects as robjects pi = robjects.r['pi'] But when I want to use importr to get a package, I have an error message. example : egcm = importr('egcm')

    My error is :

    File "C:\Users\My_Name\Anaconda3\lib\site-packages\rpy2\robjects\", line 453, in importr env = _get_namespace(rname) RRuntimeError

    It does not work either for any other R package. The package egcm works in R.

    Moreover, when I try to test rpy2 in the command line with the follownig line : python -m rpy2.tests I got the following error message:

    enter image description here


    In R : R.home()

    1 "C:/PROGRA~1/R/R-33~1.2"

    In R : .libPaths()

    1 "C:/Users/Alexandre/Documents/R/win-library/3.3" [2] "C:/Program Files/R/R-3.3.2/library"

    In Python : from rpy2.robjects.packages import importr base = importr('base') print(base.R_home())

    1 "C:/Program Files/R/R-3.3.2"

    Then I tried again :

    `conda install --channel rpy2`

    Result : All requested packages already installed. packages in environment at C:\users\Alexandre\Anaconda3:

    rpy2 2.8.2 py35r3.3.1_1 r


    `pip install rpy2 `

    Result : Requirment already satisfied (use --upgrade to upgrade): rpy2 in C:...lib\site-packages

    same line with "six" instead of "rpy2"

    then You are using pip version 8.1.2, however version 9.0.1 is available. then

    `python -m pip install --upgrade pip `

    and now it works perfectly, I have no idea why...

    Thanks in advance for any ideas !

  3. Laurent Gautier

    That's with using Windows (unsupported) andconda (third-party software managing binaries). I believe that this would be better answered by the conda community or conda support.

    Reopen if believed to be an issue with rpy2 itself.

  4. Log in to comment