dynverse / anndata

Annotated multivariate observation data in R
https://anndata.dynverse.org
Other
43 stars 4 forks source link

ModuleNotFoundError #26

Closed lizchcase closed 1 week ago

lizchcase commented 1 year ago

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 -> -> 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!

mmartinezb97 commented 8 months ago

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

h4rvey-g commented 1 month ago

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.

rcannood commented 1 week ago

Hi all!

Indeed, reticulate seems to not be able to find the python anndata. If you don't manage to install it with anndata::install_anndata(), it might help to manually select which python you're using. See this documentation for more information.

I will close this issue since it's related to reticulate / miniconda.