简体   繁体   English

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

[英]How to install python package 'rpy2' in Databricks?

I am trying to install and utilize pymer4 package functionalities in Databricks which requires rpy2 to be installed as well. 我正在尝试在Databricks中安装和使用pymer4包功能,这也需要安装rpy2。 Under Library in the Cluster I am able to install them, it even says "Installed", but when I try to import them then it gives error, as if it was not installed properly. 在群集中的库下我可以安装它们,它甚至会显示“已安装”,但是当我尝试导入它们时,它会出错,就像它没有正确安装一样。 In local system it works perfectly. 在本地系统中它完美运行。

from pymer4.test_install import test_install

Error is: 错误是:


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'

Was able to solve my own problem. 能够解决我自己的问题。 It was nothing but version issues of dependent packages of pymer4 package. 这只是pymer4包的依赖包的版本问题。 Changed the version of following packages with the latest one prior to release date of pymer4 and it worked: 使用pymer4发布日期之前的最新版本更改了以下软件包的版本,并且工作正常:

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

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM