anndata icon indicating copy to clipboard operation
anndata copied to clipboard

ModuleNotFoundError

Open lizchcase opened this issue 1 year ago • 1 comments

I tried installing anndata into R using both install.packages("anndata", lib="PATH"). I am able to load the package with library(anndata), but when I read my file with read_h5ad, I get the following error:

Error in py_module_import(module, convert = convert) : ModuleNotFoundError: No module named 'anndata' Calls: read_h5ad -> <Anonymous> -> py_module_import Execution halted

I then tried deleting anndata from my environment and reinstalling with reticulate::install_miniconda() then anndata::install_anndata(lib="PATH"). Here, miniconda installs fine, but the second statement says that anndata cannot be recognized.

Any ideas to fix this so I can read my h5ad file would be much appreciated!

lizchcase avatar Sep 21 '23 22:09 lizchcase

I've had the same problem and I can't fix it.

mmartinezb97 avatar Mar 26 '24 15:03 mmartinezb97

This is possibly because the Python executable that the R process is automatically loading does not match the one in the conda or virtualenv environment where anndata is installed. Try reticulate::py_config() to see which python is loaded. You can view the reticulate articles to see how to change Python binary, or just use the python in reticulate::py_config() to install anndata.

h4rvey-g avatar Oct 11 '24 07:10 h4rvey-g