theislab/scarches

ImportError: cannot import name 'setup_anndata' from 'scvi.data'

besidesme opened this issue · 2 comments

Hey there, I’m trying to reproduce your notebook „reference_building_from_scratch.ipynb“ and and am getting an error that I have not yet been able to solve.

First of all: I use Python 3.7 (also tested with 3.8, same problem), scArches 0.5.0 and scvi-tools 0.20.3 (also randomly tested with 0.16.0 and 0.19.0, same problem).

How can I get around this import error?

Enclosed: If I use scArches 0.4.0 and scvi-tools 0.12.0 this error does not occur, but I get the following error message "AttributeError: type object 'SCVI' has no attribute 'setup_anndata'". This is probably due to the fact that the notebooks are no longer adapted to the older versions of scvi and scarches. So a downgrade does not solve the problem for me either.

Maybe sca.models.SCANVI.setup_anndata?

Thank you for your suggestion!
The problem occurs right away in line 9 of the notebook "import scarches as sca":

import scarches as sca
from . import dataset, metrics, trainers, models, zenodo, plotting
from scvi.data import setup_anndata
ImportError: cannot import name 'setup_anndata' from 'scvi.data'

So unfortunately sca.models.SCANVI.setup_anndata doesn't help at this point.

(Even when trying this in the other, outdated, setup mentioned above I get the error "AttributeError: type object 'SCANVI' has no attribute 'setup_anndata'" in line 50 "sca.models.SCANVI.setup_anndata(source_adata, batch_key="batch")")