question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

rpy2 installation linking problems

See original GitHub issue

I was having problems that I couldn’t diagnose, so I deleted all of miniconda/.jupyter/etc, and reinstalled.

The error

import rpy2
%load_ext rpy2.ipython
---------------------------------------------------------------------------
ImportError                               Traceback (most recent call last)
<ipython-input-3-a69f80d0128e> in <module>()
----> 1 get_ipython().magic('load_ext rpy2.ipython')

/Users/jonathan/miniconda3/envs/problem/lib/python3.4/site-packages/IPython/core/interactiveshell.py in magic(self, arg_s)
   2161         magic_name, _, magic_arg_s = arg_s.partition(' ')
   2162         magic_name = magic_name.lstrip(prefilter.ESC_MAGIC)
-> 2163         return self.run_line_magic(magic_name, magic_arg_s)
   2164
   2165     #-------------------------------------------------------------------------

/Users/jonathan/miniconda3/envs/problem/lib/python3.4/site-packages/IPython/core/interactiveshell.py in run_line_magic(self, magic_name, line)
   2082                 kwargs['local_ns'] = sys._getframe(stack_depth).f_locals
   2083             with self.builtin_trap:
-> 2084                 result = fn(*args,**kwargs)
   2085             return result
   2086

<decorator-gen-64> in load_ext(self, module_str)

/Users/jonathan/miniconda3/envs/problem/lib/python3.4/site-packages/IPython/core/magic.py in <lambda>(f, *a, **k)
    191     # but it's overkill for just that one bit of state.
    192     def magic_deco(arg):
--> 193         call = lambda f, *a, **k: f(*a, **k)
    194
    195         if callable(arg):

/Users/jonathan/miniconda3/envs/problem/lib/python3.4/site-packages/IPython/core/magics/extension.py in load_ext(self, module_str)
     64         if not module_str:
     65             raise UsageError('Missing module name.')
---> 66         res = self.shell.extension_manager.load_extension(module_str)
     67
     68         if res == 'already loaded':

/Users/jonathan/miniconda3/envs/problem/lib/python3.4/site-packages/IPython/core/extensions.py in load_extension(self, module_str)
     82             if module_str not in sys.modules:
     83                 with prepended_to_syspath(self.ipython_extension_dir):
---> 84                     __import__(module_str)
     85             mod = sys.modules[module_str]
     86             if self._call_load_ipython_extension(mod):

/Users/jonathan/miniconda3/envs/problem/lib/python3.4/site-packages/rpy2/ipython/__init__.py in <module>()
----> 1 from .rmagic import load_ipython_extension

/Users/jonathan/miniconda3/envs/problem/lib/python3.4/site-packages/rpy2/ipython/rmagic.py in <module>()
     50 # numpy and rpy2 imports
     51
---> 52 import rpy2.rinterface as ri
     53 import rpy2.robjects as ro
     54 import rpy2.robjects.packages as rpacks

/Users/jonathan/miniconda3/envs/problem/lib/python3.4/site-packages/rpy2/rinterface/__init__.py in <module>()
     90 del(os)
     91
