9

I have a relatively fresh installation of anaconda, in which I installed rpy2 using "conda install rpy2". However, when I try running it, I get this error, e.g.:

> /[dir]/anaconda/bin/python -m 'rpy2.tests'
Traceback (most recent call last):
  File "/[dir]/anaconda/lib/python2.7/runpy.py", line 174, in _run_module_as_main
    "__main__", fname, loader, pkg_name)
  File "/[dir]/anaconda/lib/python2.7/runpy.py", line 72, in _run_code
    exec code in run_globals
  File "[dir]/anaconda/lib/python2.7/site-packages/rpy2/tests.py", line 23, in <module>
    import rpy2.tests_rpy_classic
  File "/[dir]/anaconda/lib/python2.7/site-packages/rpy2/tests_rpy_classic.py", line 3, in <module>
    import rpy2.rpy_classic as rpy
  File "/[dir]/anaconda/lib/python2.7/site-packages/rpy2/rpy_classic.py", line 5, in <module>
    import rpy2.rinterface as ri
  File "/[dir]/anaconda/lib/python2.7/site-packages/rpy2/rinterface/__init__.py", line 92, in <module>
    from rpy2.rinterface._rinterface import (baseenv,
ImportError: libiconv.so.2: cannot open shared object file: No such file or directory

What is this libiconv.so.2, and why doesn't it work straight from the box?

R S
  • 11,359
  • 10
  • 43
  • 50
  • I used the solution from a similar question: uninstall and reinstall anaconda. https://stackoverflow.com/questions/33672565/rpy2-error-after-upgrading-to-osx-el-capitan – Chris Nov 22 '17 at 21:44
  • Sometimes installing it through pip also solves the problem. Note: pip installed packages are also detected by conda (you can see them by running the `conda list` command. – anilbey Feb 01 '18 at 15:12

1 Answers1

13

I think you need to conda install -c r libiconv or perhaps install r-essentials, which contains libiconv.

Joffer
  • 1,921
  • 2
  • 21
  • 23