如何在Databricks中安装python软件包'rpy2'?

时间:2019-04-08 17:36:52

标签: python python-3.x rpy2 databricks azure-databricks

我正在尝试在Databricks中安装和利用pymer4软件包功能,这也需要安装rpy2。在群集的“库”下,我能够安装它们,甚至说“已安装”,但是当我尝试导入它们时,它会给出错误,好像安装不正确。在本地系统中,它运行完美。

from pymer4.test_install import test_install

错误是:


ImportError: No module named 'pandas.core.dtypes'
---------------------------------------------------------------------------
ImportError                               Traceback (most recent call last)
<command-2946392196605768> in <module>()
----> 1 from pymer4.test_install import test_install

/databricks/python/lib/python3.5/site-packages/pymer4/__init__.py in <module>()
      6            "__version__"]
      7 
----> 8 from .models import Lmer, Lm
      9 from .simulate import (easy_multivariate_normal,
     10                        simulate_lm,

/databricks/python/lib/python3.5/site-packages/pymer4/models.py in <module>()
      2 import rpy2.robjects as robjects
      3 from rpy2.robjects.packages import importr
----> 4 from rpy2.robjects import pandas2ri
      5 import rpy2
      6 from copy import copy

/databricks/python/lib/python3.5/site-packages/rpy2/robjects/pandas2ri.py in <module>()
     14 from pandas.core.series import Series as PandasSeries
     15 from pandas.core.index import Index as PandasIndex
---> 16 from pandas.core.dtypes.api import is_datetime64_any_dtype
     17 import pandas
     18 import numpy

ImportError: No module named 'pandas.core.dtypes'

1 个答案:

答案 0 :(得分:0)

能够解决我自己的问题。没什么,不过是pymer4软件包的依赖软件包的版本问题。 使用pymer4发行日期之前的最新软件包更改了以下软件包的版本,并且可以使用:

matplotlib==3.0.2
pandas==0.23.4
rpy2==2.9.4
tzlocal