1. rpy2
  2. rpy2
  3. rpy2
  4. Issues

Issues

Issue #399 invalid

RRuntimeError: Error in file(file, "rt") : cannot open the connection

Nikos Skalis
created an issue

Hi,

Could you please advise on the following:

I am trying to choose a CRAN mirror and and install some packages with rpy2 but my server has no internet connectivity, internet connectivity is achieved using http_proxy and 'https_proxy' that they seem not to be honoured when typing:

utils.chooseCRANmirror(ind=1)
In [7]: utils.chooseCRANmirror(ind=1)
^C/usr/lib64/python3.4/site-packages/rpy2/rinterface/__init__.py:186: RRuntimeWarning: 

  warnings.warn(x, RRuntimeWarning)
---------------------------------------------------------------------------
RRuntimeError                             Traceback (most recent call last)
<ipython-input-7-6631bac07c4e> in <module>()
----> 1 utils.chooseCRANmirror(ind=1)

/usr/lib64/python3.4/site-packages/rpy2/robjects/functions.py in __call__(self, *args, **kwargs)
    176                 v = kwargs.pop(k)
    177                 kwargs[r_k] = v
--> 178         return super(SignatureTranslatedFunction, self).__call__(*args, **kwargs)
    179 
    180 pattern_link = re.compile(r'\\link\{(.+?)\}')

/usr/lib64/python3.4/site-packages/rpy2/robjects/functions.py in __call__(self, *args, **kwargs)
    104         for k, v in kwargs.items():
    105             new_kwargs[k] = conversion.py2ri(v)
--> 106         res = super(Function, self).__call__(*new_args, **new_kwargs)
    107         res = conversion.ri2ro(res)
    108         return res

RRuntimeError: 

In [8]: utils.chooseCRANmirror(ind=1)
/usr/lib64/python3.4/site-packages/rpy2/rinterface/__init__.py:186: RRuntimeWarning: Warning:
  warnings.warn(x, RRuntimeWarning)
/usr/lib64/python3.4/site-packages/rpy2/rinterface/__init__.py:186: RRuntimeWarning:  failed to download mirrors file (cannot download all files); using local file '/usr/lib64/R/doc/CRAN_mirrors.csv'

  warnings.warn(x, RRuntimeWarning)
/usr/lib64/python3.4/site-packages/rpy2/rinterface/__init__.py:186: RRuntimeWarning: Error in file(file, "rt") : cannot open the connection

  warnings.warn(x, RRuntimeWarning)
/usr/lib64/python3.4/site-packages/rpy2/rinterface/__init__.py:186: RRuntimeWarning: In addition: 
  warnings.warn(x, RRuntimeWarning)
/usr/lib64/python3.4/site-packages/rpy2/rinterface/__init__.py:186: RRuntimeWarning: Warning messages:

  warnings.warn(x, RRuntimeWarning)
/usr/lib64/python3.4/site-packages/rpy2/rinterface/__init__.py:186: RRuntimeWarning: 1: 
  warnings.warn(x, RRuntimeWarning)
/usr/lib64/python3.4/site-packages/rpy2/rinterface/__init__.py:186: RRuntimeWarning: In download.file(url, destfile = f, quiet = TRUE) :
  warnings.warn(x, RRuntimeWarning)
/usr/lib64/python3.4/site-packages/rpy2/rinterface/__init__.py:186: RRuntimeWarning: 

  warnings.warn(x, RRuntimeWarning)
/usr/lib64/python3.4/site-packages/rpy2/rinterface/__init__.py:186: RRuntimeWarning:  URL 'https://cran.r-project.org/CRAN_mirrors.csv': status was 'Couldn't connect to server'

  warnings.warn(x, RRuntimeWarning)
/usr/lib64/python3.4/site-packages/rpy2/rinterface/__init__.py:186: RRuntimeWarning: 2: 
  warnings.warn(x, RRuntimeWarning)
/usr/lib64/python3.4/site-packages/rpy2/rinterface/__init__.py:186: RRuntimeWarning: In file(file, "rt") :
  warnings.warn(x, RRuntimeWarning)
/usr/lib64/python3.4/site-packages/rpy2/rinterface/__init__.py:186: RRuntimeWarning:  cannot open file '/usr/lib64/R/doc/CRAN_mirrors.csv': No such file or directory

  warnings.warn(x, RRuntimeWarning)
---------------------------------------------------------------------------
RRuntimeError                             Traceback (most recent call last)
<ipython-input-8-6631bac07c4e> in <module>()
----> 1 utils.chooseCRANmirror(ind=1)

/usr/lib64/python3.4/site-packages/rpy2/robjects/functions.py in __call__(self, *args, **kwargs)
    176                 v = kwargs.pop(k)
    177                 kwargs[r_k] = v
--> 178         return super(SignatureTranslatedFunction, self).__call__(*args, **kwargs)
    179 
    180 pattern_link = re.compile(r'\\link\{(.+?)\}')

/usr/lib64/python3.4/site-packages/rpy2/robjects/functions.py in __call__(self, *args, **kwargs)
    104         for k, v in kwargs.items():
    105             new_kwargs[k] = conversion.py2ri(v)
--> 106         res = super(Function, self).__call__(*new_args, **new_kwargs)
    107         res = conversion.ri2ro(res)
    108         return res

RRuntimeError: Error in file(file, "rt") : cannot open the connection

Could you please advise on how-to enforce the command to use the https_proxy, 'http_proxy' environment variables ?

Many Thanks.

Comments (4)

  1. Nikos Skalis reporter

    Well, is not possible to install any packages if env variables are not honoured, but I by-passed this with using Rscript instead of rpy2. you can close this ticket.

  2. Log in to comment