Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

error: The file contains an unrecognized object #51

Open
rojinsafavi opened this issue Oct 16, 2020 · 7 comments
Open

error: The file contains an unrecognized object #51

rojinsafavi opened this issue Oct 16, 2020 · 7 comments
Labels
enhancement New feature or request waiting for librdata changes the issue needs some fixes to the C library librdata before it can be solved

Comments

@rojinsafavi
Copy link

import pyreadr

result = pyreadr.read_r('infile.rds')

---------------------------------------------------------------------------
LibrdataError                             Traceback (most recent call last)
<ipython-input-46-82b33438231f> in <module>
      1 import pyreadr
      2 
----> 3 result = pyreadr.read_r('infile.rds')

/projects/sysbio/projects/rojin/anaconda3/envs/scvi/lib/python3.6/site-packages/pyreadr/pyreadr.py in read_r(path, use_objects, timezone)
     45     if not os.path.isfile(path):
     46         raise PyreadrError("File {0} does not exist!".format(path))
---> 47     parser.parse(path)
     48 
     49     result = OrderedDict()

/projects/sysbio/projects/rojin/anaconda3/envs/scvi/lib/python3.6/site-packages/pyreadr/librdata.pyx in pyreadr.librdata.Parser.parse()

/projects/sysbio/projects/rojin/anaconda3/envs/scvi/lib/python3.6/site-packages/pyreadr/librdata.pyx in pyreadr.librdata.Parser.parse()

LibrdataError: The file contains an unrecognized object

@ofajardo
Copy link
Owner

ofajardo commented Oct 16, 2020

From the Readme, known limitations section:

S4 Objects and probably other kind of objects, 
including those that depend on non base R 
packages (Bioconductor for example) cannot 
be read. The error code in this case is as follows:

"pyreadr.custom_errors.LibrdataError: 
The file contains an unrecognized object

@zznx
Copy link

zznx commented Nov 5, 2020

How to solve it? thank you @ofajardo

@ofajardo
Copy link
Owner

ofajardo commented Nov 5, 2020

No solution at the moment. The issue is tracked here: WizardMac/librdata#16

@ofajardo ofajardo changed the title error error: The file contains an unrecognized object Nov 5, 2020
@ofajardo ofajardo added the waiting for librdata changes the issue needs some fixes to the C library librdata before it can be solved label Nov 5, 2020
@ofajardo ofajardo reopened this Nov 5, 2020
@ofajardo ofajardo added the enhancement New feature or request label Nov 5, 2020
@Anthony-C-Nguyen
Copy link

I have run into this same issue and as far as I can tell, my data has no S4 objects or any unusual object types. Any thoughts on what else could be the issue?

@ofajardo
Copy link
Owner

ofajardo commented May 5, 2021

Please share the file. If I cannot reproduce it I cannot debug.

@Anthony-C-Nguyen
Copy link

Unfortunately the data contains personal health information and cannot be shared. I have an alternative versions of the data (same object types) that does not run into issues. If I am able to create the a version with fake data that reproduces the issue I will share. Thanks.

@Anthony-C-Nguyen
Copy link

I think I was able to resolve the issue. Seems to have come down to two things. It had an issue with the object being type "data.frame". However, as a "data.table" "data.frame" I no longer had the error. However, after this was resolved, the kernel would always reset. I found that the data had factor variables with NA coded as a level. This seemed to cause the kernel to reset

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request waiting for librdata changes the issue needs some fixes to the C library librdata before it can be solved
Projects
None yet
Development

No branches or pull requests

4 participants