mhahsler / arulespy

Python interface to arules for association rule mining
https://mhahsler.github.io/arulespy/
GNU General Public License v3.0
8 stars 0 forks source link

Keyerror \\'details' while importing arulespy #4

Closed elsamdea closed 1 year ago

elsamdea commented 1 year ago

Hi!

I have successfully installed this library, but, when I try to import it in jupyter notebook inside visual studio code environment, I get the following error:

KeyError Traceback (most recent call last) Cell In[53], line 9 7 import arulesviz 8 utils = importr("utils") ----> 9 import arulespy

File ~/miniconda3/envs/ngs/lib/python3.9/site-packages/arulespy/init.py:26 20 utils.install_packages('arulesViz', 21 repos='https://cloud.r-project.org/', 22 lib = ro.r('Sys.getenv("R_LIBS_USER")[1]')) 25 from .arules import R_arules, arules2py, parameters, Associations, ItemMatrix, Rules, Itemsets, Transactions, concat, apriori, eclat, discretizeDF ---> 26 from .arulesViz import R_arulesViz, plot, inspectDT, ruleExplorer

File ~/miniconda3/envs/ngs/lib/python3.9/site-packages/arulespy/arulesViz.py:31 29 app = R_arulesViz.ruleExplorer(x, sidebarWidth = sidebarWidth, graphHeight = graphHeight) 30 print(app)
---> 31 ruleExplorer.doc = R_arulesViz.ruleExplorer.doc

File ~/miniconda3/envs/ngs/lib/python3.9/site-packages/rpy2/robjects/functions.py:54, in DocstringProperty.get(self, obj, objtype) 52 return self.class_doc 53 else: ---> 54 return self.fget(obj)

File ~/miniconda3/envs/ngs/lib/python3.9/site-packages/rpy2/robjects/functions.py:255, in DocumentedSTFunction.doc(self) 251 doc.append(' '.join((' ', item.name, ': ', description))) 252 doc.append('') 254 doc.append( --> 255 help.docstring(self.rpackagename, 256 self.rname, 257 sections=['\details']) 258 ) 260 return os.linesep.join(doc)

File ~/miniconda3/envs/ngs/lib/python3.9/site-packages/rpy2/robjects/help.py:428, in docstring(package, alias, sections) 426 package = Package(package) 427 page = package.fetch(alias) --> 428 return page.to_docstring(sections)

File ~/miniconda3/envs/ngs/lib/python3.9/site-packages/rpy2/robjects/help.py:293, in Page.to_docstring(self, section_names) 291 s.append(os.linesep) 292 s.append(os.linesep) --> 293 walk(self.sections[name]) 294 s.append(os.linesep) 295 s.append(os.linesep)

KeyError: '\detailsKeyError Traceback (most recent call last) Cell In[53], line 9 7 import arulesviz 8 utils = importr("utils") ----> 9 import arulespy

File ~/miniconda3/envs/ngs/lib/python3.9/site-packages/arulespy/init.py:26 20 utils.install_packages('arulesViz', 21 repos='https://cloud.r-project.org/', 22 lib = ro.r('Sys.getenv("R_LIBS_USER")[1]')) 25 from .arules import R_arules, arules2py, parameters, Associations, ItemMatrix, Rules, Itemsets, Transactions, concat, apriori, eclat, discretizeDF ---> 26 from .arulesViz import R_arulesViz, plot, inspectDT, ruleExplorer

File ~/miniconda3/envs/ngs/lib/python3.9/site-packages/arulespy/arulesViz.py:31 29 app = R_arulesViz.ruleExplorer(x, sidebarWidth = sidebarWidth, graphHeight = graphHeight) 30 print(app)
---> 31 ruleExplorer.doc = R_arulesViz.ruleExplorer.doc

File ~/miniconda3/envs/ngs/lib/python3.9/site-packages/rpy2/robjects/functions.py:54, in DocstringProperty.get(self, obj, objtype) 52 return self.class_doc 53 else: ---> 54 return self.fget(obj)

File ~/miniconda3/envs/ngs/lib/python3.9/site-packages/rpy2/robjects/functions.py:255, in DocumentedSTFunction.doc(self) 251 doc.append(' '.join((' ', item.name, ': ', description))) 252 doc.append('') 254 doc.append( --> 255 help.docstring(self.rpackagename, 256 self.rname, 257 sections=['\details']) 258 ) 260 return os.linesep.join(doc)

File ~/miniconda3/envs/ngs/lib/python3.9/site-packages/rpy2/robjects/help.py:428, in docstring(package, alias, sections) 426 package = Package(package) 427 page = package.fetch(alias) --> 428 return page.to_docstring(sections)

File ~/miniconda3/envs/ngs/lib/python3.9/site-packages/rpy2/robjects/help.py:293, in Page.to_docstring(self, section_names) 291 s.append(os.linesep) 292 s.append(os.linesep) --> 293 walk(self.sections[name]) 294 s.append(os.linesep) 295 s.append(os.linesep)

KeyError: '\details'

When I look for the error message, it redirects me to the init.py file.

I have successfully installed arules and arulesViz library in my Python and R environments.

Could someone see if I have omitted something? Maybe it is related to jupyter notebook?

Thanks in advance!!

mhahsler commented 1 year ago

Hmmm. Looks like there is some problem with the documentation system in rpy2. It seems like the R manual page in ruleExporer() has no details section which results in the issue. I will work on fixing this.

mhahsler commented 1 year ago

A little research shows that this issue was fixed in rpy2 Release 3.5.3 (see https://rpy2.github.io/doc/latest/html/changes.html). Please update to the latest version or rpy2.

mhahsler commented 1 year ago

The latest version of arulespy enforces now the correct version of rpy2.