Pandas import error using Rmagic

Issue #463 closed
francesco.brundu created an issue

I have pandas and rpy2 installed.

However the call to the rmagic in ipython does not work:

%load_ext rpy2.ipython
/Users/user/.pyenv/versions/3.6.5/lib/python3.6/site-packages/rpy2/ipython/rmagic.py:73: UserWarning: The Python package 'pandas' is stronglyrecommended when using `rpy2.ipython`. Unfortunately it could not be loaded, but at least we found 'numpy'.
  "but at least we found 'numpy'.")))

By looking at the source file, I noticed that the failing import is the following:

from rpy2.robjects import pandas2ri

which fails with

     20 import numpy
     21 import pytz
---> 22 import tzlocal
     23 import warnings
     24

ModuleNotFoundError: No module named 'tzlocal'

I think the message of the failed import for rmagic is a bit misleading. Or maybe tzlocal should be included as a dependency.

Thanks, Francesco

python 3.6.5, pandas==0.22.0, rpy2==2.9.3

Comments (7)

  1. Laurent Gautier

    Fixed issue #463.

    Importing rmagic will now dissociate trying to import numpy and pandas with a fallback mechanism from importing the associated rpy2 conversion modules.

    → <<cset 8603e371407f>>

  2. Laurent Gautier

    Fixed issue #463.

    Importing rmagic will now dissociate trying to import numpy and pandas with a fallback mechanism from importing the associated rpy2 conversion modules.

    → <<cset 8fe742421d8d>>

  3. Log in to comment