OmriTreidel / cmprsk

Regression modeling of sub-distribution functions in competing risks
GNU General Public License v3.0
14 stars 7 forks source link

Import cmprsk.cmprsk results in AttributeError #4

Closed andreped closed 2 years ago

andreped commented 5 years ago

import cmprsk.cmprsk Traceback (most recent call last): File "", line 1, in File "/home/andrep/workspace/phd/python/venv/lib/python3.6/site-packages/cmprsk/cmprsk.py", line 9, in from . import rpy_utils File "/home/andrep/workspace/phd/python/venv/lib/python3.6/site-packages/cmprsk/rpy_utils.py", line 24, in class Dtypes(enum.Enum): File "/home/andrep/workspace/phd/python/venv/lib/python3.6/site-packages/cmprsk/rpy_utils.py", line 25, in Dtypes int = R.rinterface.INTSXP AttributeError: module 'rpy2.rinterface' has no attribute 'INTSXP'

After further analysis of the rpy2.rinterface object, using dir I get:

dir(rpy2.rinterface) ['BoolSexpVector', 'ByteSexpVector', 'CharSexp', 'ComplexSexpVector', 'ExprSexpVector', 'FloatSexpVector', 'IntSexpVector', 'LangSexpVector', 'ListSexpVector', 'MissingArg', 'NA', 'NA_Character', 'NA_Complex', 'NA_Integer', 'NA_Logical', 'NA_Real', 'NULL', 'NULLType', 'NumpyArrayInterface', 'PairlistSexpVector', 'RRuntimeWarning', 'RTYPES', 'R_NilValue', 'Sexp', 'SexpClosure', 'SexpEnvironment', 'SexpExtPtr', 'SexpPromise', 'SexpS4', 'SexpSymbol', 'SexpVector', 'StrSexpVector', 'MissingArgType', '_builtins', 'cached', 'doc', 'file', 'loader', 'name', 'package', 'spec', '_cdata_res_to_rinterface', '_evaluated_promise', '_post_initr_setup', '_rinterface', 'abc', 'atexit', 'baseenv', 'bufferprotocol', 'conversion', 'embedded', 'emptyenv', 'endr', 'evalr', 'globalenv', 'initr', 'initr_checkenv', 'initr_simple', 'make_extptr', 'math', 'memorymanagement', 'na_values', 'nullable_int', 'openrlib', 'os', 'parse', 'process_revents', 'rternalize', 'sexp', 'typing', 'unserialize', 'vector', 'vector_memoryview']

As 'INTSXP' cannot be found in this list, I'm guessing that they have renamed it to something else (?)... Is there a specific version of rpy2 one should use, or is there something else wrong?

KseniaErshova commented 5 years ago

I got this same error too. Reinstallation of R and rpy2 didn't help. I hope it can be fixed soon.

ChemGuy88 commented 4 years ago

I get the same traceback. It seems the cmprsk package is outdated.

OmriTreidel commented 3 years ago

my apologies for the late reply. I didn't see it until now. I've use version rpy2==2.9.4 I created the package. I've quite outdated at the moment as rpy version is currently 3.5 which means they've made backwards incompatible changes.

I'll try to update the dependencies of package to date

andreped commented 3 years ago

@OmriTreidel Patient as always. Still relevant for me in my studies. Will be great to get this finally working :]

OmriTreidel commented 2 years ago

It seems like rpy2 has made many breaking changes. @andreped were you able to run it using rpy2 2.9 ?

OmriTreidel commented 2 years ago

This issue was caused due to change in version of rpy2. version 0.1.0 requires rpy2 version less than 3. The cmprsk package is now version 1.0.0 and requires rpy2 greater than 3 so this issue is resolved.

andreped commented 2 years ago

It seems like rpy2 has made many breaking changes. @andreped were you able to run it using rpy2 2.9 ?

Just had the time to return back to this work. Just tested the new version and everything seems to be working, at least for my setup using Python 3.7.9 on Win10.

Great work!