Help: My scvi does not work at all

Hi, I am new to scvi.
I used jupyterlab and my python version is 3.9.5.
I installed scvi following the tutorial.
pip install scvi-tools

I am able to import scvi to my jupyterlab.
However, when I tried to use it, it reminds me it does not has this attribute or that attribute.
For example,
adata = scvi.data.heart_cell_atlas_subsampled() Error: module ‘scvi’ has no attribute ‘data’

scvi.settings.seed = 420 Error: module ‘scvi’ has no attribute ‘settings’

Seems that my scvi contains nothing.

Could anyone give me some help?

Best,
Huimin Lyu

Can you run pip show scvi-tools and paste the output here?

I ran it and the output is:

Name: scvi-tools
Version: 0.17.1
Summary: Deep probabilistic analysis of single-cell omics data.
Home-page: GitHub - scverse/scvi-tools: Deep probabilistic analysis of single-cell omics data
Author: The scvi-tools development team
Author-email: adamgayoso@berkeley.edu
License: BSD-3-Clause
Location: /home/lyuhuimi/.local/lib/python3.9/site-packages
Requires: anndata, docrep, flax, h5py, ipywidgets, jax, jaxlib, mudata, numpy, numpyro, openpyxl, optax, pandas, pyro-ppl, pytorch-lightning, rich, scikit-learn, torch, torchmetrics, tqdm
Required-by:

Do you have a file named scvi.py in the directory where you’re running your notebook? If so, that might be the issue, try deleting or moving that file elsewhere, then re-start your jupyter kernel and import scvi again.
When you type scvi at the Python prompt you should get:
<module 'scvi' from '<your_path>/lib/python3.7/site-packages/scvi/__init__.py'>

Thank you so much. Problem solved.
I doubt this happened because when I installed scvi-tools the first time, I used the wrong command: pip install scvi
although I uninstalled scvi later and installed scvi-tools, I was not able to correctly import scvi-tools.
After I uninstall all scvi, scvi-tools from my global and virtual environment and reinstalled scvi-tools, problem solved.

1 Like