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

MemoryError: Unable to allocate 163. GiB for an array with shape (1092172, 20002) and data type float64 #206

Open
wuxiangning opened this issue Oct 16, 2024 · 3 comments

Comments

@wuxiangning
Copy link

Hello!When I was running a large amount of data interaction, I had such a problem, how can I solve this problem?
This is my code:
cpdb_file_path = 'cellphonedb.zip'
metadata = pd.read_csv(meta_file_path, sep = '\t')
metadata.head(3)
counts_file_path ="F:/x/Rdata/Selected_data/normolized/241016_allzzm_endo.h5ad"
pdb_results = cpdb_statistical_analysis_method.call(
cpdb_file_path = cpdb_file_path,
meta_file_path = meta_file_path,
counts_file_path =counts_file_path,
counts_data = 'hgnc_symbol',
output_path = out_path)

Reading user files...
MemoryError: Unable to allocate 163. GiB for an array with shape (1092172, 20002) and data type float64

Help!!!

@ktroule
Copy link
Collaborator

ktroule commented Oct 17, 2024

Hi.

You can either downsample the adata yourself or use the option subsampling which will automatically perform the downsampling. More information here.

Regards

@wuxiangning
Copy link
Author

I have tried adjusting the subsampling to subset my large dataset, but I still encounter the same error. Out of frustration, I can only subset the data in R first and then call it into Python for computation. This seems redundant, and I’m not sure if there is an issue with the subsampling.
Thank you.

@ktroule
Copy link
Collaborator

ktroule commented Oct 28, 2024

If "MemoryError" error still persists I would suggest to downsample the datasets even more as the limiting factor seems to be the machine you are using.

To subsample the dataset in scanpy you can use scanpy.pp.subsample(data, fraction=None, *, n_obs=None, random_state=0, copy=False)

Regards

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants