cellgeni/sceasy

convert h5ad to seruat problem (pandas)

Flu09 opened this issue · 3 comments

Flu09 commented

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_and_load(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_and_load(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_and_load(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

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

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.

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