cellgeni / sceasy

A package to help convert different single-cell data formats to each other
GNU General Public License v3.0
346 stars 52 forks source link

convert h5ad to seruat problem (pandas) #84

Closed Flu09 closed 5 months ago

Flu09 commented 5 months ago

sceasy::convertFormat(h5ad_file, from="anndata", to="seurat", outFile='neuron.rds')

Error in py_module_import(module, convert = convert) : ModuleNotFoundError: No module named 'pandas.core.index' Run reticulate::py_last_error() for details.

reticulate::py_last_error()

── Python Exception Message ──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────── Traceback (most recent call last): File "/user/conda-environments/R_tools/lib/R/library/reticulate/python/rpytools/loader.py", line 119, in _find_and_load_hook return _run_hook(name, _hook) ^^^^^^^^^^^^^^^^^^^^^^ File "/user/conda-environments/R_tools/lib/R/library/reticulate/python/rpytools/loader.py", line 93, in _run_hook module = hook() ^^^^^^ File "/user/conda-environments/R_tools/lib/R/library/reticulate/python/rpytools/loader.py", line 117, in _hook return _find_andload(name, import) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/user/conda-environments/R_tools/lib/python3.12/site-packages/anndata/init.py", line 1, in from .core.anndata import AnnData, Raw File "/user/conda-environments/R_tools/lib/R/library/reticulate/python/rpytools/loader.py", line 119, in _find_and_load_hook return _run_hook(name, _hook) ^^^^^^^^^^^^^^^^^^^^^^ File "/user/conda-environments/R_tools/lib/R/library/reticulate/python/rpytools/loader.py", line 93, in _run_hook module = hook() ^^^^^^ File "/user/conda-environments/R_tools/lib/R/library/reticulate/python/rpytools/loader.py", line 117, in _hook return _find_andload(name, import) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/user/conda-environments/R_tools/lib/python3.12/site-packages/anndata/core/anndata.py", line 17, in from pandas.core.index import RangeIndex File "/user/conda-environments/R_tools/lib/R/library/reticulate/python/rpytools/loader.py", line 119, in _find_and_load_hook return _run_hook(name, _hook) ^^^^^^^^^^^^^^^^^^^^^^ File "/user/conda-environments/R_tools/lib/R/library/reticulate/python/rpytools/loader.py", line 93, in _run_hook module = hook() ^^^^^^ File "/user/conda-environments/R_tools/lib/R/library/reticulate/python/rpytools/loader.py", line 117, in _hook return _find_andload(name, import) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ModuleNotFoundError: No module named 'pandas.core.index'

── R Traceback ───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────── ▆

  1. └─sceasy::convertFormat(...)
  2. └─sceasy (local) func(obj, outFile = outFile, main_layer = main_layer, ...)
  3. └─reticulate::import("anndata", convert = FALSE)
  4. └─reticulate:::py_module_import(module, convert = convert)

conda install -c conda-forge pandas Collecting package metadata (current_repodata.json): done Solving environment: done

All requested packages already installed.

iaaka commented 5 months ago

Hi @Flu09, not exactly answer to your question, but maybe schard would work for you?

zktuong commented 4 months ago

I found that this has got to do with anndata actually. some dependency in my environment overwrote my anndata and installed an old version (anndata-0.6.22.post1) which isn't compatible with newer pandas versions. i can't be bothered to figure out which of my dependencies forced that but resinstall to the latest anndata version should solve this.

sarahhp commented 4 months ago

And only the conda-forge channel has the latest anndata version, not bioconda