Error with import scvi

Hi all,

I am trying to use scanpy and got this error that I could not fix after trying a solution found on stackoverflow. Would you please have a suggestion? I appreciate it!

import scvi
import scanpy as sc
from matplotlib.pyplot import rc_context
sc.set_figure_params(dpi=100)

ImportError: cannot import name ‘ModelMetaclass’ from ‘pydantic.main’ (/usr/local/lib/python3.10/dist-packages/pydantic/main.py)

Are you using the latest scvi? A somewhat recent but not the latest version had such issues.

1 Like

Hi @Zethson , I install scvi using !pip install scvi-tools and then import it so I think it is the latest version. Seem running conda install scvi-tools -c conda-forge fix the error but got error when run that code on google colab:
ValueError: The python kernel does not appear to be a conda environment. Please use %pip install instead. I don’t have that error on a local jupyter notebook.