---> 92 from rpy2.rinterface._rinterface import (baseenv,
     93                                          emptyenv,
     94                                          endr,

ImportError: dlopen(/Users/jonathan/miniconda3/envs/problem/lib/python3.4/site-packages/rpy2/rinterface/_rinterface.so, 2): Library not loaded: @rpath/libicuuc.54.dylib
  Referenced from: /Users/jonathan/miniconda3/envs/problem/lib/python3.4/site-packages/rpy2/rinterface/_rinterface.so
  Reason: image not found

How I installed everything

These were the steps that I ran:

conda update conda
conda config --add channels conda-forge
packages='ipywidgets
jupyter
jupyter_contrib_nbextensions
jupyter_nbextensions_configurator
matplotlib
mkl
mpld3
notebook
numpy
pandas
pip
pymc
pyparsing
scikit-learn
scipy
seaborn
statsmodels
'
conda create --name rpy3 -c r r r-irkernel r-recommended r-essentials rpy2 python=3 $packages -y
source activate rpy3
jupyter notebook

My setup

$ cat .condarc
channels:
  - conda-forge
  - defaults
anaconda_upload: true

And

$ conda info -a
Current conda install:

             platform : osx-64
        conda version : 4.1.11
    conda-env version : 2.5.2
  conda-build version : not installed
       python version : 3.5.2.final.0
     requests version : 2.10.0
     root environment : /Users/jonathan/miniconda3  (writable)
  default environment : /Users/jonathan/miniconda3
     envs directories : /Users/jonathan/miniconda3/envs
        package cache : /Users/jonathan/miniconda3/pkgs
         channel URLs : https://conda.anaconda.org/conda-forge/osx-64/
                        https://conda.anaconda.org/conda-forge/noarch/
                        https://repo.continuum.io/pkgs/free/osx-64/
                        https://repo.continuum.io/pkgs/free/noarch/
                        https://repo.continuum.io/pkgs/pro/osx-64/
                        https://repo.continuum.io/pkgs/pro/noarch/
          config file : /Users/jonathan/.condarc
         offline mode : False
    is foreign system : False

# conda environments:
#
rpy3                     /Users/jonathan/miniconda3/envs/rpy3
root                  *  /Users/jonathan/miniconda3

sys.version: 3.5.2 |Continuum Analytics, Inc.| (defau...
sys.prefix: /Users/jonathan/miniconda3
sys.executable: /Users/jonathan/miniconda3/bin/python
conda location: /Users/jonathan/miniconda3/lib/python3.5/site-packages/conda
conda-build: None
conda-env: /Users/jonathan/miniconda3/bin/conda-env
user site dirs: ~/.local/lib/python3.5

CIO_TEST: <not set>
CONDA_DEFAULT_ENV: <not set>
CONDA_ENVS_PATH: <not set>
DYLD_LIBRARY_PATH: <not set>
PATH: /Users/jonathan/miniconda3/bin:/Users/jonathan/miniconda3/bin:/Library/Frameworks/Python.framework/Versions/Current/bin:/Users/jonathan/Library/Haskell/bin:/Library/Frameworks/Python.framework/Versions/Current/bin:/Users/jonathan/github/whelper:/Users/jonathan/github/fitcmp:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/opt/X11/bin:/Library/TeX/texbin:/Users/jonathan/Dropbox/scripts:/Users/jonathan/Dropbox/scripts/bash:/Users/jonathan/bin:/Users/jonathan/github/AstroTools
PYTHONHOME: <not set>
PYTHONPATH: /Users/jonathan/github/CaliCompari/Python:/Users/jwhitmore/github/linfit:/Library/Frameworks/Python.framework/Versions/Current/bin/python:/Library/Frameworks/Python.framework/Versions/Current/lib:/Library/Frameworks/Python.framework/Versions/Current/bin/python:/Users/jonathan/github/AstroTools:

WARNING: could not import _license.show_info
# try:
# $ conda install -n root _license

Issue Analytics

  • State:closed
  • Created 7 years ago
  • Comments:33 (13 by maintainers)

github_iconTop GitHub Comments

4reactions
vsbuffalocommented, Aug 29, 2017

I’m having this same issue, and I agree with the following from above:

but to mark the issue as closed seems incorrect. It may be unsolvable, but this issue is a real one. People who have added the conda-forge channel will have otherwise working installs broken (in a really hard to diagnose way).

As far as I can tell, if a user needs rpy2, and anything in conda-forge, this issue occurs. rpy2 is an essential part of the Python data stack for many. This problem means that I can’t use conda at all for my current project, which seems to be a serious issue.

I’m happy to provide more information if needed on my specific case. But I think ignoring this issue outright is biting a lot of folks using conda for science.

4reactions
mingwandroidcommented, Jan 29, 2017

IMHO there should be a bug called “conda defaults and conda-forge are incompatible” and all these things should be marked as duplicates of that and then closed.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Error when installing rpy2 module in Python with easy_install
1) Edited my path environment variable to include "C:\Program Files\R\R-3.1. · 2) Created a new environment variable called "R_HOME" and set its ...
Read more >
rpy2 installation - Google Groups
Hello,. I am running into the problems described above. So far I am not able to R code in a snakemake workflow. My...
Read more >
Changes in rpy2 — rpy2 3.4.5 documentation
SIGPIPE sent to a process running Python+rpy2 could result in a segfault. This was caused by an incorrect setting of R signal handlers...
Read more >
Error When Using biocLite as an installer in rpy2 python library
r('BiocManager::install("GenomicAlignments")') and then robjects.r('library(GenomicAlignments)') and it works.
Read more >
How can I install Rpy2 in my system with out having the below ...
Below are the ways we tried to install and the issues we faced : 1) Installed rpy2 using anaconda and got the error...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found